proyal 2002/08/08 07:18:40
Modified: altrmi build.xml default.properties
Added:
altrmi/src/java/org/apache/excalibur/altrmi/client/impl/subscriber
AbstractAltrmiInterfaceLookupFactory.java
AbstractSubscriberImpl.java
AltrmiInterfaceLookupWrapper.java
AltrmiLookupPool.java
CallbackEnabledCustomSocketStreamInterfaceLookupFactory.java
ConnectionException.java
DefaultAltrmiLookupSource.java
RmiInterfaceLookupFactory.java
SocketObjectStreamInterfaceLookupFactory.java
altrmi/src/java/org/apache/excalibur/altrmi/client
AbstractSubscriber.java AltrmiLookupSource.java
Log:
Adding "Subscriber" components to assist in development
of altrmi client application. This includes an AltrmiInterfaceLookup
connection pool as well as an abstract component to assist in
retrieval of the remote interface from the pool
Revision Changes Path
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/subscriber/AbstractAltrmiInterfaceLookupFactory.java
Index: AbstractAltrmiInterfaceLookupFactory.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client.impl.subscriber;
import java.lang.reflect.Constructor;
import org.apache.avalon.excalibur.pool.ObjectFactory;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.excalibur.altrmi.client.AltrmiFactory;
import org.apache.excalibur.altrmi.client.AltrmiHostContext;
import org.apache.excalibur.altrmi.client.impl.ClientClassAltrmiFactory;
import org.apache.excalibur.altrmi.client.impl.PerpetualConnectionPinger;
import org.apache.excalibur.altrmi.client.impl.ServerClassAltrmiFactory;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
/**
* Abstract base factory to create <code>AltrmiInterfaceLookup</code>
instances for the
* connection pool.
*
* Concrete subclasses provide support for the various Altrmi transports
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a>
*/
public abstract class AbstractAltrmiInterfaceLookupFactory extends
AbstractLogEnabled
implements ObjectFactory, Configurable
{
private Constructor m_altrmiFactoryConstructor;
private boolean m_isServer;
public void configure( Configuration configuration ) throws
ConfigurationException
{
String proxyClassLocation = configuration.getChild(
"proxyClassLocation" ).getValue();
if( proxyClassLocation.equals( "client" ) )
{
this.m_isServer = false;
}
else if( proxyClassLocation.equals( "server" ) )
{
this.m_isServer = true;
}
else
{
throw new ConfigurationException( "proxyClassLocation must be
'client' or 'server'" );
}
}
private AltrmiFactory createFactory()
{
if( this.m_isServer )
{
return new ServerClassAltrmiFactory( false );
}
else
{
return new ClientClassAltrmiFactory( false );
}
}
public Object newInstance() throws Exception
{
final AltrmiFactory factory = createFactory();
final AltrmiHostContext context = createHostContext();
context.getClientInvocationHandler().setConnectionPinger( new
PerpetualConnectionPinger() );
factory.setHostContext( context );
if( getLogger().isDebugEnabled() )
getLogger().debug( "AltrmiInterfaceLookup object created" );
return new AltrmiInterfaceLookupWrapper( factory );
}
protected abstract AltrmiHostContext createHostContext() throws
AltrmiConnectionException;
public Class getCreatedClass()
{
return AltrmiInterfaceLookupWrapper.class;
}
public void decommission( Object object ) throws Exception
{
if( object instanceof AltrmiInterfaceLookupWrapper )
{
( ( AltrmiInterfaceLookupWrapper ) object ).dispose();
}
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/subscriber/AbstractSubscriberImpl.java
Index: AbstractSubscriberImpl.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client.impl.subscriber;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.excalibur.altrmi.client.AbstractSubscriber;
import org.apache.excalibur.altrmi.client.AltrmiInterfaceLookup;
import org.apache.excalibur.altrmi.client.AltrmiLookupSource;
import org.apache.excalibur.altrmi.common.AltrmiAuthentication;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
import org.apache.excalibur.altrmi.common.AltrmiInvocationException;
/**
* An abstract base class to be used in conjunction with
<code>AbstractSubscriber</code>
*
* To use, create a subclass of <code>AbstractSubscriber</code> and this
class, such as:
*
* <pre>
* public interface MyRemoteInterfaceSubscriber extends AbstractSubscriber
* {
* String ROLE = MyRemoteInterfaceSubscriber.class.getName();
*
* MyRemoteInterface select( AltrmiAuthentication authentication )
* throws AltrmiConnectionException;
* }
*
* public class MyRemoteInterfaceSubscriberImpl extends AbstractSubscriberImpl
* implements MyRemoteInterfaceSubscriber
* {
*
* public MyRemoteInterface select( AltrmiAuthentication authentication )
* throws AltrmiConnectionException
* {
* return ( MyRemoteInterface ) lookup( authentication );
* }
* }
* </pre>
*
* Alternatively, the <code>MyRemoteInterfaceSubscriberImpl.select</code>
could be written as
*
* <pre>
* public MyRemoteInterface select( AltrmiAuthentication authentication )
* {
* try {
* return ( MyRemoteInterface ) lookup( authentication );
* }
* catch( AltrmiConnectionException e )
* {
* throw new CascadingRuntimeException( "Unable to select remote
interface", e );
* }
* }
* </pre>
*
* This class is <code>Composable</code> and expects to have a
<code>AltrmiLookupSource</code>
* available in its <code>ComponentManager</code>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a>
*/
public abstract class AbstractSubscriberImpl extends AbstractLogEnabled
implements Composable, Configurable, AbstractSubscriber
{
private int m_retryCount;
private String m_publication;
private AltrmiLookupSource m_lookupSource;
private Map m_subscriptions = Collections.synchronizedMap( new HashMap()
);
public void compose( ComponentManager componentManager ) throws
ComponentException
{
m_lookupSource = ( AltrmiLookupSource ) componentManager.lookup(
AltrmiLookupSource.ROLE );
}
public void configure( Configuration configuration ) throws
ConfigurationException
{
m_publication = configuration.getChild( "publication" ).getValue();
m_retryCount = configuration.getChild( "retry-count"
).getValueAsInteger( 10 );
}
protected Object lookup( AltrmiAuthentication authentication ) throws
AltrmiConnectionException
{
for( int i = 0; i < this.m_retryCount; i++ )
{
AltrmiInterfaceLookup lookup = this.m_lookupSource.get();
try
{
Object dup;
Object iface = lookup.lookup( this.m_publication,
authentication );
if( getLogger().isDebugEnabled() )
getLogger().debug( "lookup [iface: " + iface
+ ", hash: " + iface.hashCode() + "]"
);
if( ( dup = this.m_subscriptions.put( iface, lookup ) ) !=
null )
{
getLogger().warn( "Duplicate subscription detected
[iface: " + iface
+ ", dup: " + dup + ", hash: " +
iface.hashCode()
+ ", class: " +
iface.getClass().getName() + "]" );
}
return iface;
}
catch( AltrmiInvocationException e )
{
getLogger().error( "Exception looking up publication [pub: "
+ this.m_publication + "]", e );
lookup.close();
}
}
return null;
}
public void release( Object o )
{
if( o != null )
{
final AltrmiInterfaceLookup lookup =
( AltrmiInterfaceLookup ) this.m_subscriptions.remove( o );
if( lookup == null )
{
throw new RuntimeException( "Object was never subscribed
[object: " + o + "]" );
}
else
{
lookup.close();
}
}
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/subscriber/AltrmiInterfaceLookupWrapper.java
Index: AltrmiInterfaceLookupWrapper.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client.impl.subscriber;
import org.apache.avalon.excalibur.pool.Pool;
import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.excalibur.altrmi.client.AltrmiInterfaceLookup;
import org.apache.excalibur.altrmi.common.AltrmiAuthentication;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
import org.apache.excalibur.altrmi.common.AltrmiInvocationException;
/**
* The <code>AbstractAltrmiInterfaceLookupFactory</code> uses this class to
wrap the
* <code>AltrmiInterfaceLookup</code> objects it returns so they can be
transparently pooled.
*
* An <code>AltrmiInterfaceLookup</code> is deemed <i>broken</i> if the
<code>lookup</code>
* operation returns an exception. Broken <code>AltrmiInterfaceLookup</code>
instances will
* be removed from the pool when returned.
*
* @author <a href="[EMAIL PROTECTED]">Peter Royal</a>
* @version $Revision: 1.1 $
*/
public class AltrmiInterfaceLookupWrapper extends AbstractLogEnabled
implements AltrmiInterfaceLookup, Poolable, Disposable
{
protected final AltrmiInterfaceLookup m_lookup;
protected Pool m_pool;
private boolean m_broken = false;
/**
* Private default constructor so that it cannot be instantiated any
* other way than we desire.
*/
private AltrmiInterfaceLookupWrapper()
{
this.m_lookup = null;
}
/**
* @param lookup AltrmiInterfaceLookup instance to wrap
*/
public AltrmiInterfaceLookupWrapper( final AltrmiInterfaceLookup lookup )
{
this.m_lookup = lookup;
}
protected void setPool( Pool pool )
{
this.m_pool = pool;
}
public boolean isBroken()
{
return this.m_broken;
}
public void close()
{
m_pool.put( this );
}
public void dispose()
{
this.m_lookup.close();
}
public Object lookup( String publishedServiceName ) throws
AltrmiConnectionException
{
return this.m_lookup.lookup( publishedServiceName );
}
public Object lookup( String publishedServiceName, AltrmiAuthentication
altrmiAuthentication )
throws AltrmiConnectionException
{
try
{
return this.m_lookup.lookup( publishedServiceName,
altrmiAuthentication );
}
catch( AltrmiConnectionException e )
{
this.m_broken = true;
throw e;
}
catch( AltrmiInvocationException e )
{
this.m_broken = true;
throw e;
}
}
public String[] list()
{
return this.m_lookup.list();
}
public String getTextToSignForAuthentication()
{
return this.m_lookup.getTextToSignForAuthentication();
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/subscriber/AltrmiLookupPool.java
Index: AltrmiLookupPool.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client.impl.subscriber;
import org.apache.avalon.excalibur.pool.DefaultPoolController;
import org.apache.avalon.excalibur.pool.Poolable;
import org.apache.avalon.excalibur.pool.SoftResourceLimitingPool;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
/**
* The Pool implementation for AltrmiInterfaceLookup's.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/08/08 14:18:39 $
*/
public class AltrmiLookupPool extends SoftResourceLimitingPool implements
Disposable, Initializable
{
private boolean m_noConnections = false;
public AltrmiLookupPool( final AbstractAltrmiInterfaceLookupFactory
factory,
final DefaultPoolController controller,
final int min,
final int max
)
throws Exception
{
super( factory, controller, min, max );
}
public void initialize() throws Exception
{
this.grow( this.m_min );
if( this.size() > 0 )
{
m_initialized = true;
}
else
{
m_noConnections = true;
}
}
protected final Poolable newPoolable() throws Exception
{
AltrmiInterfaceLookupWrapper wrapper = ( AltrmiInterfaceLookupWrapper
) super.newPoolable();
wrapper.setPool( this );
return wrapper;
}
public Poolable get() throws Exception
{
if( !m_initialized )
{
if( m_noConnections )
{
throw new IllegalStateException( "There are no connections in
the pool, check your settings." );
}
}
AltrmiInterfaceLookupWrapper obj = ( AltrmiInterfaceLookupWrapper )
super.get();
if( obj.isBroken() )
{
if( getLogger().isDebugEnabled() )
getLogger().debug( "AltrmiInterfaceLookup was broken,
creating one to take its place" );
try
{
super.lock();
if( m_active.contains( obj ) )
{
m_active.remove( obj );
}
this.removePoolable( obj );
obj = ( AltrmiInterfaceLookupWrapper ) this.newPoolable();
m_active.add( obj );
}
catch( Exception e )
{
if( getLogger().isWarnEnabled() )
getLogger().warn( "Could not get an open connection", e );
throw e;
}
finally
{
super.unlock();
}
}
return obj;
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/subscriber/CallbackEnabledCustomSocketStreamInterfaceLookupFactory.java
Index: CallbackEnabledCustomSocketStreamInterfaceLookupFactory.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client.impl.subscriber;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.excalibur.altrmi.client.AltrmiHostContext;
import
org.apache.excalibur.altrmi.client.impl.callback.socket.CallbackEnabledSocketCustomStreamHostContext;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
/**
* Factory for CallbackEnabledSocketCustomStream transport
*
* @author <a href="[EMAIL PROTECTED]">Peter Royal</a>
* @version $Revision: 1.1 $
*/
public class CallbackEnabledCustomSocketStreamInterfaceLookupFactory
extends AbstractAltrmiInterfaceLookupFactory
{
private String m_host;
private int m_port;
public void configure( Configuration configuration ) throws
ConfigurationException
{
super.configure( configuration );
m_port = configuration.getChild( "port" ).getValueAsInteger();
m_host = configuration.getChild( "host" ).getValue();
}
protected AltrmiHostContext createHostContext() throws
AltrmiConnectionException
{
return new CallbackEnabledSocketCustomStreamHostContext( m_host,
m_port );
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/subscriber/ConnectionException.java
Index: ConnectionException.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client.impl.subscriber;
import org.apache.avalon.framework.CascadingRuntimeException;
/**
* Exception thrown for problems relating to the connection between client
and server
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/08/08 14:18:39 $
*/
public class ConnectionException extends CascadingRuntimeException
{
public ConnectionException( final String message, final Throwable
throwable )
{
super( message, throwable );
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/subscriber/DefaultAltrmiLookupSource.java
Index: DefaultAltrmiLookupSource.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client.impl.subscriber;
import org.apache.avalon.excalibur.pool.DefaultPoolController;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.excalibur.altrmi.client.AltrmiInterfaceLookup;
import org.apache.excalibur.altrmi.client.AltrmiLookupSource;
/**
* The Default implementation of an <code>AltrmiLookupSource</code>.
*
* <p>
* Configuration Example:
* <pre>
* <altrmi-subscriber>
* <pool-controller min="3" max="50"/>
* <factory
class="org.apache.excalibur.altrmi.client.impl.subscriber.SocketObjectStreamInterfaceLookupFactory">
* <proxyClassLocation>client</proxyClassLocation>
* <host>localhost</host>
* <port>1234</port>
* </factory>
* </altrmi-subscriber>
* </pre>
* <p>
* Configuration Attributes:
* <ul>
* <li>The <code>min</code> attribute is used to set the minimum size of the
AltrmiInterfaceLookup
* pool. When first initialized, this number of connections will be
automatically created and be
* ready for use. (Defaults to "1")</li>
*
* <li>The <code>max</code> attribute is used to set the maximum number of
connections which
* will be opened. (Defaults to "3")</li>
*
* <li>The <code>factory</code> element is used to set the factory used to
create
* <code>AltrmiInterfaceLookup</code> instances. The <code>class</code>
attribute contains
* the name of the class to use. This configuration block is also passed to
the factory
* to configure it.
* </li>
* </ul>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/08/08 14:18:39 $
*/
public class DefaultAltrmiLookupSource extends AbstractLogEnabled
implements AltrmiLookupSource, Disposable, Configurable, ThreadSafe
{
protected AltrmiLookupPool m_pool;
/**
* Configure and set up DB connection. Here we set the connection
* information needed to create the Connection objects. It must
* be called only once.
*
* @param conf The Configuration object needed to describe the
* connection.
*
* @throws ConfigurationException
*/
public void configure( final Configuration configuration ) throws
ConfigurationException
{
if( null == m_pool )
{
final Configuration controller = configuration.getChild(
"pool-controller" );
final int min = controller.getAttributeAsInteger( "min", 1 );
final int max = controller.getAttributeAsInteger( "max", 3 );
final Configuration fconfig = configuration.getChild( "factory" );
final int l_max;
final int l_min;
// Validate the min and max pool size values.
if( min < 1 )
{
if( getLogger().isWarnEnabled() )
{
getLogger().warn( "Min number of connections specified
must be at least 1." );
}
l_min = 1;
}
else
{
l_min = min;
}
if( max < 1 )
{
if( getLogger().isWarnEnabled() )
{
getLogger().warn( "Max number of connections specified
must be at least 1." );
}
l_max = 1;
}
else
{
if( max < min )
{
if( getLogger().isWarnEnabled() )
{
getLogger().warn( "Maximum number of connections
specified must be " +
"more than the minimum number of
connections." );
}
l_max = min + 1;
}
else
{
l_max = max;
}
}
try
{
final DefaultPoolController poolController = new
DefaultPoolController( l_max / 4 );
final AbstractAltrmiInterfaceLookupFactory factory =
createFactory( fconfig );
m_pool = new AltrmiLookupPool( factory, poolController,
l_min, l_max );
m_pool.enableLogging( getLogger() );
m_pool.initialize();
}
catch( Exception e )
{
throw new ConfigurationException( "Error configuring
AltrmiLookupSource", e );
}
}
}
private AbstractAltrmiInterfaceLookupFactory createFactory( final
Configuration fconfig )
throws Exception
{
final ClassLoader loader =
Thread.currentThread().getContextClassLoader();
final String className = fconfig.getAttribute( "class" );
final AbstractAltrmiInterfaceLookupFactory factory =
( AbstractAltrmiInterfaceLookupFactory )
loader.loadClass(className).newInstance();
setupLogger( factory );
factory.configure( fconfig );
return factory;
}
/** Get the database connection */
public AltrmiInterfaceLookup get()
{
try
{
return ( AltrmiInterfaceLookup ) m_pool.get();
}
catch( final Exception e )
{
throw new ConnectionException( e.getMessage(), e );
}
}
/** Dispose properly of the pool */
public void dispose()
{
m_pool.dispose();
m_pool = null;
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/subscriber/RmiInterfaceLookupFactory.java
Index: RmiInterfaceLookupFactory.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client.impl.subscriber;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.excalibur.altrmi.client.AltrmiHostContext;
import org.apache.excalibur.altrmi.client.impl.rmi.RmiHostContext;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
/**
* Factory for RMI transport
*
* @author <a href="[EMAIL PROTECTED]">Peter Royal</a>
* @version $Revision: 1.1 $
*/
public class RmiInterfaceLookupFactory extends
AbstractAltrmiInterfaceLookupFactory
{
private String m_host;
private int m_port;
public void configure( Configuration configuration ) throws
ConfigurationException
{
super.configure( configuration );
m_port = configuration.getChild( "port" ).getValueAsInteger();
m_host = configuration.getChild( "host" ).getValue();
}
protected AltrmiHostContext createHostContext() throws
AltrmiConnectionException
{
return new RmiHostContext( m_host, m_port );
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/subscriber/SocketObjectStreamInterfaceLookupFactory.java
Index: SocketObjectStreamInterfaceLookupFactory.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client.impl.subscriber;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.excalibur.altrmi.client.AltrmiHostContext;
import
org.apache.excalibur.altrmi.client.impl.socket.SocketObjectStreamHostContext;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
/**
* Factory for SocketObjectStream transport
*
* @author <a href="[EMAIL PROTECTED]">Peter Royal</a>
* @version $Revision: 1.1 $
*/
public class SocketObjectStreamInterfaceLookupFactory extends
AbstractAltrmiInterfaceLookupFactory
{
private String m_host;
private int m_port;
public void configure( Configuration configuration ) throws
ConfigurationException
{
super.configure( configuration );
m_port = configuration.getChild( "port" ).getValueAsInteger();
m_host = configuration.getChild( "host" ).getValue();
}
protected AltrmiHostContext createHostContext() throws
AltrmiConnectionException
{
return new SocketObjectStreamHostContext( m_host, m_port );
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/AbstractSubscriber.java
Index: AbstractSubscriber.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client;
import org.apache.avalon.framework.component.Component;
/**
* This interface is a weird beast. It is not intended to be used directly,
rather
* developers should create a subclass of this interface and provide a method
such as
*
* <pre>
* YourRemoteInterface select( AltrmiAuthentication authentication );
* </pre>
*
* Your subclassed interface can then be used in your application so
application components
* can lookup strongly-typed versions of the remote interfaces.
*
* @see AbstractSubscriberImpl
* @author <a href="[EMAIL PROTECTED]">Peter Royal</a>
* @version $Revision: 1.1 $
*/
public interface AbstractSubscriber extends Component
{
void release( Object subscriber );
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/AltrmiLookupSource.java
Index: AltrmiLookupSource.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client;
import org.apache.avalon.framework.component.Component;
/**
* The <code>AltrmiLookupSource</code> is a component that will return an
* <code>AltrmiInterfaceLookup</code>.
*
* @see DefaultAltrmiLookupSource
* @author <a href="[EMAIL PROTECTED]">Peter Royal</a>
* @version $Revision: 1.1 $
*/
public interface AltrmiLookupSource extends Component
{
String ROLE = AltrmiLookupSource.class.getName();
/**
* Get an <code>AltrmiInterfaceLookup</code>.
*
* @return an <code>AltrmiInterfaceLookup</code>
*/
AltrmiInterfaceLookup get();
}
1.29 +3 -1 jakarta-avalon-excalibur/altrmi/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/build.xml,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- build.xml 8 Aug 2002 07:31:12 -0000 1.28
+++ build.xml 8 Aug 2002 14:18:39 -0000 1.29
@@ -13,6 +13,7 @@
<path id="project.class.path">
<pathelement location="${build.classes}"/>
<pathelement location="${avalon-framework.jar}"/>
+ <pathelement location="${excalibur-pool.jar}"/>
<pathelement location="${checkstyle.jar}"/>
<pathelement path="${java.class.path}"/>
<pathelement location="${jakarta-bcel.jar}"/>
@@ -48,7 +49,8 @@
<target name="dependencies" description="Check dependencies"
unless="skip.dependencies">
<ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkCommon"/>
<ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkFramework"/>
- <ant antfile="${basedir}/build.xml" target="checkBCEL"/>
+ <ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkPool"/>
+ <ant antfile="${basedir}/build.xml" target="checkBCEL"/>
</target>
<target name="dependencies-test" depends="dist-jar, dependencies"
1.8 +6 -0 jakarta-avalon-excalibur/altrmi/default.properties
Index: default.properties
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/default.properties,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- default.properties 30 Jul 2002 22:52:36 -0000 1.7
+++ default.properties 8 Aug 2002 14:18:39 -0000 1.8
@@ -27,6 +27,12 @@
avalon-framework.lib=${avalon-framework.home}/build/lib
avalon-framework.jar=${avalon-framework.lib}/avalon-framework.jar
jakarta-bcel.jar=./lib/bcel.jar
+
+# ----- Excalibur pool, version 1.1 or later -----
+excalibur-pool.home=${basedir}/../pool/dist
+excalibur-pool.lib=${excalibur-pool.home}
+excalibur-pool.jar=${excalibur-pool.lib}/excalibur-pool-1.1.jar
+
# --------------------------------------------------
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>