You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2002/09/09 06:30:48 UTC
cvs commit: jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/playground/activation TestServant.java TestServant.xinfo ActivationClient.java
mcconnell 2002/09/08 21:30:48
Modified: assembly/src/java/org/apache/excalibur/playground/activation
ActivationClient.java
Added: assembly/src/java/org/apache/excalibur/playground/activation
TestServant.java TestServant.xinfo
Log:
Server side test case for remote service activation.
Revision Changes Path
1.2 +26 -25 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/playground/activation/ActivationClient.java
Index: ActivationClient.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/playground/activation/ActivationClient.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ActivationClient.java 7 Sep 2002 07:27:12 -0000 1.1
+++ ActivationClient.java 9 Sep 2002 04:30:48 -0000 1.2
@@ -13,11 +13,10 @@
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.activity.Disposable;
import org.omg.CORBA.ORB;
import org.apache.orb.corbaloc.Handler;
-import org.apache.orb.corbaloc.ServiceResolver;
-import org.apache.orb.corbaloc.ServiceResolverHelper;
/**
@@ -26,15 +25,15 @@
*/
public class ActivationClient extends AbstractLogEnabled
-implements Serviceable, Configurable, Initializable
+implements Configurable, Initializable, Disposable
{
private Configuration m_config;
- private ORB m_orb;
- private ServiceResolver m_resolver;
+ private TestCase m_object;
private String m_path;
private URL m_url;
+ private ORB m_orb;
//=======================================================================
// Configurable
@@ -50,22 +49,7 @@
{
m_config = config;
String url = "corbaloc:iiop:1.2@localhost:2056/activator";
- m_path = config.getChild("connection").getAttribute("url", url );
- }
-
- //=======================================================================
- // Serviceable
- //=======================================================================
-
- /**
- * Method invoked by the container to provide dependent services.
- * @param manager the service manager
- * @exception ServiceException if the supplied manager does not provide an ORB
- */
- public void service( final ServiceManager manager )
- throws ServiceException
- {
- //m_orb = (ORB) manager.lookup( "orb" );
+ m_path = config.getChild("connection").getAttribute( "url", url );
}
//=======================================================================
@@ -85,8 +69,8 @@
public void initialize()
throws Exception
{
- m_orb = ORB.init( new String[0], new Properties() );
- m_url = new URL( null, m_path, new Handler( m_orb ) );
+ ORB orb = ORB.init( new String[0], new Properties() );
+ m_url = new URL( null, m_path, new Handler( orb ) );
try
{
@@ -95,13 +79,30 @@
getLogger().debug("url: " + m_url );
org.omg.CORBA.Object object = (org.omg.CORBA.Object) connection.getContent();
getLogger().info("got an object: " + object.getClass().getName() );
- m_resolver = ServiceResolverHelper.narrow( object );
- getLogger().debug("object: " + m_resolver.getClass().getName() );
+ m_object = TestCaseHelper.narrow( object );
+ m_object.test();
+ getLogger().debug("object: " + m_object.getClass().getName() );
}
catch( Throwable e )
{
final String error = "Initialization failure.";
getLogger().error( error, e );
+ }
+ }
+
+ /**
+ * Service disposal.
+ */
+ public void dispose()
+ {
+ getLogger().debug( "disposal" );
+ try
+ {
+ m_orb.shutdown( true );
+ }
+ catch( Throwable e )
+ {
+ // ignore it
}
}
}
1.1 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/playground/activation/TestServant.java
Index: TestServant.java
===================================================================
package org.apache.excalibur.playground.activation;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.activity.Disposable;
/**
* This is a minimal demonstration servant implementation. The objective of
* this component is to demonstrate the seperation of a corbal object reference
* establishment (using component type attributes) from the servant
* implementation.
*
* @author <a href="mailto:mcconnell@osm.net">Stephen McConnell</a>
*/
public class TestServant extends AbstractLogEnabled
implements TestCaseOperations
{
//=======================================================================
// TestCaseOperations
//=======================================================================
/**
* Operation test
*/
public boolean test()
{
getLogger().info( "service fulfillment" );
return true;
}
}
1.1 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/playground/activation/TestServant.xinfo
Index: TestServant.xinfo
===================================================================
<?xml version="1.0"?>
<!DOCTYPE type
PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
"http://jakarta.apache.org/avalon/dtds/type_1_0.dtd" >
<type>
<component>
<name>servant</name>
<attributes>
<attribute key="merlin:resource-factory" value="org.apache.excalibur.merlin.activation.RemoteResourceFactory"/>
<attribute key="corba:poa.implementation" value="delegate"/>
<attribute key="corba:poa.delegate" value="org.apache.excalibur.playground.activation.TestCasePOATie"/>
<attribute key="corba:poa.servant.id" value="IDL:excalibur.apache.org/playground/activation/TestCase:1.0"/>
</attributes>
</component>
<services>
<service>
<reference type="org.apache.excalibur.playground.activation.TestCaseOperations"/>
</service>
</services>
</type>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>