jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container/adapters ResolverBasedKeyAwareAdapter.java,NONE,1.1 ResolverBasedAdapter.java,1.2,1.3
Leo Simons <[email protected]>
| Newsgroups | gmane.comp.java.jicarilla.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container/adapters
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24598/platform/container/impl/src/java/org/jicarilla/container/adapters
Modified Files:
ResolverBasedAdapter.java
Added Files:
ResolverBasedKeyAwareAdapter.java
Log Message:
its now possible to do stuff like...
builder.addComponent(
SocketServer.class,
new CustomComponent( SocketServerImpl.class )
.redirectCall( 3, "event-pool" )
.redirectCall( 4, "pipeline-pool" )
.redirectCall( 5, "error-handler" )
);
...testing remains a TODO.
--- NEW FILE: ResolverBasedKeyAwareAdapter.java ---
/* ====================================================================
The Jicarilla Software License
Copyright (c) 2003 Leo Simons.
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
==================================================================== */
package org.jicarilla.container.adapters;
import org.jicarilla.container.KeyAwareAdapter;
import org.jicarilla.container.Resolver;
import org.jicarilla.lang.Assert;
/**
*
*
* @author <a href="mail at leosimons dot com">Leo Simons</a>
* @version $Id: ResolverBasedKeyAwareAdapter.java,v 1.1 2004/03/23 15:59:52 lsimons Exp $
*/
public class ResolverBasedKeyAwareAdapter
implements KeyAwareAdapter
{
protected final Resolver m_delegate;
public ResolverBasedKeyAwareAdapter( final Resolver delegate )
{
Assert.assertNotNull( "delegate argument may not be null", delegate );
m_delegate = delegate;
}
public Object getInstance( final Object key )
{
return m_delegate.get( key );
}
public void releaseInstance( final Object component ) throws Exception
{
m_delegate.releaseInstance( component );
}
}
Index: ResolverBasedAdapter.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container/adapters/ResolverBasedAdapter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ResolverBasedAdapter.java 23 Mar 2004 13:37:52 -0000 1.2
+++ ResolverBasedAdapter.java 23 Mar 2004 15:59:52 -0000 1.3
@@ -25,30 +25,33 @@
==================================================================== */
package org.jicarilla.container.adapters;
-import org.jicarilla.container.KeyAwareAdapter;
+import org.jicarilla.container.Adapter;
import org.jicarilla.container.Resolver;
import org.jicarilla.lang.Assert;
/**
*
*
- * @author <a href="mail at leosimons dot com">Leo Simons</a>
+ * @author <a href="lsimons at jicarilla dot org">Leo Simons</a>
* @version $Id$
*/
-public class ResolverBasedAdapter
- implements KeyAwareAdapter
+public class ResolverBasedAdapter implements Adapter
{
protected final Resolver m_delegate;
+ protected final Object m_key;
- public ResolverBasedAdapter( final Resolver delegate )
+ public ResolverBasedAdapter( final Resolver delegate,
+ final Object key )
{
Assert.assertNotNull( "delegate argument may not be null", delegate );
+ Assert.assertNotNull( "key argument may not be null", key );
m_delegate = delegate;
+ m_key = key;
}
- public Object getInstance( final Object key )
+ public Object getInstance()
{
- return m_delegate.get( key );
+ return m_delegate.get( m_key );
}
public void releaseInstance( final Object component ) throws Exception
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click