[jboss-cvs] JBossAS SVN: r85301 - in branches/Branch_5_x: connector/src/main/org/jboss/resource/deployers/management and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 5 10:02:20 EST 2009


Author: scott.stark at jboss.org
Date: 2009-03-05 10:02:20 -0500 (Thu, 05 Mar 2009)
New Revision: 85301

Modified:
   branches/Branch_5_x/component-matrix/pom.xml
   branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryTemplateInfo.java
   branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplateInfo.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplateInfo.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java
Log:
JBAS-6219, ensure each deployment template returns a copy of the information


Modified: branches/Branch_5_x/component-matrix/pom.xml
===================================================================
--- branches/Branch_5_x/component-matrix/pom.xml	2009-03-05 14:56:52 UTC (rev 85300)
+++ branches/Branch_5_x/component-matrix/pom.xml	2009-03-05 15:02:20 UTC (rev 85301)
@@ -73,7 +73,7 @@
     <version.org.jboss.jpa>1.0.0-CR1</version.org.jboss.jpa>
     <version.org.jboss.logbridge>1.0.0.CR1</version.org.jboss.logbridge>
     <version.org.jboss.logmanager>1.0.0.CR1</version.org.jboss.logmanager>
-    <version.org.jboss.man>2.1.0.CR2</version.org.jboss.man>
+    <version.org.jboss.man>2.1.0.CR3</version.org.jboss.man>
     <version.org.jboss.mdr>2.0.1.GA</version.org.jboss.mdr>
     <version.org.jboss.metadata>1.0.0.CR16</version.org.jboss.metadata>
     <version.org.jboss.microcontainer>2.0.4.GA</version.org.jboss.microcontainer>

Modified: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryTemplateInfo.java
===================================================================
--- branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryTemplateInfo.java	2009-03-05 14:56:52 UTC (rev 85300)
+++ branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryTemplateInfo.java	2009-03-05 15:02:20 UTC (rev 85301)
@@ -24,6 +24,7 @@
 import java.util.HashSet;
 import java.util.Map;
 
+import org.jboss.managed.api.DeploymentTemplateInfo;
 import org.jboss.managed.api.Fields;
 import org.jboss.managed.plugins.BasicDeploymentTemplateInfo;
 import org.jboss.managed.plugins.DefaultFieldsImpl;
@@ -83,6 +84,21 @@
 
    public void start()
    {
+      populate();
+   }
+
+   @Override
+   public ConnectionFactoryTemplateInfo copy()
+   {
+      ConnectionFactoryTemplateInfo copy = new ConnectionFactoryTemplateInfo(getName(), getDescription(),
+            attachmentName, dsTypeAttachmentName);
+      copy.setPropertyNameMappings(propertyNameMappings);
+      copy(copy);
+      copy.populate();
+      return copy;
+   }
+   protected void populate()
+   {
       ManagedObjectImpl mo = new ManagedObjectImpl(attachmentName);
       // The jndi name field info
       DefaultFieldsImpl f0 = new DefaultFieldsImpl();
@@ -162,7 +178,6 @@
       ManagedPropertyImpl dsType = new ManagedPropertyImpl(mo2, f21);
       super.addProperty(dsType);
    }
-
    protected void setFieldName(String name, Fields f)
    {
       f.setField(Fields.NAME, name);

Modified: branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplateInfo.java
===================================================================
--- branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplateInfo.java	2009-03-05 14:56:52 UTC (rev 85300)
+++ branches/Branch_5_x/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplateInfo.java	2009-03-05 15:02:20 UTC (rev 85301)
@@ -30,6 +30,7 @@
 import java.lang.reflect.UndeclaredThrowableException;
 
 import org.jboss.annotation.factory.AnnotationProxy;
+import org.jboss.managed.api.DeploymentTemplateInfo;
 import org.jboss.managed.api.Fields;
 import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.api.annotation.ManagementObjectID;
@@ -70,7 +71,6 @@
    public DsDataSourceTemplateInfo(String arg0, String arg1, Map<String, ManagedProperty> arg2)
    {
       super(arg0, arg1, arg2);
-      // TODO Auto-generated constructor stub
    }
 
    public DsDataSourceTemplateInfo(String name, String description, String datasourceType)
@@ -101,31 +101,21 @@
 
    public void start()
    {
-/*
-      // The type of the datasource
-      ManagedObjectImpl mo2 = new ManagedObjectImpl(ManagedConnectionFactoryDeploymentGroup.class.getName());
-      DefaultFieldsImpl dsTypeField = new DefaultFieldsImpl();
-      setFieldName("datasource-type", dsTypeField);
-      dsTypeField.setDescription("The type of the DataSource");
-      dsTypeField.setMandatory(true);
-      dsTypeField.setValue("local-tx-datasource");
-      HashSet<MetaValue> values = new HashSet<MetaValue>();
-      values.add(SimpleValueSupport.wrap("local-tx-datasource"));
-      values.add(SimpleValueSupport.wrap("no-tx-datasource"));
-      values.add(SimpleValueSupport.wrap("xa-datasource"));
-      values.add(SimpleValueSupport.wrap("no-tx-connection-factory"));
-      values.add(SimpleValueSupport.wrap("tx-connection-factory"));
-      dsTypeField.setLegalValues(values);
-      dsTypeField.setMetaType(SimpleMetaType.STRING);
-      ManagedPropertyImpl dsTypeProp = new ManagedPropertyImpl(mo2, dsTypeField);
-      super.addProperty(dsTypeProp);
+      populate();
+   }
 
-      if(this.dsType != null)
-         dsTypeField.setValue(this.dsType);
-      else
-         this.dsType = (String)dsTypeField.getValue();
-*/
+   @Override
+   public DsDataSourceTemplateInfo copy()
+   {
+      DsDataSourceTemplateInfo copy = new DsDataSourceTemplateInfo(getName(), getDescription(), dsType);
+      copy.setPropertyNameMappings(propertyNameMappings);
+      super.copy(copy);
+      copy.populate();
+      return copy;
+   }
 
+   private void populate()
+   {
       // DataSource
       if("local-tx-datasource".equals(dsType))
          createLocalTxDsTemplate();
@@ -138,9 +128,8 @@
       else if("no-tx-connection-factory".equals(dsType))
          createNoTxCfTemplate();
       else
-         throw new IllegalStateException("Unsupported dsType: " + dsType);
+         throw new IllegalStateException("Unsupported dsType: " + dsType);      
    }
-
    private void createXaDsTemplate()
    {
       ManagedObjectImpl mo = new ManagedObjectImpl(XADataSourceDeploymentMetaData.class.getName());

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2009-03-05 14:56:52 UTC (rev 85300)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2009-03-05 15:02:20 UTC (rev 85301)
@@ -879,7 +879,9 @@
          throw new IllegalStateException(msg);
       }
 
+      // Make sure to return a copy to avoid call by reference uses modifying the template values
       DeploymentTemplateInfo info = template.getInfo();
+      info = info.copy();
       log.debug("getTemplate, "+info);
       return info;
    }

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplateInfo.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplateInfo.java	2009-03-05 14:56:52 UTC (rev 85300)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplateInfo.java	2009-03-05 15:02:20 UTC (rev 85301)
@@ -72,6 +72,11 @@
 
    public void start()
    {
+      populate();
+   }
+
+   protected void populate()
+   {
       ManagedObjectImpl mo = new ManagedObjectImpl(attachmentName);
       // The jndi name field info
       DefaultFieldsImpl f0 = new DefaultFieldsImpl();
@@ -151,7 +156,6 @@
       ManagedPropertyImpl dsType = new ManagedPropertyImpl(mo2, f21);
       super.addProperty(dsType);
    }
-
    protected void setFieldName(String name, Fields f)
    {
       f.setField(Fields.NAME, name);

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java	2009-03-05 14:56:52 UTC (rev 85300)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java	2009-03-05 15:02:20 UTC (rev 85301)
@@ -28,6 +28,7 @@
 import java.util.Map;
 
 import org.jboss.annotation.factory.AnnotationProxy;
+import org.jboss.managed.api.DeploymentTemplateInfo;
 import org.jboss.managed.api.Fields;
 import org.jboss.managed.api.annotation.ManagementObjectID;
 import org.jboss.managed.plugins.BasicDeploymentTemplateInfo;
@@ -62,6 +63,20 @@
 
    public void start()
    {
+      populate();
+   }
+
+   @Override
+   public DeploymentTemplateInfo copy()
+   {
+      JmsDestinationTemplateInfo copy = new JmsDestinationTemplateInfo(getName(), getDescription(), destinationType);
+      super.copy(copy);
+      copy.populate();
+      return copy;
+   }
+
+   private void populate()
+   {
       ManagedObjectImpl mo;
       if("queue".equals(destinationType))
          mo = new ManagedObjectImpl("org.jboss.jms.server.destination.QueueServiceMO");
@@ -73,7 +88,6 @@
       addManagedProperty("name", "The destination name", true, false, SimpleMetaType.STRING, mo);
       addManagedProperty("JNDIName", "The destination's JNDI name", false, true, SimpleMetaType.STRING, mo);
    }
-
    private void addManagedProperty(String fieldName,
                                    String fieldDescr,
                                    boolean mandatory,




More information about the jboss-cvs-commits mailing list