From: cvs@openprivacy.orgCVS update: talon/src/java/talon
Date: Friday March 9, 19101 @ 16:10
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-serv17970/src/java/talon
Modified Files:
BaseComponent.java Component.java ComponentFactory.java
ComponentHandle.java HandleManager.java Initializer.java
Log Message:
reworked component initialization. ...
*****************************************************************
File: talon/src/java/talon/BaseComponent.java
CVSWEB Options: -------------------
CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/BaseComponent.java?annotate=1.7
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/BaseComponent.java?rev=1.7&content-type=text/x-cvsweb-markup
CVSWeb: Diff to previous version: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/BaseComponent.java.diff?r1=1.7&r2=1.6
-----------------------------------
Index: talon/src/java/talon/BaseComponent.java
diff -u talon/src/java/talon/BaseComponent.java:1.6 talon/src/java/talon/BaseComponent.java:1.7
--- talon/src/java/talon/BaseComponent.java:1.6 Wed Mar 7 19:28:29 2001
+++ talon/src/java/talon/BaseComponent.java Fri Mar 9 16:10:43 2001
@@ -21,7 +21,7 @@
* develoeprs as a base for the Components they create.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BaseComponent.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: BaseComponent.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public abstract class BaseComponent implements Component {
@@ -33,7 +33,7 @@
/**
* @see Component
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BaseComponent.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: BaseComponent.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public ComponentHandle getComponentHandle() {
return this.handle;
@@ -42,7 +42,7 @@
/**
* @see Component
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BaseComponent.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: BaseComponent.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public void setComponentHandle( ComponentHandle handle ) {
this.handle = handle;
@@ -51,31 +51,13 @@
/**
* @see Component
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BaseComponent.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: BaseComponent.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public URI getComponentReference() {
//determine this URI if it isn't set.
if ( componentReference == null ) {
-
- String host = null;
-
-
- try {
-
- InetAddress address = InetAddress.getLocalHost();
-
- try {
- host = address.getHostName();
- } catch ( SecurityException e ) {
- address.getAddress();
- }
-
- } catch ( UnknownHostException uhe ) {
- host = "localhost";
- }
-
- componentReference = new URI( "talon://" + host + "/component/" + getClass().getName() + "/hashcode/" + hashCode() );
+ componentReference = ReferenceFactory.getComponentReference( this );
}
return componentReference;
@@ -84,14 +66,16 @@
/**
+ * FIXME: should this be moved to ComponentHandle? It is a duplication of
+ * the method in that class.
* @see Component
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BaseComponent.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: BaseComponent.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public URI getTypeReference() {
if ( this.typeReference == null ) {
- this.typeReference = new URI( "talon:///component/" + getClass().getName() );
+ typeReference = ReferenceFactory.getTypeReference( this );
}
return this.typeReference;
@@ -100,7 +84,7 @@
/**
* @see Component
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BaseComponent.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: BaseComponent.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public Logger getLogger() {
try {
@@ -119,7 +103,7 @@
* Default impl of toString() just dumps handle info...
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BaseComponent.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: BaseComponent.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public String toString() {
return this.getComponentHandle().toString();
*****************************************************************
File: talon/src/java/talon/Component.java
CVSWEB Options: -------------------
CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/Component.java?annotate=1.7
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/Component.java?rev=1.7&content-type=text/x-cvsweb-markup
CVSWeb: Diff to previous version: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/Component.java.diff?r1=1.7&r2=1.6
-----------------------------------
Index: talon/src/java/talon/Component.java
diff -u talon/src/java/talon/Component.java:1.6 talon/src/java/talon/Component.java:1.7
--- talon/src/java/talon/Component.java:1.6 Wed Mar 7 19:28:29 2001
+++ talon/src/java/talon/Component.java Fri Mar 9 16:10:43 2001
@@ -21,7 +21,7 @@
* as a first class Component with the system.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Component.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: Component.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public interface Component {
@@ -30,7 +30,7 @@
* Called when this object is initialized.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Component.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: Component.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public void init() throws TalonException;
@@ -39,7 +39,7 @@
* Get the handle for this component.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Component.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: Component.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public ComponentHandle getComponentHandle();
@@ -55,11 +55,11 @@
* around.
*
* <p>
- * Should return a URI like talon://HOST/component/CLASSNAME/hashcode/HASHCODE
+ * Should return a URI like talon://HOST/component/CLASSNAME/interface/INTERFACE/hashcode/HASHCODE
*
* @see Object#hashCode
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Component.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: Component.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public URI getComponentReference();
@@ -69,9 +69,12 @@
* specific information. This is necessary if you want to request a object
* by its type information.
*
+ * <p>
+ * Should return a URI like talon:///component/CLASSNAME/interface/INTERFACE
+ *
* @see #getComponentReference
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Component.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: Component.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public URI getTypeReference();
@@ -79,7 +82,7 @@
* Set the handle for this component.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Component.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: Component.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public void setComponentHandle( ComponentHandle handle );
@@ -89,7 +92,7 @@
* switch logging implementations without needing a specific configuration.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Component.java,v 1.6 2001/03/08 03:28:29 burton Exp $
+ * @version $Id: Component.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public Logger getLogger();
*****************************************************************
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.9
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/ComponentFactory.java?rev=1.9&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.9&r2=1.8
-----------------------------------
Index: talon/src/java/talon/ComponentFactory.java
diff -u talon/src/java/talon/ComponentFactory.java:1.8 talon/src/java/talon/ComponentFactory.java:1.9
--- talon/src/java/talon/ComponentFactory.java:1.8 Fri Mar 2 19:16:57 2001
+++ talon/src/java/talon/ComponentFactory.java Fri Mar 9 16:10:43 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.8 2001/03/03 03:16:57 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 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.8 2001/03/03 03:16:57 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 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.8 2001/03/03 03:16:57 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
*/
public static Component getInstance( ComponentHandle handle )
throws TalonException {
@@ -114,7 +114,30 @@
handle = HandleManager.byName( handle.getName() );
handle.setInitProperties( props );
}
+
+ //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() );
+ }
+
+ } 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 interface is still unknown. Make sure we warn the user.
+ if ( handle.getInterface() == null ) {
+ logger.warning( "Unknown interface for handle: " + handle.toString() );
+ }
+
//determine what lifetime to use
String lifetime = handle.getLifetime();
@@ -132,7 +155,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.8 2001/03/03 03:16:57 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
*/
private static Component getDemandBasedInstance( ComponentHandle handle )
throws TalonException {
@@ -147,7 +170,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.8 2001/03/03 03:16:57 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
*/
private static Component getSingletonBasedInstance( ComponentHandle handle )
throws TalonException {
@@ -164,14 +187,13 @@
return comp;
-
}
/**
* Perform basic instantiation on a component.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.8 2001/03/03 03:16:57 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
*/
private static Component instantiateComponent( ComponentHandle handle )
throws TalonException {
@@ -194,7 +216,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.8 2001/03/03 03:16:57 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
*/
static void putSingleton( ComponentHandle handle, Component comp ) {
singletons.put( handle, comp );
@@ -207,7 +229,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.8 2001/03/03 03:16:57 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
*/
public static Logger getLogger() {
return ComponentFactory.logger;
@@ -217,7 +239,7 @@
*
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.8 2001/03/03 03:16:57 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.9 2001/03/10 00:10:43 burton Exp $
*/
public static void setLogger( Logger logger ) {
ComponentFactory.logger = logger;
*****************************************************************
File: talon/src/java/talon/ComponentHandle.java
CVSWEB Options: -------------------
CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/ComponentHandle.java?annotate=1.11
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/ComponentHandle.java?rev=1.11&content-type=text/x-cvsweb-markup
CVSWeb: Diff to previous version: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/ComponentHandle.java.diff?r1=1.11&r2=1.10
-----------------------------------
Index: talon/src/java/talon/ComponentHandle.java
diff -u talon/src/java/talon/ComponentHandle.java:1.10 talon/src/java/talon/ComponentHandle.java:1.11
--- talon/src/java/talon/ComponentHandle.java:1.10 Thu Mar 1 14:42:45 2001
+++ talon/src/java/talon/ComponentHandle.java Fri Mar 9 16:10:43 2001
@@ -9,16 +9,21 @@
package talon;
-import java.util.*;
-import talon.interfaces.*;
+import java.io.*;
+import java.net.*;
+import java.util.*;
import talon.implementations.*;
+import talon.interfaces.*;
+import talon.util.net.*;
/**
- * Object which is used to find components within the system.
+ * Object which is used to find components within the system. Each Component
+ * has a ComponentHandle which is used within the system to create instances and
+ * to hold property information.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public class ComponentHandle {
@@ -40,6 +45,8 @@
private String _lifetime = null;
private String _description = null;
+
+ private URI typeReference = null;
private PropertyManager initProperties = new SimplePropertyManager();
@@ -48,6 +55,9 @@
* different from each other. This means you could have say multiple
* singletons each point to an different XML document, or to a different
* URI. Default is none.
+ *
+ * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
private String name = null;
@@ -55,7 +65,7 @@
* Create a basic ComponentHandle
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public ComponentHandle() {}
@@ -64,7 +74,7 @@
* pulled from the Talon properties.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public ComponentHandle( String _interface ) {
@@ -73,10 +83,9 @@
}
/**
- * The interface and classname.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public ComponentHandle( String _interface,
String _implementation ) {
@@ -88,10 +97,9 @@
/**
- * The interface and classname. You may specify a PropertyManager here.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public ComponentHandle( String _interface,
String _classname,
@@ -102,11 +110,9 @@
}
/**
- * The interface and classname. You may specify a PropertyManager here.
- * Also set the name.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public ComponentHandle( String name,
String _interface,
@@ -120,8 +126,12 @@
/**
- * Get the value of _interface.
- * @return value of _interface.
+ * Get the Interface of this classname. Note that in some cases this may
+ * not be set because the interface name is not required to instantiate a
+ * component.
+ *
+ * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public String getInterface() {
return _interface;
@@ -170,7 +180,7 @@
/**
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public String getLifetime() {
return this._lifetime;
@@ -180,7 +190,7 @@
/**
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public ComponentHandle setLifetime( String _lifetime ) {
this._lifetime = _lifetime;
@@ -189,7 +199,7 @@
/**
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public String getDescription() {
return this._description;
@@ -197,7 +207,7 @@
/**
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public ComponentHandle setDescription( String _description ) {
this._description = _description;
@@ -209,7 +219,7 @@
* initialization.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public PropertyManager getInitProperties() {
return this.initProperties;
@@ -218,7 +228,7 @@
/**
* @see #getInitProperties
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public ComponentHandle setInitProperties( PropertyManager initProperties ) {
this.initProperties = initProperties;
@@ -229,17 +239,33 @@
* Dump Handle information..
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public String toString() {
- return this.getName() + ":" + this.getInterface() + " -> " + this.getImplementation();
+ //FIXME: output the typeReference
+ return this.getTypeReference().toString();
}
/**
+ * @see Component
+ * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
+ */
+ public URI getTypeReference() {
+
+ if ( this.typeReference == null ) {
+ typeReference = ReferenceFactory.getTypeReference( this );
+ }
+
+ return this.typeReference;
+ }
+
+
+ /**
* Return a cloned ComponentHandle.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.10 2001/03/01 22:42:45 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.11 2001/03/10 00:10:43 burton Exp $
*/
public Object clone() {
*****************************************************************
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.4
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/HandleManager.java?rev=1.4&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.4&r2=1.3
-----------------------------------
Index: talon/src/java/talon/HandleManager.java
diff -u talon/src/java/talon/HandleManager.java:1.3 talon/src/java/talon/HandleManager.java:1.4
--- talon/src/java/talon/HandleManager.java:1.3 Sun Feb 11 14:02:10 2001
+++ talon/src/java/talon/HandleManager.java Fri Mar 9 16:10:43 2001
@@ -9,23 +9,29 @@
package talon;
+import java.io.*;
+import java.net.*;
import java.util.*;
-
-import talon.interfaces.*;
import talon.implementations.SimplePropertyManager;
+import talon.interfaces.*;
+import talon.util.net.*;
/**
* Responsible for keeping track of handles and providing methods for fetching
* them.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: HandleManager.java,v 1.3 2001/02/11 22:02:10 burton Exp $
+ * @version $Id: HandleManager.java,v 1.4 2001/03/10 00:10:43 burton Exp $
*/
-public class HandleManager {
+public class HandleManager extends BaseComponent {
private static SimplePropertyManager byName = new SimplePropertyManager();
private static SimplePropertyManager byInterface = new SimplePropertyManager();
private static SimplePropertyManager byImplementation = new SimplePropertyManager();
+
+
+ //required for Dumpable interface
+ public void init() throws TalonException { }
public static void registerComponentHandle( ComponentHandle handle ) {
@@ -57,7 +63,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.3 2001/02/11 22:02:10 burton Exp $
+ * @version $Id: HandleManager.java,v 1.4 2001/03/10 00:10:43 burton Exp $
*/
public static ComponentHandle byName( String _name )
throws TalonException {
@@ -77,7 +83,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.3 2001/02/11 22:02:10 burton Exp $
+ * @version $Id: HandleManager.java,v 1.4 2001/03/10 00:10:43 burton Exp $
*/
public static ComponentHandle byInterface( String _interface )
throws TalonException {
@@ -90,7 +96,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.3 2001/02/11 22:02:10 burton Exp $
+ * @version $Id: HandleManager.java,v 1.4 2001/03/10 00:10:43 burton Exp $
*/
public static ComponentHandle byImplementation( String _implementation )
throws TalonException {
@@ -109,10 +115,65 @@
* Get all registered components
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: HandleManager.java,v 1.3 2001/02/11 22:02:10 burton Exp $
+ * @version $Id: HandleManager.java,v 1.4 2001/03/10 00:10:43 burton Exp $
*/
public static PropertyManager getRegistry() {
return byName;
}
+
+ /**
+ * @see Dumpable
+ * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
+ * @version $Id: HandleManager.java,v 1.4 2001/03/10 00:10:43 burton Exp $
+ */
+ public static void dump() {
+ dump(System.out);
+ }
+
+
+ /**
+ * @see Dumpable
+ * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
+ * @version $Id: HandleManager.java,v 1.4 2001/03/10 00:10:43 burton Exp $
+ */
+ public static void dump( PrintStream ps ) {
+
+ ps.println( " --- BEGIN Dumping HandleManager --- ");
+
+ //dump byName
+ dump( ps, byName, "\n\n\n\tBY NAME\n\n\n");
+ //dump byInterface
+ dump( ps, byInterface, "\n\n\n\tBY INTERFACE\n\n\n");
+
+ //dump byImplementation
+ dump( ps, byImplementation, "\n\n\n\tBY IMPLEMENTATION\n\n\n");
+
+ ps.println( " --- END Dumping HandleManager --- ");
+ }
+
+ private static void dump( PrintStream ps, SimplePropertyManager spm, String name ) {
+
+ ps.println( name );
+
+ Enumeration keys = spm.getKeys();
+
+ while ( keys.hasMoreElements() ) {
+
+ Object key = keys.nextElement();
+
+ Object value = spm.getProperty( key.toString() );
+
+ ps.print( "\t\t" );
+ ps.print( key.toString() );
+ ps.print( "\t" );
+ ps.print( value.toString() );
+ ps.print( "\n" );
+
+ ((ComponentHandle)value).getInitProperties().dump( ps );
+
+ }
+
+ }
+
}
*****************************************************************
File: talon/src/java/talon/Initializer.java
CVSWEB Options: -------------------
CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/Initializer.java?annotate=1.7
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/Initializer.java?rev=1.7&content-type=text/x-cvsweb-markup
CVSWeb: Diff to previous version: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/Initializer.java.diff?r1=1.7&r2=1.6
-----------------------------------
Index: talon/src/java/talon/Initializer.java
diff -u talon/src/java/talon/Initializer.java:1.6 talon/src/java/talon/Initializer.java:1.7
--- talon/src/java/talon/Initializer.java:1.6 Sun Feb 11 14:02:10 2001
+++ talon/src/java/talon/Initializer.java Fri Mar 9 16:10:43 2001
@@ -18,7 +18,7 @@
* Handles intializing Talon and performing all startup procedures.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Initializer.java,v 1.6 2001/02/11 22:02:10 burton Exp $
+ * @version $Id: Initializer.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public class Initializer {
@@ -43,7 +43,7 @@
* Initialize Talon if necessary.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Initializer.java,v 1.6 2001/02/11 22:02:10 burton Exp $
+ * @version $Id: Initializer.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public static void init() {
@@ -89,11 +89,15 @@
while ( true ) {
- PropertyManager group = pm.getGroup( "talon.component." + i );
+ String group_name = "talon.component." + i;
+ PropertyManager group = pm.getGroup( group_name );
+
if ( group == null ) {
break;
}
+
+ logger.debug( "Building properties for: " + group_name );
//create the component handle
@@ -110,6 +114,9 @@
while ( keys.hasMoreElements() ) {
String name = (String)keys.nextElement();
String value = group.getString( name );
+
+ logger.debug( "\t" + name + " = " + value );
+
handle.getInitProperties().setProperty( name, value );
}
@@ -134,7 +141,7 @@
* Return true if Talon is initialized.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Initializer.java,v 1.6 2001/02/11 22:02:10 burton Exp $
+ * @version $Id: Initializer.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public static boolean isInitialized() {
return initialized;
@@ -144,7 +151,7 @@
* Return true if Talon is working.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Initializer.java,v 1.6 2001/02/11 22:02:10 burton Exp $
+ * @version $Id: Initializer.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public static boolean isWorking() {
return working;
@@ -154,7 +161,7 @@
* Return true if Talon should be initialized.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Initializer.java,v 1.6 2001/02/11 22:02:10 burton Exp $
+ * @version $Id: Initializer.java,v 1.7 2001/03/10 00:10:43 burton Exp $
*/
public static boolean shouldInitialize() {
return isWorking() == false && isInitialized() == false;
This archive was generated by hypermail 2b30 : Fri Mar 09 2001 - 16:11:15 PST