[jboss-svn-commits] JBL Code SVN: r26987 - in labs/jbossesb/trunk/product: rosetta and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jun 16 23:29:44 EDT 2009


Author: tcunning
Date: 2009-06-16 23:29:44 -0400 (Tue, 16 Jun 2009)
New Revision: 26987

Modified:
   labs/jbossesb/trunk/product/ivy.xml
   labs/jbossesb/trunk/product/rosetta/build.xml
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
Log:
JBESB-2438
Upgrade to scout-1.0.


Modified: labs/jbossesb/trunk/product/ivy.xml
===================================================================
--- labs/jbossesb/trunk/product/ivy.xml	2009-06-17 01:43:57 UTC (rev 26986)
+++ labs/jbossesb/trunk/product/ivy.xml	2009-06-17 03:29:44 UTC (rev 26987)
@@ -29,11 +29,11 @@
         <!-- Only declaring a direct dependency on jaxr-api because there's an issue with
              the scout-1.0rc2 pom in the repo.  It declares a dep on an unavailable (easily)
              SNAPSHOT version. -->
-        <dependency org="org.apache.ws.scout" name="jaxr-api" rev="1.0rc2">
+        <dependency org="org.apache.ws.scout" name="jaxr-api" rev="1.0">
             <exclude org="axis" module="axis"/>
             <exclude org="geronimo-spec" module="geronimo-spec-activation"/>            
         </dependency>
-        <dependency org="org.apache.ws.scout" name="scout" rev="1.0rc2">
+        <dependency org="org.apache.ws.scout" name="scout" rev="1.0">
             <exclude org="axis" module="axis"/>
             <exclude org="geronimo-spec" module="geronimo-spec-activation"/>
         </dependency>

Modified: labs/jbossesb/trunk/product/rosetta/build.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/build.xml	2009-06-17 01:43:57 UTC (rev 26986)
+++ labs/jbossesb/trunk/product/rosetta/build.xml	2009-06-17 03:29:44 UTC (rev 26987)
@@ -222,7 +222,7 @@
         <mkdir dir="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
         <mkdir dir="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
 
-        <unzip src="${org.jboss.esb.lib.dir}/scout-1.0rc2.jar" dest="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+        <unzip src="${org.jboss.esb.lib.dir}/scout-1.0.jar" dest="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
         <unzip src="${org.jboss.esb.lib.dir}/juddi-2.0rc5.jar" dest="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
 
         <aopc compilerclasspathref="aop-classpath">
@@ -239,7 +239,7 @@
             <aoppath path="aop/resources/META-INF/jboss-aop.xml"/>
             <aopclasspath path="${org.jboss.esb.rosetta.aop.classes.dir}"/>
         </aopc>
-        <zip destfile="${org.jboss.esb.aoplib.dir}/scout-1.0rc2.aop.jar" basedir="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+        <zip destfile="${org.jboss.esb.aoplib.dir}/scout-1.0.aop.jar" basedir="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
         <zip destfile="${org.jboss.esb.aoplib.dir}/juddi-2.0rc5.aop.jar" basedir="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
     </target>
 

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java	2009-06-17 01:43:57 UTC (rev 26986)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java	2009-06-17 03:29:44 UTC (rev 26987)
@@ -38,6 +38,7 @@
 import javax.xml.registry.RegistryService;
 import javax.xml.registry.infomodel.Classification;
 import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
 import javax.xml.registry.infomodel.EmailAddress;
 import javax.xml.registry.infomodel.Key;
 import javax.xml.registry.infomodel.Organization;
@@ -46,11 +47,14 @@
 import javax.xml.registry.infomodel.RegistryObject;
 import javax.xml.registry.infomodel.Service;
 import javax.xml.registry.infomodel.ServiceBinding;
+import javax.xml.registry.infomodel.SpecificationLink;
 import javax.xml.registry.infomodel.TelephoneNumber;
 import javax.xml.registry.infomodel.User;
 
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
+import org.apache.ws.scout.registry.infomodel.KeyImpl;
+import org.apache.ws.scout.registry.infomodel.SpecificationLinkImpl;
 import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.MarshalException;
@@ -71,6 +75,7 @@
 	private static Logger logger = Logger.getLogger(JAXRRegistryImpl.class);
     private JAXRConnectionFactory jaxrConnectionFactory;
 	private static Organization jbossESBOrganization;
+	private static Concept jbossTModel;
 	public static final String JBOSS_ESB_CATEGORY = "org.jboss.soa.esb.:category";
 	
     public JAXRRegistryImpl() throws ConfigurationException {
@@ -134,8 +139,16 @@
 	 */
 	public void registerEPR(String category, String serviceName, String serviceDescription, EPR epr, String eprDescription) 
 		throws RegistryException
-	{
-        Connection connection = jaxrConnectionFactory.getConnection();
+	{		
+		if (jbossTModel == null) {
+			try	{
+				jbossTModel = getJBossESBTModel(jaxrConnectionFactory);
+			} catch (JAXRException je) {
+				throw new RegistryException();
+			}
+		}
+		
+		Connection connection = jaxrConnectionFactory.getConnection();
         try {
             //Find the service
             Service service = findService(category,serviceName);
@@ -148,12 +161,16 @@
             BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
             BusinessQueryManager bqm = rs.getBusinessQueryManager();
             ServiceBinding serviceBinding = blm.createServiceBinding();
-            serviceBinding.setDescription(blm.createInternationalString(eprDescription));
             String xml = EPRHelper.toXMLString(epr);
             serviceBinding.setAccessURI(xml);
-
+            
             ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
+            SpecificationLink sl = new SpecificationLinkImpl(blm);
+            sl.setSpecificationObject(jbossTModel);
+            serviceBinding.getSpecificationLinks().add(sl);
+            serviceBinding.setDescription(blm.createInternationalString(eprDescription));
             serviceBindings.add(serviceBinding);
+            
             service.addServiceBindings(serviceBindings);
             Collection<String> findQualifiers = new ArrayList<String>();
             findQualifiers.add(FindQualifier.AND_ALL_KEYS);
@@ -161,7 +178,7 @@
             ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, JBOSS_ESB_CATEGORY);
             Classification classification = blm.createClassification(cScheme, "category", category);
             service.addClassification(classification);
-
+            
             saveRegistryObject(serviceBinding, jaxrConnectionFactory);
         } catch (JAXRException je) {
             throw new RegistryException(je.getLocalizedMessage(), je);
@@ -270,6 +287,10 @@
 
         Connection connection = jaxrConnectionFactory.getConnection();
 		try {
+			RegistryService rs = connection.getRegistryService();
+            BusinessQueryManager bqm = rs.getBusinessQueryManager();
+			BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
+
 			Service service = findService(category, serviceName);
 			if (service==null){
                 throw new ServiceNotFoundException("Could not find service with category=" + category + " and serviceName=" + serviceName);
@@ -279,6 +300,17 @@
 			//Converting them to EPRs
 			for (Iterator i=serviceBindings.iterator();i.hasNext();) {
 				ServiceBinding serviceBinding = (ServiceBinding) i.next();
+				
+	            Collection<String> findQualifiers = new ArrayList<String>();
+	            findQualifiers.add(FindQualifier.AND_ALL_KEYS);
+	            findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
+	            ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, JBOSS_ESB_CATEGORY);
+	            Classification classification = blm.createClassification(cScheme, "category", category);
+				
+	            SpecificationLink sl = new SpecificationLinkImpl(blm);
+	            sl.setSpecificationObject(jbossTModel);
+	            serviceBinding.getSpecificationLinks().add(sl);
+
 				@SuppressWarnings("unused")
 				String eprXML = serviceBinding.getAccessURI();
                 EPR epr = null;
@@ -316,6 +348,10 @@
         EPR epr = null ;
         Connection connection = jaxrConnectionFactory.getConnection();
         try {
+			RegistryService rs = connection.getRegistryService();
+            BusinessQueryManager bqm = rs.getBusinessQueryManager();
+			BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
+
             Service service = findService(category, serviceName);
             if (service==null){
                 throw new ServiceNotFoundException("Could not find service with category=" + category + " and serviceName=" + serviceName);
@@ -324,6 +360,10 @@
             Collection<ServiceBinding> serviceBindings = findServiceBindings(service);
             if (serviceBindings.iterator().hasNext()) {
                 ServiceBinding serviceBinding = (ServiceBinding) serviceBindings.iterator().next();
+                SpecificationLink sl = new SpecificationLinkImpl(blm);
+	            sl.setSpecificationObject(jbossTModel);
+	            serviceBinding.getSpecificationLinks().add(sl);
+
                 String eprXML = serviceBinding.getAccessURI();
                 // for backwards compatibility still have the decoder if
                 // unmarchalling fails
@@ -572,6 +612,41 @@
 	}
 
     /**
+	 * Create a jbossesb organization under which we will register all our services.
+	 *
+	 * @return
+	 * @throws JAXRException
+	 */
+    protected static Concept getJBossESBTModel(JAXRConnectionFactory jaxrConnectionFactory) throws JAXRException
+	{
+		Connection connection = jaxrConnectionFactory.getConnection();
+		Concept tmodel = null;
+		try {
+			RegistryService rs = connection.getRegistryService();
+			BusinessQueryManager bqm = rs.getBusinessQueryManager();
+            BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
+            
+            Collection<String> findQualifiers = new ArrayList<String>();
+            findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
+            Collection<String> namePatterns = new ArrayList<String>();
+            namePatterns.add("%" + JBOSS_ESB_CATEGORY + "%");
+
+            BulkResponse response = bqm.findConcepts(findQualifiers, namePatterns, null, null, null);
+			if (response.getStatus()==JAXRResponse.STATUS_SUCCESS) {
+				Collection<RegistryObject> regs = (Collection<RegistryObject>) response.getCollection();
+				for (Iterator orgIter = response.getCollection().iterator(); orgIter.hasNext();)
+				{
+					tmodel = (Concept) orgIter.next();
+				}
+			}
+		} finally {
+			jaxrConnectionFactory.closeConnection(connection);
+		}
+		return tmodel;
+	}
+
+    
+    /**
 	 * Save Registry Object
 	 */
 	private static void saveRegistryObject(RegistryObject registryObject, JAXRConnectionFactory jaxrConnectionFactory) throws JAXRException
@@ -654,9 +729,11 @@
 	private Organization getJBossESBOrganization() throws JAXRException
 	{
 		jbossESBOrganization = findOrganization("Red Hat/JBossESB", jaxrConnectionFactory);
+
 		if (jbossESBOrganization==null) {
 			jbossESBOrganization = createJBossESBOrganization(jaxrConnectionFactory);
 		}
+		
 		return jbossESBOrganization;
 	}
 
@@ -674,12 +751,28 @@
 		try {
 			RegistryService rs = connection.getRegistryService();
 			BusinessQueryManager bqm = rs.getBusinessQueryManager();
+			BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
 			Collection<String> findQualifiers = null;
 			//Collection<String> findQualifiers = new ArrayList<String>();
 			//findQualifiers.add(FindQualifier.SORT_BY_DATE_ASC);
-			BulkResponse bulkResponse = bqm.findServiceBindings(service.getKey(),findQualifiers,null,null);
+			ArrayList<SpecificationLink> specs = new ArrayList<SpecificationLink>();
+            SpecificationLink sl = new SpecificationLinkImpl(blm);
+            sl.setSpecificationObject(jbossTModel);
+
+			specs.add(sl);
+			BulkResponse bulkResponse = bqm.findServiceBindings(service.getKey(),findQualifiers,null,specs);
 			if (bulkResponse.getStatus()==JAXRResponse.STATUS_SUCCESS){
 				serviceBindings = (Collection<ServiceBinding>)bulkResponse.getCollection();
+				for (Iterator bindIter = serviceBindings.iterator(); bindIter.hasNext();)
+				{
+					ServiceBinding binding = (ServiceBinding) bindIter.next();
+					Collection<SpecificationLink> bindingSpecs = binding.getSpecificationLinks();					
+		            SpecificationLink slink = new SpecificationLinkImpl(blm);
+		            slink.setSpecificationObject(jbossTModel);
+
+					bindingSpecs.add(slink);
+
+				}
 			}
 			return serviceBindings;
 		} catch (Exception je) {




More information about the jboss-svn-commits mailing list