You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by jb...@apache.org on 2009/08/02 18:54:02 UTC
svn commit: r800104 - in
/servicemix/components/bindings/servicemix-rmi/trunk: pom.xml
src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java
src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java
src/test/resources/xbean/xbean.xml
Author: jbonofre
Date: Sun Aug 2 16:54:01 2009
New Revision: 800104
URL: http://svn.apache.org/viewvc?rev=800104&view=rev
Log:
Change the classloader policy.
Modified:
servicemix/components/bindings/servicemix-rmi/trunk/pom.xml
servicemix/components/bindings/servicemix-rmi/trunk/src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java
servicemix/components/bindings/servicemix-rmi/trunk/src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java
servicemix/components/bindings/servicemix-rmi/trunk/src/test/resources/xbean/xbean.xml
Modified: servicemix/components/bindings/servicemix-rmi/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-rmi/trunk/pom.xml?rev=800104&r1=800103&r2=800104&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-rmi/trunk/pom.xml (original)
+++ servicemix/components/bindings/servicemix-rmi/trunk/pom.xml Sun Aug 2 16:54:01 2009
@@ -30,7 +30,7 @@
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-rmi</artifactId>
- <version>2009.02-SNAPSHOT</version>
+ <version>2009.01-SNAPSHOT</version>
<packaging>jbi-component</packaging>
<name>ServiceMix :: RMI</name>
@@ -40,8 +40,7 @@
<properties>
<servicemix-version>3.3.1-SNAPSHOT</servicemix-version>
- <servicemix-shared-version>2009.02-SNAPSHOT</servicemix-shared-version>
- <servicemix-utils-version>1.2.0-SNAPSHOT</servicemix-utils-version>
+ <servicemix-shared-version>2009.01</servicemix-shared-version>
<servicemix.osgi.import>
org.apache.servicemix;resolution:=optional,
@@ -123,6 +122,7 @@
<configuration>
<type>binding-component</type>
<component>org.apache.servicemix.rmi.RmiComponent</component>
+ <classLoaderDelegation>self-first</classLoaderDelegation>
</configuration>
</plugin>
<plugin>
Modified: servicemix/components/bindings/servicemix-rmi/trunk/src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-rmi/trunk/src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java?rev=800104&r1=800103&r2=800104&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-rmi/trunk/src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java (original)
+++ servicemix/components/bindings/servicemix-rmi/trunk/src/main/java/org/apache/servicemix/rmi/RmiConsumerEndpoint.java Sun Aug 2 16:54:01 2009
@@ -23,6 +23,7 @@
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
+import java.util.ArrayList;
import java.util.List;
import javax.jbi.management.DeploymentException;
@@ -43,27 +44,26 @@
*/
public class RmiConsumerEndpoint extends ConsumerEndpoint implements RmiEndpointType, InvocationHandler {
- private List<Class> remoteInterfaces; // the remote interfaces
+ private Class remoteInterface; // the remote interface
private String name; // the endpoint name into the RMI registry
- private int port = 5555; // the Registry port number
private Object pojo; // delegate method call to a POJO
private Remote stub; // the remote stub
private Remote proxy; // the remote proxy
- public List<Class> getRemoteInterfaces() {
- return this.remoteInterfaces;
+ public Class getRemoteInterface() {
+ return this.remoteInterface;
}
/**
* <p>
- * This attribute defines the remote interfaces implemented by RMI endpoint.
+ * This attribute defines the remote interface implemented by RMI endpoint.
* </p>
*
- * @param remoteInterfaces the remote interfaces.
+ * @param remoteInterface the remote interface.
*/
- public void setRemoteInterfaces(List<Class> remoteInterfaces) {
- this.remoteInterfaces = remoteInterfaces;
+ public void setRemoteInterface(Class remoteInterface) {
+ this.remoteInterface = remoteInterface;
}
public String getName() {
@@ -81,22 +81,6 @@
this.name = name;
}
- public int getPort() {
- return this.port;
- }
-
- /**
- * <p>
- * This attribute defines the RMI registry port number.
- * </p>
- * <i> The default port number is <b>5555</b>.</i>
- *
- * @param port
- */
- public void setPort(int port) {
- this.port = port;
- }
-
public Object getPojo() {
return this.pojo;
}
@@ -131,7 +115,7 @@
super.validate();
- if (remoteInterfaces == null || remoteInterfaces.size() < 1) {
+ if (remoteInterface == null) {
throw new DeploymentException("The remoteInterfaces property is mandatory.");
}
@@ -151,9 +135,8 @@
super.start();
// create the dynamic proxy
- Class[] interfaces = new Class[remoteInterfaces.size()];
- remoteInterfaces.toArray(interfaces);
- proxy = (Remote) Proxy.newProxyInstance(this.getClass().getClassLoader(), interfaces, this);
+ Class[] interfaceArray = new Class[]{ remoteInterface };
+ proxy = (Remote) Proxy.newProxyInstance(remoteInterface.getClassLoader(), interfaceArray, this);
// create the remote stub
stub = UnicastRemoteObject.exportObject(proxy, 0);
try {
Modified: servicemix/components/bindings/servicemix-rmi/trunk/src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-rmi/trunk/src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java?rev=800104&r1=800103&r2=800104&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-rmi/trunk/src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java (original)
+++ servicemix/components/bindings/servicemix-rmi/trunk/src/test/java/org/apache/servicemix/rmi/RmiXBeanTest.java Sun Aug 2 16:54:01 2009
@@ -16,24 +16,16 @@
*/package org.apache.servicemix.rmi;
import java.io.File;
-import java.net.URI;
-import java.net.URL;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
-import javax.jbi.messaging.ExchangeStatus;
-import javax.jbi.messaging.InOnly;
-import javax.jbi.servicedesc.ServiceEndpoint;
import javax.xml.namespace.QName;
import junit.framework.TestCase;
-import org.apache.camel.converter.jaxp.StringSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.jbi.container.JBIContainer;
-import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.springframework.core.io.ClassPathResource;
/**
@@ -97,8 +89,8 @@
*/
public void testDeployment() {
// test if the SUs have been deployed
- assertNotNull("RMI endpoint {http://servicemix.apache.org/test}RmiTestServiceSimpleConsumer is not found in the JBI container.", container.getRegistry().getEndpoint(new QName("http://servicemix.apache.org/test", "RmiTestService"), "SimpleConsumer"));
- // assertNotNull("RMI endpoint {http://servicemix.apache.org/test}rmiByPassConsumer is not found in the JBI container.", container.getRegistry().getEndpoint(new QName("http://servicemix.apache.org/test", "rmi"), "ByPassConsumer"));
+ assertNotNull("RMI endpoint {http://servicemix.apache.org/test}RmiTestServiceSimpleConsumer is not found in the JBI container.", container.getRegistry().getEndpoint(new QName("http://servicemix.apache.org/test/", "RmiTestService"), "SimpleConsumer"));
+ assertNotNull("RMI endpoint {http://servicemix.apache.org/test}RmiTestServiceByPassConsumer is not found in the JBI container.", container.getRegistry().getEndpoint(new QName("http://servicemix.apache.org/test/", "RmiTestService"), "ByPassConsumer"));
}
/**
@@ -110,7 +102,7 @@
*/
public void testConsumerExchange() throws Exception {
Registry registry = LocateRegistry.getRegistry("localhost", 1099);
- Echo stub = (Echo) registry.lookup("SimpleConsumer");
+ Echo stub = (Echo) registry.lookup("ByPassConsumer");
String echo = stub.echo("test");
assertEquals("Bad response from the RMI endpoint", "test", echo);
}
Modified: servicemix/components/bindings/servicemix-rmi/trunk/src/test/resources/xbean/xbean.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-rmi/trunk/src/test/resources/xbean/xbean.xml?rev=800104&r1=800103&r2=800104&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-rmi/trunk/src/test/resources/xbean/xbean.xml (original)
+++ servicemix/components/bindings/servicemix-rmi/trunk/src/test/resources/xbean/xbean.xml Sun Aug 2 16:54:01 2009
@@ -20,20 +20,12 @@
<beans xmlns:rmi="http://servicemix.apache.org/rmi/1.0"
xmlns:test="http://servicemix.apache.org/test">
- <rmi:consumer service="test:RmiTestService" endpoint="SimpleConsumer">
- <property name="remoteInterfaces">
- <list>
- <value>org.apache.servicemix.rmi.Echo</value>
- </list>
- </property>
- </rmi:consumer>
+ <rmi:consumer service="test:RmiTestService" endpoint="SimpleConsumer" remoteInterface="org.apache.servicemix.rmi.Echo"/>
- <!--
- <rmi:consumer service="test:RmiTestService" endpoint="ByPassConsumer" remoteInterfaces="org.apache.servicemix.rmi.Echo">
+ <rmi:consumer service="test:RmiTestService" endpoint="ByPassConsumer" remoteInterface="org.apache.servicemix.rmi.Echo">
<rmi:pojo>
- <bean class="org.apache.servicenix.rmi.test.EchoImpl"/>
+ <bean class="org.apache.servicemix.rmi.EchoImpl"/>
</rmi:pojo>
</rmi:consumer>
- -->
</beans>
\ No newline at end of file