[jboss-svn-commits] JBL Code SVN: r26243 - in labs/jbossesb/workspace/systinet/product: lib/ext and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Apr 24 11:11:39 EDT 2009


Author: tcunning
Date: 2009-04-24 11:11:39 -0400 (Fri, 24 Apr 2009)
New Revision: 26243

Added:
   labs/jbossesb/workspace/systinet/product/lib/ext/scout-SNAPSHOT.jar
Modified:
   labs/jbossesb/workspace/systinet/product/build-distr.xml
   labs/jbossesb/workspace/systinet/product/rosetta/build.xml
   labs/jbossesb/workspace/systinet/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
Log:
Changes for systinet registry support.


Modified: labs/jbossesb/workspace/systinet/product/build-distr.xml
===================================================================
--- labs/jbossesb/workspace/systinet/product/build-distr.xml	2009-04-24 14:31:36 UTC (rev 26242)
+++ labs/jbossesb/workspace/systinet/product/build-distr.xml	2009-04-24 15:11:39 UTC (rev 26243)
@@ -106,7 +106,7 @@
             <fileset dir="${lib.dir}" includes="scout-*.jar"/>
             -->
             <!-- scout -->
-            <fileset dir="${aoplib.dir}" includes="scout-*.jar"/>
+            <fileset dir="${lib.ext.dir}" includes="scout-*.jar"/>
             <!-- xbean for reading/marchalling xml for configuration, and scout -->
             <fileset dir="${lib.dir}" includes="xbean*.jar"/>
             <fileset dir="${lib.dir}" includes="stax-api-*.jar"/>
@@ -114,7 +114,7 @@
             <!-- We use AOP on juddi to get around an issue, use the modified jar for now
             <fileset dir="${lib.dir}" includes="juddi-*.jar"/>
             -->
-            <fileset dir="${aoplib.dir}" includes="juddi-*.jar"/>
+            <fileset dir="${lib.dir}" includes="juddi-*.jar"/>
             <fileset dir="${lib.dir}" includes="juddi-client*.jar"/>
             <!-- ftp -->
             <fileset dir="${lib.ext.dir}" includes="commons-net-*.jar"/>

Added: labs/jbossesb/workspace/systinet/product/lib/ext/scout-SNAPSHOT.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/workspace/systinet/product/lib/ext/scout-SNAPSHOT.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/jbossesb/workspace/systinet/product/rosetta/build.xml
===================================================================
--- labs/jbossesb/workspace/systinet/product/rosetta/build.xml	2009-04-24 14:31:36 UTC (rev 26242)
+++ labs/jbossesb/workspace/systinet/product/rosetta/build.xml	2009-04-24 15:11:39 UTC (rev 26243)
@@ -5,8 +5,6 @@
 	<property name="org.jboss.esb.rosetta.distrib.dir" location="${org.jboss.esb.internal.dest}/jbossesb"/>
 	<property name="org.jboss.esb.rosetta.classes.dir" location="${org.jboss.esb.internal.dest}/classes/rosetta"/>
     <property name="org.jboss.esb.rosetta.aop.classes.dir" location="${org.jboss.esb.rosetta.classes.dir}-aop"/>
-    <property name="org.jboss.esb.rosetta.aopc.scout.classes.dir" location="${org.jboss.esb.rosetta.classes.dir}-scout-aopc"/>
-    <property name="org.jboss.esb.rosetta.aopc.juddi.classes.dir" location="${org.jboss.esb.rosetta.classes.dir}-juddi-aopc"/>
     <property name="org.jboss.esb.rosetta.src.dir" location="src"/>
 	<property name="org.jboss.esb.root.dir" location="../"/>
 	<property name="gendir" location="${org.jboss.esb.internal.dest}/schema-model" />
@@ -175,31 +173,6 @@
 
     <target name="aop" depends="aop-jar">
         <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="aop-classpath"/>
-
-        <delete dir="${org.jboss.esb.rosetta.aopc.scout.classes.dir}" quiet="true"/>
-        <delete dir="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}" quiet="true"/>
-        <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}/juddi-2.0rc5.jar" dest="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
-
-        <aopc compilerclasspathref="aop-classpath">
-            <classpath path="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
-            <src path="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
-            <include name="org/apache/ws/scout/registry/BusinessQueryManagerImpl.class"/>
-            <aoppath path="aop/resources/META-INF/jboss-aop.xml"/>
-            <aopclasspath path="${org.jboss.esb.rosetta.aop.classes.dir}"/>
-        </aopc>
-        <aopc compilerclasspathref="aop-classpath">
-            <classpath path="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
-            <src path="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
-            <include name="org/apache/juddi/util/xml/XMLUtils.class"/>
-            <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}/juddi-2.0rc5.aop.jar" basedir="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
     </target>
 
     <target name="aop-jar" depends="aop-compile">

Modified: labs/jbossesb/workspace/systinet/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
===================================================================
--- labs/jbossesb/workspace/systinet/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java	2009-04-24 14:31:36 UTC (rev 26242)
+++ labs/jbossesb/workspace/systinet/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java	2009-04-24 15:11:39 UTC (rev 26243)
@@ -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,23 @@
 		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();
+					binding.getSpecificationLinks().add(jbossTModel);
+				}
 			}
 			return serviceBindings;
 		} catch (Exception je) {




More information about the jboss-svn-commits mailing list