From: cvs@openprivacy.orgCVS update: talon/src/java/talon
Date: Sunday March 11, 19101 @ 1:50
Author: burton
CVSWEB Options: -------------------
Main CVSWeb: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi
View this module: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon
-----------------------------------
Update of /usr/local/cvs/public/talon/src/java/talon
In directory giga:/tmp/cvs-serv19665/src/java/talon
Modified Files:
ComponentFactory.java HandleManager.java
Log Message:
now merging init properties if given handle doesn't have any
*****************************************************************
File: talon/src/java/talon/ComponentFactory.java
CVSWEB Options: -------------------
CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/ComponentFactory.java?annotate=1.10
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/ComponentFactory.java?rev=1.10&content-type=text/x-cvsweb-markup
CVSWeb: Diff to previous version: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/ComponentFactory.java.diff?r1=1.10&r2=1.9
-----------------------------------
Index: talon/src/java/talon/ComponentFactory.java
diff -u talon/src/java/talon/ComponentFactory.java:1.9 talon/src/java/talon/ComponentFactory.java:1.10
--- talon/src/java/talon/ComponentFactory.java:1.9 Fri Mar 9 16:10:43 2001
+++ talon/src/java/talon/ComponentFactory.java Sun Mar 11 01:50:47 2001
@@ -17,7 +17,7 @@
* Create instances of components and manage their lifetimes.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.10 2001/03/11 09:50:47 burton Exp $
*/
public class ComponentFactory {
@@ -68,7 +68,7 @@
* Static initializer...
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.10 2001/03/11 09:50:47 burton Exp $
*/
static {
@@ -82,7 +82,7 @@
* Given a ComponentHandle get a Component
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.10 2001/03/11 09:50:47 burton Exp $
*/
public static Component getInstance( ComponentHandle handle )
throws TalonException {
@@ -104,24 +104,48 @@
handle.setLifetime( LIFETIME_DEMAND );
}
- //if the implementation is null... try to pull this out of the HandleManager
- if ( handle.getImplementation() == null && handle.getName() != null ) {
+ //try to fill in any blank information
+ if ( handle.getName() != null ) {
+ try {
- //need to keep a copy of the properties when I get the correct ComponentHandle
- PropertyManager props = handle.getInitProperties();
+ ComponentHandle realHandle = HandleManager.byName( handle.getName() );
- handle = HandleManager.byName( handle.getName() );
- handle.setInitProperties( props );
+ //interface
+ if ( realHandle.getInterface() != null && handle.getInterface() == null ) {
+ handle.setInterface( realHandle.getInterface() );
+ }
+
+ //implementation
+ if ( realHandle.getImplementation() != null && handle.getImplementation() == null ) {
+ handle.setImplementation( realHandle.getImplementation() );
+ }
+
+ //consider merging init properties sometime in the future.
+
+ if ( handle.getInitProperties().size() == 0 && realHandle.getInitProperties().size() != 0 ) {
+
+ logger.debug( "Handle provided doesn't have any properties." );
+ handle.setInitProperties( realHandle.getInitProperties() );
+
+ }
+
+
+
+ } catch ( NotFoundException nfe ) {
+ //this is a normal state. We are just basically hoping that an
+ //implementation is registered here so that we can find out the
+ //correct interface.
+ }
+
}
- //if the inteface is null. see if the implementation is in the
+ //if the inteface is null. see if the implementation is in the
//HandleManager and use this.
-
-
try {
ComponentHandle interfaceHandle = HandleManager.byImplementation( handle.getImplementation() );
+
if ( handle.getInterface() == null && interfaceHandle.getInterface() != null ) {
handle.setInterface( interfaceHandle.getInterface() );
}
@@ -131,6 +155,8 @@
//implementation is registered here so that we can find out the
//correct interface.
}
+
+
//if the interface is still unknown. Make sure we warn the user.
if ( handle.getInterface() == null ) {
@@ -155,7 +181,7 @@
* Get a component instantiating a new one everytime we need it.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.10 2001/03/11 09:50:47 burton Exp $
*/
private static Component getDemandBasedInstance( ComponentHandle handle )
throws TalonException {
@@ -170,7 +196,7 @@
* Get a singleton or create it if necessary.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.10 2001/03/11 09:50:47 burton Exp $
*/
private static Component getSingletonBasedInstance( ComponentHandle handle )
throws TalonException {
@@ -193,7 +219,7 @@
* Perform basic instantiation on a component.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.10 2001/03/11 09:50:47 burton Exp $
*/
private static Component instantiateComponent( ComponentHandle handle )
throws TalonException {
@@ -216,7 +242,7 @@
* Put a singleton to the Factory.
* FIXME: Should this throw an Exception if this object is already present?
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.10 2001/03/11 09:50:47 burton Exp $
*/
static void putSingleton( ComponentHandle handle, Component comp ) {
singletons.put( handle, comp );
@@ -229,7 +255,7 @@
* don't have to worry about fetching an object from the component system.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.10 2001/03/11 09:50:47 burton Exp $
*/
public static Logger getLogger() {
return ComponentFactory.logger;
@@ -239,7 +265,7 @@
*
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.10 2001/03/11 09:50:47 burton Exp $
*/
public static void setLogger( Logger logger ) {
ComponentFactory.logger = logger;
*****************************************************************
File: talon/src/java/talon/HandleManager.java
CVSWEB Options: -------------------
CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/HandleManager.java?annotate=1.6
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/HandleManager.java?rev=1.6&content-type=text/x-cvsweb-markup
CVSWeb: Diff to previous version: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/HandleManager.java.diff?r1=1.6&r2=1.5
-----------------------------------
Index: talon/src/java/talon/HandleManager.java
diff -u talon/src/java/talon/HandleManager.java:1.5 talon/src/java/talon/HandleManager.java:1.6
--- talon/src/java/talon/HandleManager.java:1.5 Sun Mar 11 01:21:42 2001
+++ talon/src/java/talon/HandleManager.java Sun Mar 11 01:50:47 2001
@@ -21,7 +21,7 @@
* them.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
+ * @version $Id: HandleManager.java,v 1.6 2001/03/11 09:50:47 burton Exp $
*/
public class HandleManager extends BaseComponent {
@@ -64,7 +64,7 @@
* If the given handles does NOT already exist. Add it.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
+ * @version $Id: HandleManager.java,v 1.6 2001/03/11 09:50:47 burton Exp $
*/
private static void registerComponentHandle( SimplePropertyManager manager,
String key,
@@ -83,7 +83,7 @@
* Get a handle by its name
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
+ * @version $Id: HandleManager.java,v 1.6 2001/03/11 09:50:47 burton Exp $
*/
public static ComponentHandle byName( String _name )
throws TalonException {
@@ -103,7 +103,7 @@
* Get a handle by its interface
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
+ * @version $Id: HandleManager.java,v 1.6 2001/03/11 09:50:47 burton Exp $
*/
public static ComponentHandle byInterface( String _interface )
throws TalonException {
@@ -116,7 +116,7 @@
* Get a handle by its impl
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
+ * @version $Id: HandleManager.java,v 1.6 2001/03/11 09:50:47 burton Exp $
*/
public static ComponentHandle byImplementation( String _implementation )
throws TalonException {
@@ -135,7 +135,7 @@
* Get all registered components
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
+ * @version $Id: HandleManager.java,v 1.6 2001/03/11 09:50:47 burton Exp $
*/
public static PropertyManager getRegistry() {
return byName;
@@ -144,7 +144,7 @@
/**
* @see Dumpable
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
+ * @version $Id: HandleManager.java,v 1.6 2001/03/11 09:50:47 burton Exp $
*/
public static void dump() {
dump(System.out);
@@ -154,7 +154,7 @@
/**
* @see Dumpable
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
+ * @version $Id: HandleManager.java,v 1.6 2001/03/11 09:50:47 burton Exp $
*/
public static void dump( PrintStream ps ) {
@@ -184,11 +184,14 @@
Object value = spm.getProperty( key.toString() );
ps.print( "\t\t" );
- ps.print( key.toString() );
- ps.print( "\t" );
- ps.print( value.toString() );
- ps.print( "\n" );
+ ps.println( key.toString() );
+ ps.print( "\t\t" );
+ ps.println( value.toString() );
+
+ ps.println();
+
+
((ComponentHandle)value).getInitProperties().dump( ps );
}
This archive was generated by hypermail 2b30 : Sun Mar 11 2001 - 01:51:19 PST