[jboss-cvs] JBossAS SVN: r61508 - trunk/connector/src/main/org/jboss/resource/metadata/repository.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 21 00:29:06 EDT 2007


Author: weston.price at jboss.com
Date: 2007-03-21 00:29:06 -0400 (Wed, 21 Mar 2007)
New Revision: 61508

Added:
   trunk/connector/src/main/org/jboss/resource/metadata/repository/JCADeployment.java
   trunk/connector/src/main/org/jboss/resource/metadata/repository/JCAMetaDataRepository.java
Log:
[JBAS-1437][JBAS-1425] First draft of JCAMetaDataRepository for programmatic
deployment.

Added: trunk/connector/src/main/org/jboss/resource/metadata/repository/JCADeployment.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/metadata/repository/JCADeployment.java	                        (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/metadata/repository/JCADeployment.java	2007-03-21 04:29:06 UTC (rev 61508)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.metadata.repository;
+
+/**
+ * A JCADeployment.
+ * 
+ * @author <a href="weston.price at jboss.org">Weston Price</a>
+ * @version $Revision: 1.1 $
+ */
+public enum JCADeployment 
+{
+   MCF, ACTIVATION_SPEC, ADMIN_OBJECT;
+}

Added: trunk/connector/src/main/org/jboss/resource/metadata/repository/JCAMetaDataRepository.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/metadata/repository/JCAMetaDataRepository.java	                        (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/metadata/repository/JCAMetaDataRepository.java	2007-03-21 04:29:06 UTC (rev 61508)
@@ -0,0 +1,136 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.metadata.repository;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.resource.spi.ActivationSpec;
+
+import org.jboss.resource.deployment.AdminObject;
+import org.jboss.resource.metadata.ConnectorMetaData;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentMetaData;
+
+
+/**
+ * A JCAMetaDataRepository.
+ * 
+ * @author <a href="weston.price at jboss.org">Weston Price</a>
+ * @version $Revision: 1.1 $
+ */
+public class JCAMetaDataRepository
+{
+   
+   private static JCAMetaDataRepository instance = new JCAMetaDataRepository();
+   
+   private Map<JCAConnectorMetaDataKey, JCAConnectorMetaDataEntry> connectors = new ConcurrentHashMap<JCAConnectorMetaDataKey, JCAConnectorMetaDataEntry>();
+   private Map<JCADeploymentMetaDataEntry, Object> pendingDeployments = new ConcurrentHashMap<JCADeploymentMetaDataEntry, Object>();
+   
+   private JCAMetaDataRepository()
+   {      
+   }
+   
+   public static JCAMetaDataRepository getInstance()
+   {
+      return instance;
+      
+   }
+   
+   public void addConnectorMetaData(String name, ConnectorMetaData cmd)
+   {
+      JCAConnectorMetaDataKey key = new JCAConnectorMetaDataKey(name);
+      key.setName(name);
+
+      JCAConnectorMetaDataEntry entry = connectors.get(key);
+      
+      if(entry.getConnectorMetaData() == null)
+      {
+         entry.setConnectorMetaData(cmd);         
+      }
+      else
+      {
+         //Something is really wrong -- duplicate deployment
+      }
+      
+   }
+
+   public ConnectorMetaData getConnectorMetaData(String name)
+   {
+      JCAConnectorMetaDataKey entry = new JCAConnectorMetaDataKey(name);
+      entry.setName(name);
+      ConnectorMetaData md = getConnectorMetaData(entry);      
+      return md;
+   }
+
+   private ConnectorMetaData getConnectorMetaData(JCAConnectorMetaDataKey key)
+   {
+      JCAConnectorMetaDataEntry entry = connectors.get(key);
+      return entry.getConnectorMetaData();      
+   }
+   
+   public void addActivationSpec(String rarName, ActivationSpec spec)
+   {
+      
+      JCAConnectorMetaDataKey key = new JCAConnectorMetaDataKey(rarName);
+      addDeployment(key,spec);
+            
+   }
+   
+   public void addAdminObject(String rarName, AdminObject adminObject)
+   {
+      JCAConnectorMetaDataKey key = new JCAConnectorMetaDataKey(rarName);
+      addDeployment(key, adminObject);
+      
+   }
+   
+   public void addManagedConnectionFactoryDeploymentGroup(ManagedConnectionFactoryDeploymentGroup group)
+   {
+      List<ManagedConnectionFactoryDeploymentMetaData> mcf = group.getDeployments();
+      
+      for (ManagedConnectionFactoryDeploymentMetaData deployment : mcf)
+      {
+         JCAConnectorMetaDataKey key = new JCAConnectorMetaDataKey(deployment.getRarName());
+         addDeployment(key, deployment);
+      }
+      
+   }
+   
+   private void addDeployment(JCAConnectorMetaDataKey key, Object deployment)
+   {
+      
+      JCAConnectorMetaDataEntry entry = connectors.get(key);
+      
+      if(entry == null)
+      {
+         entry = new JCAConnectorMetaDataEntry();
+         entry.addDeployment(deployment);
+         connectors.put(key, entry);         
+      }
+      
+      else
+      {
+         entry.addDeployment(deployment);         
+      }
+   }
+}




More information about the jboss-cvs-commits mailing list