You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by bl...@apache.org on 2002/08/27 22:23:08 UTC
cvs commit: jakarta-avalon-excalibur/container/src/java/org/apache/excalibur/container/legacy LegacyComponentManager.java ComponentProxyGenerator.java
bloritsch 2002/08/27 13:23:08
Modified: container/src/java/org/apache/excalibur/container/legacy
ComponentProxyGenerator.java
Added: container/src/java/org/apache/excalibur/container/legacy
LegacyComponentManager.java
Log:
add the rest of the legacy stuff--ComponentSelector still needed
Revision Changes Path
1.2 +6 -6 jakarta-avalon-excalibur/container/src/java/org/apache/excalibur/container/legacy/ComponentProxyGenerator.java
Index: ComponentProxyGenerator.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/container/src/java/org/apache/excalibur/container/legacy/ComponentProxyGenerator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ComponentProxyGenerator.java 27 Aug 2002 19:57:25 -0000 1.1
+++ ComponentProxyGenerator.java 27 Aug 2002 20:23:08 -0000 1.2
@@ -1,10 +1,10 @@
/*
-* 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.
-*/
+ * 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.container.legacy;
1.1 jakarta-avalon-excalibur/container/src/java/org/apache/excalibur/container/legacy/LegacyComponentManager.java
Index: LegacyComponentManager.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.container.legacy;
import org.apache.avalon.framework.component.*;
import org.apache.avalon.framework.service.*;
import java.util.HashMap;
/**
* Create a Component proxy. Requires JDK 1.3+
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
*/
public final class LegacyComponentManager implements ComponentManager
{
private final ComponentProxyGenerator m_proxyGen;
private final ServiceManager m_manager;
private final HashMap m_map;
/**
* Initialize the ComponentProxyGenerator with the default classloader.
* The default classloader is the Thread context classloader.
*/
public LegacyComponentManager(final ServiceManager manager)
{
this( new ComponentProxyGenerator(), manager );
}
/**
* Initialize the ComponentProxyGenerator with the supplied classloader.
* If the supplied class loader is null, we use the Thread context class
* loader. If that is null, we use this class's classloader.
*/
public LegacyComponentManager( final ComponentProxyGenerator generator,
final ServiceManager manager )
{
if ( null == generator )
{
throw new NullPointerException( "generator" );
}
if ( null == manager )
{
throw new NullPointerException( "manager" );
}
m_proxyGen = generator;
m_manager = manager;
m_map = new HashMap();
}
public boolean hasComponent( String role )
{
return m_manager.hasService( role );
}
public Component lookup( String role )
throws ComponentException
{
Component component = null;
Object service = null;
try
{
service = m_manager.lookup( role );
component = m_proxyGen.getProxy( role, service );
}
catch (ComponentException ce)
{
throw ce;
}
catch (Exception e)
{
throw new ComponentException( role, e );
}
synchronized ( m_map )
{
m_map.put( component, service );
}
return component;
}
public void release( Component component )
{
Object service = null;
synchronized( m_map )
{
service = m_map.remove( component );
}
m_manager.release( service );
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>