[jboss-cvs] JBossAS SVN: r63616 - in trunk/connector/src/main/org/jboss/resource/deployers: management and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 22 17:43:46 EDT 2007


Author: scott.stark at jboss.org
Date: 2007-06-22 17:43:46 -0400 (Fri, 22 Jun 2007)
New Revision: 63616

Added:
   trunk/connector/src/main/org/jboss/resource/deployers/management/
   trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryFields.java
   trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryManagedObject.java
   trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryProperty.java
   trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryTemplateInfo.java
Log:
Save current managed object work

Added: trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryFields.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryFields.java	                        (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryFields.java	2007-06-22 21:43:46 UTC (rev 63616)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.resource.deployers.management;
+
+import org.jboss.managed.plugins.DefaultFieldsImpl;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ConnectionFactoryFields extends DefaultFieldsImpl
+{
+   private static final long serialVersionUID = 1;
+
+   private ManagedConnectionFactoryDeploymentMetaData metaData;
+
+   ConnectionFactoryFields(ManagedConnectionFactoryDeploymentMetaData metaData, String name)
+   {
+      super(name);
+      this.metaData = metaData;
+   }
+
+   
+}


Property changes on: trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryFields.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryManagedObject.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryManagedObject.java	                        (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryManagedObject.java	2007-06-22 21:43:46 UTC (rev 63616)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.resource.deployers.management;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.plugins.ManagedObjectImpl;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
+
+/**
+ * The ManagedObject implementation for the ManagedConnectionFactoryDeploymentGroup.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ConnectionFactoryManagedObject extends ManagedObjectImpl
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 1L;
+
+   /**
+    * ConnectionFactoryManagedObject ctor
+    */
+   public ConnectionFactoryManagedObject(ManagedConnectionFactoryDeploymentGroup metaData,
+         String[] propNames)
+      throws Exception
+   {
+      this(ManagedConnectionFactoryDeploymentGroup.class.getName(), metaData, propNames);
+   }
+   /**
+    * ConnectionFactoryManagedObject ctor
+    * @param attachmentName - 
+    */
+   public ConnectionFactoryManagedObject(String attachmentName,
+         ManagedConnectionFactoryDeploymentGroup metaData, String[] propNames)
+      throws Exception
+   {
+      super(attachmentName);
+
+      // Create the ManagedPropertys for the metaData
+      Set<ManagedProperty> properties = getProperties();
+      List<ManagedConnectionFactoryDeploymentMetaData> deployments = metaData.getDeployments();
+      for(ManagedConnectionFactoryDeploymentMetaData md : deployments)
+      {
+         for(String name : propNames)
+         {
+            ConnectionFactoryFields fields = createField(md, name);
+            ConnectionFactoryProperty p = new ConnectionFactoryProperty(this, fields);
+            properties.add(p);
+         }
+      }
+   }
+
+   @Override
+   public String toString()
+   {
+      StringBuilder tmp = new StringBuilder("ConnectionFactoryManagedObject{");
+      tmp.append(super.getProperties());
+      tmp.append('}');
+      return tmp.toString();
+   }
+
+   ConnectionFactoryFields createField(ManagedConnectionFactoryDeploymentMetaData md, String name)
+      throws Exception
+   {
+      Class[] sig = {};
+      Method getter = md.getClass().getMethod(name, sig);
+      ConnectionFactoryFields fields = null;
+      return fields;
+   }
+}


Property changes on: trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryManagedObject.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryProperty.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryProperty.java	                        (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryProperty.java	2007-06-22 21:43:46 UTC (rev 63616)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.resource.deployers.management;
+
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.plugins.ManagedPropertyImpl;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ConnectionFactoryProperty extends ManagedPropertyImpl
+{
+   private static final long serialVersionUID = 1;
+
+   public ConnectionFactoryProperty(Fields fields)
+   {
+      super(fields);
+   }
+
+   public ConnectionFactoryProperty(ManagedObject managedObject, Fields fields)
+   {
+      super(managedObject, fields);
+   }
+
+   public ConnectionFactoryProperty(String name)
+   {
+      super(name);
+   }
+
+}


Property changes on: trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryProperty.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryTemplateInfo.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryTemplateInfo.java	                        (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryTemplateInfo.java	2007-06-22 21:43:46 UTC (rev 63616)
@@ -0,0 +1,177 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.resource.deployers.management;
+
+import java.util.HashSet;
+import java.util.Map;
+
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.plugins.DefaultFieldsImpl;
+import org.jboss.managed.plugins.ManagedObjectImpl;
+import org.jboss.managed.plugins.ManagedPropertyImpl;
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.ImmutableCompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.profileservice.management.plugins.BasicDeploymentTemplateInfo;
+
+/**
+ * The ConnectionFactory template information. This describes the detached properties
+ * that are available for defining a new ConnectionFactory deployment.
+ * 
+ * The following properties are supported: 
+ * datasource-type : one of local-tx-datasource, no-tx-datasource, xa-datasource, no-tx-connection-factory, tx-connection-factory
+ * jndi-name
+ * connection-url
+ * user-name
+ * password
+ * security-domain
+ * driver-class
+ * connection-properties
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ConnectionFactoryTemplateInfo extends BasicDeploymentTemplateInfo
+{
+   private static final long serialVersionUID = 1;
+   private Map<String, String> propertyNameMappings;
+   private String attachmentName;
+   private String dsTypeAttachmentName;
+
+   public ConnectionFactoryTemplateInfo(String name, String description, String attachmentName)
+   {
+      this(name, description, attachmentName, attachmentName);
+   }
+   public ConnectionFactoryTemplateInfo(String name, String description,
+         String attachmentName, String dsTypeAttachmentName)
+   {
+      super(name, description);
+      this.attachmentName = attachmentName;
+      this.dsTypeAttachmentName = dsTypeAttachmentName;
+   }
+
+   public Map<String, String> getPropertyNameMappings()
+   {
+      return propertyNameMappings;
+   }
+   public void setPropertyNameMappings(Map<String, String> propertyNameMappings)
+   {
+      this.propertyNameMappings = propertyNameMappings;
+   }
+
+   public void start()
+   {
+      ManagedObjectImpl mo = new ManagedObjectImpl(attachmentName);
+      // The jndi name field info
+      DefaultFieldsImpl f0 = new DefaultFieldsImpl();
+      setFieldName("jndi-name", f0);
+      f0.setDescription("The jndi name to bind the DataSource under");
+      f0.setMandatory(true);
+      f0.setMetaType(SimpleMetaType.STRING);
+      ManagedPropertyImpl jndiName = new ManagedPropertyImpl(mo, f0);
+      super.addProperty(jndiName);
+      // The connection-url field info
+      DefaultFieldsImpl f1 = new DefaultFieldsImpl();
+      setFieldName("connection-url", f1);
+      f1.setDescription("The jdbc url of the DataSource");
+      f1.setMandatory(true);
+      f1.setMetaType(SimpleMetaType.STRING);
+      ManagedPropertyImpl conURL = new ManagedPropertyImpl(mo, f1);
+      super.addProperty(conURL);
+      // The user field info
+      DefaultFieldsImpl f2 = new DefaultFieldsImpl();
+      setFieldName("user-name", f2);
+      f2.setDescription("The username for the connection-url");
+      f2.setMandatory(false);
+      f2.setMetaType(SimpleMetaType.STRING);
+      ManagedPropertyImpl user = new ManagedPropertyImpl(mo, f2);
+      super.addProperty(user);
+      // The password field info
+      DefaultFieldsImpl f3 = new DefaultFieldsImpl();
+      setFieldName("password", f3);
+      f3.setDescription("The password for the connection-url");
+      f3.setMandatory(false);
+      f3.setMetaType(SimpleMetaType.STRING);
+      ManagedPropertyImpl password = new ManagedPropertyImpl(mo, f3);
+      super.addProperty(password);
+      // The security-domain field info   
+      DefaultFieldsImpl f4 = new DefaultFieldsImpl();
+      setFieldName("security-domain", f4);
+      f4.setDescription("The security-domain used to validate connections");
+      f4.setMandatory(false);
+      f4.setMetaType(SimpleMetaType.STRING);
+      ManagedPropertyImpl secDomain = new ManagedPropertyImpl(mo, f4);
+      super.addProperty(secDomain);
+      // The driver-class field info
+      DefaultFieldsImpl f5 = new DefaultFieldsImpl();
+      setFieldName("driver-class", f5);
+      f5.setDescription("The jdbc driver class name");
+      f5.setMandatory(true);
+      f5.setMetaType(SimpleMetaType.STRING);
+      ManagedPropertyImpl driverClass = new ManagedPropertyImpl(mo, f5);
+      super.addProperty(driverClass);
+      // The driver connection properties field info
+      DefaultFieldsImpl f6 = new DefaultFieldsImpl();
+      setFieldName("connection-properties", f6);
+      f6.setDescription("The jdbc driver connection properties");
+      f6.setMandatory(false);
+      String[] itemNames = {"conn-prop1", "conn-prop2"};
+      String[] itemDescriptions = {"conn-prop1 description", "conn-prop2 description"};
+      MetaType[] itemTypes = {SimpleMetaType.STRING, SimpleMetaType.STRING};
+      CompositeMetaType propsType = new ImmutableCompositeMetaType("java.lang.Properties", "DS connection properties",
+            itemNames, itemDescriptions, itemTypes);
+      f6.setMetaType(propsType);
+      ManagedPropertyImpl connProps = new ManagedPropertyImpl(mo, f6);
+      super.addProperty(connProps);
+
+      // The type of the connection factory
+      ManagedObjectImpl mo2 = new ManagedObjectImpl(dsTypeAttachmentName);
+      DefaultFieldsImpl f21 = new DefaultFieldsImpl();
+      setFieldName("datasource-type", f21);
+      f21.setDescription("The type of the ConnectionFactory");
+      f21.setMandatory(true);
+      f21.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"));
+      f21.setLegalValues(values);
+      f21.setMetaType(SimpleMetaType.STRING);
+      ManagedPropertyImpl dsType = new ManagedPropertyImpl(mo2, f21);
+      super.addProperty(dsType);
+   }
+
+   protected void setFieldName(String name, Fields f)
+   {
+      f.setField(Fields.NAME, name);
+      if( propertyNameMappings != null )
+      {
+         String mappedName = propertyNameMappings.get(name);
+         if( mappedName != null )
+            f.setField(Fields.MAPPED_NAME, mappedName);
+      }
+   }
+
+}


Property changes on: trunk/connector/src/main/org/jboss/resource/deployers/management/ConnectionFactoryTemplateInfo.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list