[jboss-svn-commits] JBL Code SVN: r32775 - in labs/jbossesb/branches/JBESB_4_4_GA_CP: product/rosetta and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri May 7 05:26:03 EDT 2010
Author: kevin.conner at jboss.com
Date: 2010-05-07 05:26:01 -0400 (Fri, 07 May 2010)
New Revision: 32775
Added:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java
Modified:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/build-distr.xml
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/resources/META-INF/jboss-aop.xml
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/build.xml
labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java
Log:
Performance improvements for juddi/scout: JBESB-3307
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/build-distr.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/build-distr.xml 2010-05-07 09:20:02 UTC (rev 32774)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/build-distr.xml 2010-05-07 09:26:01 UTC (rev 32775)
@@ -104,8 +104,11 @@
<copy todir="${build.dir}/jbossesb.sar/lib">
<fileset dir="${lib.ext.dir}" includes="jbossts-common.jar"/>
<fileset dir="${build.lib.dir}" includes="jbossesb*.jar"/>
+ <!-- We use AOP on scout to get around an issue, use the modified jar for now
+ <fileset dir="${lib.dir}" includes="scout-*.jar"/>
+ -->
<!-- scout -->
- <fileset dir="${lib.dir}" includes="scout-*.jar"/>
+ <fileset dir="${aoplib.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"/>
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java 2010-05-07 09:20:02 UTC (rev 32774)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/JUDDIAspect.java 2010-05-07 09:26:01 UTC (rev 32775)
@@ -21,8 +21,13 @@
*/
package org.jboss.internal.soa.esb.services.registry.aspect;
+import java.sql.Connection;
import java.util.Vector;
+import org.apache.juddi.datastore.jdbc.JBossESBDataStore;
+import org.apache.juddi.datastore.jdbc.JDBCDataStore;
+import org.apache.juddi.datatype.binding.BindingTemplate;
+import org.apache.juddi.datatype.binding.TModelInstanceDetails;
import org.apache.juddi.util.Config;
import org.jboss.aop.joinpoint.MethodCalledByMethodInvocation;
import org.jboss.aop.joinpoint.MethodInvocation;
@@ -67,6 +72,32 @@
return new Vector<Object>() ;
}
+ public Object fetchBindingByServiceKey(final MethodCalledByMethodInvocation invocation)
+ throws Throwable
+ {
+ final JDBCDataStore jdbcDataStore = (JDBCDataStore)invocation.getTargetObject() ;
+ final Object[] args = invocation.getArguments() ;
+ final String serviceKey = (String)args[0] ;
+ final Connection connection = jdbcDataStore.getConnection() ;
+ if (connection != null)
+ {
+ final Vector<BindingTemplate> result = JBossESBDataStore.selectByServiceKey(serviceKey,connection);
+ if (result.size() > 0)
+ {
+ final TModelInstanceDetails dummyDetails = new TModelInstanceDetails() ;
+ for (BindingTemplate bindingTemplate: result)
+ {
+ bindingTemplate.setTModelInstanceDetails(dummyDetails) ;
+ }
+ }
+ return result ;
+ }
+ else
+ {
+ return new Vector(0) ;
+ }
+ }
+
public Object getStringProperty(final MethodCalledByMethodInvocation invocation)
throws Throwable
{
Copied: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java (from rev 28831, labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java)
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/java/org/jboss/internal/soa/esb/services/registry/aspect/ScoutAspect.java 2010-05-07 09:26:01 UTC (rev 32775)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.internal.soa.esb.services.registry.aspect;
+
+import javax.xml.registry.LifeCycleManager;
+import javax.xml.registry.infomodel.Service;
+
+import org.apache.ws.scout.registry.BusinessQueryManagerImpl;
+import org.apache.ws.scout.registry.infomodel.ServiceImpl;
+import org.jboss.aop.joinpoint.MethodCalledByMethodInvocation;
+
+/**
+ * Aspect used to prevent scout from loading the complete service
+ * graph for the registry just to return a binding.
+ *
+ * Updated to intercept calls for the organizational information when
+ * querying a specific service.
+ *
+ * @author <a href='mailto:Kevin.Conner at jboss.com'>Kevin Conner</a>
+ */
+public class ScoutAspect
+{
+ public Object getRegistryObject(final MethodCalledByMethodInvocation invocation)
+ throws Throwable
+ {
+ final BusinessQueryManagerImpl bqmImpl = (BusinessQueryManagerImpl)invocation.getCallingObject() ;
+ final Object[] args = invocation.getArguments() ;
+ final String id = (String)args[0] ;
+ final String objectType = (String)args[1] ;
+
+ if (LifeCycleManager.SERVICE.equals(objectType))
+ {
+ final LifeCycleManager lcm = bqmImpl.getRegistryService().getBusinessLifeCycleManager() ;
+ final Service service = new ServiceImpl(lcm);
+ service.setKey(lcm.createKey(id));
+ return service ;
+ }
+ else
+ {
+ return invocation.invokeNext() ;
+ }
+ }
+}
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/resources/META-INF/jboss-aop.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/resources/META-INF/jboss-aop.xml 2010-05-07 09:20:02 UTC (rev 32774)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/aop/resources/META-INF/jboss-aop.xml 2010-05-07 09:26:01 UTC (rev 32775)
@@ -4,8 +4,13 @@
"http://labs.jboss.com/portal/jbossaop/dtd/jboss-aop_1_0.dtd">
<aop>
+ <aspect class="org.jboss.internal.soa.esb.services.registry.aspect.ScoutAspect" scope="PER_VM"/>
<aspect class="org.jboss.internal.soa.esb.services.registry.aspect.JUDDIAspect" scope="PER_VM"/>
+ <bind pointcut="withincode(* org.apache.ws.scout.registry.BusinessQueryManagerImpl->findServiceBindings(..)) AND call(* org.apache.ws.scout.registry.BusinessQueryManagerImpl->getRegistryObject(..))">
+ <advice name="getRegistryObject" aspect="org.jboss.internal.soa.esb.services.registry.aspect.ScoutAspect"/>
+ </bind>
+
<bind pointcut="execution(* org.apache.juddi.util.xml.XMLUtils->getText(..))">
<advice name="getText" aspect="org.jboss.internal.soa.esb.services.registry.aspect.JUDDIAspect"/>
</bind>
@@ -14,6 +19,10 @@
<advice name="fetchServiceByBusinessKey" aspect="org.jboss.internal.soa.esb.services.registry.aspect.JUDDIAspect"/>
</bind>
+ <bind pointcut="withincode(* org.apache.juddi.datastore.jdbc.JDBCDataStore->fetchService(..)) AND call(* org.apache.juddi.datastore.jdbc.JDBCDataStore->fetchBindingByServiceKey(..))">
+ <advice name="fetchBindingByServiceKey" aspect="org.jboss.internal.soa.esb.services.registry.aspect.JUDDIAspect"/>
+ </bind>
+
<bind pointcut="withincode(* org.apache.juddi.registry.rmi.JNDIRegistration->register()) AND call(* org.apache.juddi.util.Config->getStringProperty(..))">
<advice name="getStringProperty" aspect="org.jboss.internal.soa.esb.services.registry.aspect.JUDDIAspect"/>
</bind>
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/build.xml 2010-05-07 09:20:02 UTC (rev 32774)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/build.xml 2010-05-07 09:26:01 UTC (rev 32775)
@@ -5,6 +5,7 @@
<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="../"/>
@@ -175,12 +176,21 @@
<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.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">
+ <classpath path="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+ <src path="${org.jboss.esb.rosetta.aopc.scout.classes.dir}"/>
+ <aoppath path="aop/resources/META-INF/jboss-aop.xml"/>
+ <aopclasspath path="${org.jboss.esb.rosetta.aop.classes.dir}"/>
+ </aopc>
+ <aopc compilerclasspathref="aop-classpath">
<classpath>
<pathelement path="${org.jboss.esb.rosetta.aopc.juddi.classes.dir}"/>
<fileset dir="${org.jboss.esb.ext.lib.dir}" includes="commons-logging*.jar"/>
@@ -192,6 +202,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.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/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java 2010-05-07 09:20:02 UTC (rev 32774)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServer.java 2010-05-07 09:26:01 UTC (rev 32775)
@@ -32,12 +32,18 @@
import javax.xml.registry.JAXRResponse;
import javax.xml.registry.LifeCycleManager;
import javax.xml.registry.RegistryService;
-import javax.xml.registry.infomodel.InternationalString;
import javax.xml.registry.infomodel.Organization;
import javax.xml.registry.infomodel.Service;
import javax.xml.registry.infomodel.ServiceBinding;
+import org.apache.ws.scout.registry.IRegistry;
import org.apache.ws.scout.registry.infomodel.ServiceImpl;
+import org.apache.ws.scout.uddi.BindingTemplate;
+import org.apache.ws.scout.uddi.BindingTemplates;
+import org.apache.ws.scout.uddi.BusinessService;
+import org.apache.ws.scout.uddi.ServiceDetail;
+import org.apache.ws.scout.uddi.TModelInstanceDetails;
+import org.apache.ws.scout.uddi.TModelInstanceInfo;
import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
import org.jboss.internal.soa.esb.services.registry.JAXRConnectionFactory;
import org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl;
@@ -137,6 +143,12 @@
return null ;
}
+ public String verifyJuddiPerformanceIssue()
+ throws JAXRException, ConfigurationException, org.apache.ws.scout.registry.RegistryException
+ {
+ return new TestScoutRegistryImpl().checkServiceNestedBindings() ;
+ }
+
private String verifyHeuristic(final String value)
{
final char[] contents = value.toCharArray() ;
@@ -195,56 +207,19 @@
return "could not find service bindings for DeadLetterService" ;
}
- final Class<ServiceImpl> serviceImplClass = ServiceImpl.class ;
- final Field field ;
- try
+ for(ServiceBinding serviceBinding: serviceBindings)
{
- field = serviceImplClass.getDeclaredField("org") ;
- }
- catch (final NoSuchFieldException nsfe)
- {
- return "Could not locate org field" ;
- }
- field.setAccessible(true) ;
- try
- {
- for(ServiceBinding serviceBinding: serviceBindings)
+ final Service bindingService = serviceBinding.getService() ;
+ if (bindingService == null)
{
- final Service bindingService = serviceBinding.getService() ;
- if (bindingService == null)
- {
- return "Could not find service associated with binding" ;
- }
- if (bindingService.getSubmittingOrganization() != null)
- {
- return "FAILED: Submitting organization is present in service binding" ;
- }
- if (!(bindingService instanceof ServiceImpl))
- {
- return "Binding service is not a ServiceImpl, need to change the test" ;
- }
- final ServiceImpl serviceImpl = (ServiceImpl)bindingService ;
- if (serviceImpl.getSubmittingOrganizationKey() == null)
- {
- return "FAILED: Submitting organization key is not present in service binding" ;
- }
- try
- {
- if (field.get(serviceImpl) != null)
- {
- return "FAILED: Organization is present in service binding" ;
- }
- }
- catch (final IllegalAccessException iae)
- {
- return "FAILED: Could not access org field in current service" ;
- }
+ return "Could not find service associated with binding" ;
}
+ final Collection<ServiceBinding> nestedServiceBindings = (Collection<ServiceBinding>)bindingService.getServiceBindings();
+ if ((nestedServiceBindings != null) && (nestedServiceBindings.size() > 0))
+ {
+ return "Nested service contains service bindings for DeadLetterService" ;
+ }
}
- finally
- {
- field.setAccessible(false) ;
- }
return null ;
}
@@ -330,6 +305,93 @@
scoutConnectionFactory.closeConnection(connection) ;
}
}
+
+ public String checkServiceNestedBindings()
+ throws JAXRException, ConfigurationException, org.apache.ws.scout.registry.RegistryException
+ {
+ final String serviceKey ;
+ {
+ final Service service = findService("JBossESB-Internal", "DeadLetterService") ;
+
+ if (service == null)
+ {
+ return "Service not found" ;
+ }
+ serviceKey = service.getKey().getId() ;
+ }
+
+ final IRegistry registry ;
+ final ScoutConnectionFactory scoutConnectionFactory = new ScoutConnectionFactory() ;
+ final Connection connection = scoutConnectionFactory.getConnection();
+ try
+ {
+ final Field field ;
+ try
+ {
+ field = connection.getClass().getDeclaredField("registry") ;
+ }
+ catch (final NoSuchFieldException nsfe)
+ {
+ return "Could not locate org field" ;
+ }
+ field.setAccessible(true) ;
+ try
+ {
+ final Object registryImpl ;
+ try
+ {
+ registryImpl = field.get(connection) ;
+ }
+ catch (final IllegalAccessException iae)
+ {
+ return "FAILED: Could not access org field in current service" ;
+ }
+ if (registryImpl == null)
+ {
+ return "FAILED: Registry implementation is null" ;
+ }
+ if (!(registryImpl instanceof IRegistry))
+ {
+ return "FAILED: Registry implementation is not of correct type";
+ }
+ registry = (IRegistry)registryImpl ;
+ }
+ finally
+ {
+ field.setAccessible(false) ;
+ }
+
+ final ServiceDetail serviceDetail = registry.getServiceDetail(serviceKey) ;
+ final BusinessService[] businessServiceArray = serviceDetail.getBusinessServiceArray() ;
+ if (businessServiceArray == null)
+ {
+ return "FAILED: no business services returned from registry" ;
+ }
+ for (BusinessService businessService: businessServiceArray)
+ {
+ final BindingTemplates bindingTemplates = businessService.getBindingTemplates() ;
+ final BindingTemplate[] bindingTemplateArray = bindingTemplates.getBindingTemplateArray() ;
+ for (BindingTemplate bindingTemplate: bindingTemplateArray)
+ {
+ final TModelInstanceDetails tModelInstanceDetails = bindingTemplate.getTModelInstanceDetails() ;
+ if (tModelInstanceDetails == null)
+ {
+ return "FAILED: Missing tModelInstanceDetails returned from registry" ;
+ }
+ final TModelInstanceInfo[] tModelInstanceInfoArray = tModelInstanceDetails.getTModelInstanceInfoArray() ;
+ if ((tModelInstanceInfoArray != null) && (tModelInstanceInfoArray.length > 0))
+ {
+ return "FAILED: tModelInstanceInfo set, must have come from the database. Should be hidden by AOP" ;
+ }
+ }
+ }
+ }
+ finally
+ {
+ scoutConnectionFactory.closeConnection(connection) ;
+ }
+ return null ;
+ }
}
private static class ScoutConnectionFactory extends JAXRConnectionFactory
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java 2010-05-07 09:20:02 UTC (rev 32774)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPServerMBean.java 2010-05-07 09:26:01 UTC (rev 32775)
@@ -49,4 +49,7 @@
public String verifyOrganizationalStructure()
throws RegistryException, JAXRException, ConfigurationException ;
+
+ public String verifyJuddiPerformanceIssue()
+ throws JAXRException, ConfigurationException, org.apache.ws.scout.registry.RegistryException ;
}
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java 2010-05-07 09:20:02 UTC (rev 32774)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/qa/junit/src/org/jboss/soa/esb/server/aop/AOPUnitTest.java 2010-05-07 09:26:01 UTC (rev 32775)
@@ -75,6 +75,20 @@
}
/**
+ * Test for juddi performance issue, retrieving details bindings while acquiring service.
+ * @throws Exception For any failures.
+ */
+ public void testJuddiPerformanceIssue()
+ throws Exception
+ {
+ final String result = (String)execute("verifyJuddiPerformanceIssue", null, null) ;
+ if (result != null)
+ {
+ fail(result) ;
+ }
+ }
+
+ /**
* Test for juddi CDATA issue..
* @throws Exception For any failures.
*/
More information about the jboss-svn-commits
mailing list