CVS update: talon/src/java/talon

From: cvs@openprivacy.org
Date: Thu Jan 25 2001 - 11:05:17 PST

  • Next message: cvs@openprivacy.org: "CVS update: talon/src/java/talon/interfaces"

    Date: Thursday January 25, 19101 @ 11:05
    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-serv7002/src/java/talon

    Modified Files:
            BaseComponent.java Component.java ComponentFactory.java
            ComponentHandle.java
    Log Message:
    logger and property manager now being used... required for CompositeRCE

    *****************************************************************
    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.3

    CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/BaseComponent.java?rev=1.3&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.3&r2=1.2

    -----------------------------------

    Index: talon/src/java/talon/BaseComponent.java
    diff -u talon/src/java/talon/BaseComponent.java:1.2 talon/src/java/talon/BaseComponent.java:1.3
    --- talon/src/java/talon/BaseComponent.java:1.2 Tue Jan 16 08:06:29 2001
    +++ talon/src/java/talon/BaseComponent.java Thu Jan 25 11:05:17 2001
    @@ -18,7 +18,7 @@
      *
      *
      * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    - * @version $Id: BaseComponent.java,v 1.2 2001/01/16 16:06:29 burton Exp $
    + * @version $Id: BaseComponent.java,v 1.3 2001/01/25 19:05:17 burton Exp $
      */
     public abstract class BaseComponent implements Component {
     
    @@ -28,19 +28,47 @@
         /**
          * @see Component
          * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    - * @version $Id: BaseComponent.java,v 1.2 2001/01/16 16:06:29 burton Exp $
    + * @version $Id: BaseComponent.java,v 1.3 2001/01/25 19:05:17 burton Exp $
          */
         public ComponentHandle getComponentHandle() {
             return this.handle;
         }
    -
    +
         /**
          * @see Component
          * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    - * @version $Id: BaseComponent.java,v 1.2 2001/01/16 16:06:29 burton Exp $
    + * @version $Id: BaseComponent.java,v 1.3 2001/01/25 19:05:17 burton Exp $
          */
         public void setComponentHandle( ComponentHandle handle ) {
             this.handle = handle;
    + }
    +
    + /**
    + * @see Component
    + * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    + * @version $Id: BaseComponent.java,v 1.3 2001/01/25 19:05:17 burton Exp $
    + */
    + public Logger getLogger() {
    + try {
    + return (Logger)ComponentFactory
    + .getInstance( ComponentFactory.TALON_DEFAULT_LOGGER );
    + } catch ( TalonException t ) {
    + //if this throws an Exception we have big problems caused by Talon
    + // not being initialized. It isn't amazingly important that we
    + // handle this because Talon will likely terminate itself.
    + t.printStackTrace();
    + return null;
    + }
    + }
    +
    + /**
    + * 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.3 2001/01/25 19:05:17 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.3

    CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/Component.java?rev=1.3&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.3&r2=1.2

    -----------------------------------

    Index: talon/src/java/talon/Component.java
    diff -u talon/src/java/talon/Component.java:1.2 talon/src/java/talon/Component.java:1.3
    --- talon/src/java/talon/Component.java:1.2 Tue Jan 16 08:06:29 2001
    +++ talon/src/java/talon/Component.java Thu Jan 25 11:05:17 2001
    @@ -12,14 +12,14 @@
     
     import java.util.*;
     
    -//import talon.interfaces.*;
    +import talon.interfaces.*;
     //import talon.implementations.*;
     
     /**
      *
      *
      * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    - * @version $Id: Component.java,v 1.2 2001/01/16 16:06:29 burton Exp $
    + * @version $Id: Component.java,v 1.3 2001/01/25 19:05:17 burton Exp $
      */
     public interface Component {
     
    @@ -28,7 +28,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.2 2001/01/16 16:06:29 burton Exp $
    + * @version $Id: Component.java,v 1.3 2001/01/25 19:05:17 burton Exp $
          */
         public void init() throws TalonException;
     
    @@ -37,7 +37,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.2 2001/01/16 16:06:29 burton Exp $
    + * @version $Id: Component.java,v 1.3 2001/01/25 19:05:17 burton Exp $
          */
         public ComponentHandle getComponentHandle();
     
    @@ -45,9 +45,17 @@
          * Set the handle for this component.
          *
          * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    - * @version $Id: Component.java,v 1.2 2001/01/16 16:06:29 burton Exp $
    + * @version $Id: Component.java,v 1.3 2001/01/25 19:05:17 burton Exp $
          */
         public void setComponentHandle( ComponentHandle handle );
    +
    + /**
    + * Get the Talon default log stream for this component.
    + *
    + * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    + * @version $Id: Component.java,v 1.3 2001/01/25 19:05:17 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.3

    CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/ComponentFactory.java?rev=1.3&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.3&r2=1.2

    -----------------------------------

    Index: talon/src/java/talon/ComponentFactory.java
    diff -u talon/src/java/talon/ComponentFactory.java:1.2 talon/src/java/talon/ComponentFactory.java:1.3
    --- talon/src/java/talon/ComponentFactory.java:1.2 Tue Jan 16 08:06:29 2001
    +++ talon/src/java/talon/ComponentFactory.java Thu Jan 25 11:05:17 2001
    @@ -11,33 +11,77 @@
     
     import java.util.*;
     
    +import talon.implementations.*;
    +
     /**
      * 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.2 2001/01/16 16:06:29 burton Exp $
    + * @version $Id: ComponentFactory.java,v 1.3 2001/01/25 19:05:17 burton Exp $
      */
     public class ComponentFactory {
    +
    + // **************************************
    + // BEGIN DEFAULT TALON COMPONENTS
    + // **************************************
    +
    + public static final ComponentHandle TALON_DEFAULT_LOGGER =
    + new ComponentHandle( "TALON_DEFAULT_LOGGER",
    + "talon.interfaces.Logger",
    + "talon.implementations.SimpleLogger",
    + new SimplePropertyManager().setProperty( "project", "talon" ) );
    +
    +
    + public static final ComponentHandle TALON_DEFAULT_PROPERTY_MANAGER =
    + new ComponentHandle( "TALON_DEFAULT_PROPERTY_MANAGER",
    + "talon.interfaces.PropertyManager",
    + "talon.implementations.SimplePropertyManager",
    + new SimplePropertyManager().setProperty( "project", "talon" ) );
    +
    + // **************************************
    + // END DEFAULT TALON COMPONENTS
    + // **************************************
     
    + /**
    + Logger implementation.
    + */
         public static final ComponentHandle LOGGER_INTERFACE_KEY =
             new ComponentHandle( "talon.interfaces.Logger" );
     
    + /**
    + PropertyManager implementation.
    + */
         public static final ComponentHandle PROPERTY_MANAGER_INTERFACE_KEY =
             new ComponentHandle( "talon.interfaces.PropertyManager" );
     
     
         private static Hashtable singletons = new Hashtable();
     
    + /**
    + * Static initializer...
    + *
    + * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    + * @version $Id: ComponentFactory.java,v 1.3 2001/01/25 19:05:17 burton Exp $
    + */
    + static {
    +
    + //init if necessary.
    + //Initializer.init();
     
    + }
    +
    +
         /**
          * Given a ComponentHandle get a Component
          *
          * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    - * @version $Id: ComponentFactory.java,v 1.2 2001/01/16 16:06:29 burton Exp $
    + * @version $Id: ComponentFactory.java,v 1.3 2001/01/25 19:05:17 burton Exp $
          */
         public static Component getInstance( ComponentHandle handle )
             throws TalonException {
     
    + Initializer.init();
    +
             //FIXME: only smart enough to use Singletons :(
     
             //FIXME: if the component we fetch isn't the correct implementation of
    @@ -55,10 +99,9 @@
                     comp.setComponentHandle( handle );
                     comp.init();
     
    - singletons.put( handle, comp );
    -
    + putSingleton( handle, comp );
                 }
    -
    +
                 return comp;
     
             } catch ( Throwable t ) {
    @@ -66,6 +109,14 @@
             }
         }
     
    -
    + /**
    + * 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.3 2001/01/25 19:05:17 burton Exp $
    + */
    + static void putSingleton( ComponentHandle handle, Component comp ) {
    + singletons.put( handle, comp );
    + }
         
     }

    *****************************************************************
    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.3

    CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/ComponentHandle.java?rev=1.3&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.3&r2=1.2

    -----------------------------------

    Index: talon/src/java/talon/ComponentHandle.java
    diff -u talon/src/java/talon/ComponentHandle.java:1.2 talon/src/java/talon/ComponentHandle.java:1.3
    --- talon/src/java/talon/ComponentHandle.java:1.2 Tue Jan 16 08:06:29 2001
    +++ talon/src/java/talon/ComponentHandle.java Thu Jan 25 11:05:17 2001
    @@ -18,7 +18,7 @@
      *
      *
      * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    - * @version $Id: ComponentHandle.java,v 1.2 2001/01/16 16:06:29 burton Exp $
    + * @version $Id: ComponentHandle.java,v 1.3 2001/01/25 19:05:17 burton Exp $
      */
     public class ComponentHandle {
     
    @@ -37,20 +37,65 @@
          */
         private String name = null;
         
    -
    + /**
    + * ComponentHandle with just an interface. The classname to instantiate is
    + * pulled from the Talon properties.
    + *
    + * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    + * @version $Id: ComponentHandle.java,v 1.3 2001/01/25 19:05:17 burton Exp $
    + */
         public ComponentHandle( String interfaceClassname ) {
     
             this.interfaceClassname = interfaceClassname;
    -
    +
         }
     
    + /**
    + * The interface and classname.
    + *
    + * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    + * @version $Id: ComponentHandle.java,v 1.3 2001/01/25 19:05:17 burton Exp $
    + */
         public ComponentHandle( String interfaceClassname,
                                 String implementationClassname ) {
     
    - this.interfaceClassname = interfaceClassname;
    + this( interfaceClassname );
             this.implementationClassname = implementationClassname;
    +
    + }
    +
    +
    + /**
    + * 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.3 2001/01/25 19:05:17 burton Exp $
    + */
    + public ComponentHandle( String interfaceClassname,
    + String implementationClassname,
    + PropertyManager initProperties ) {
    +
    + this( interfaceClassname, implementationClassname );
    + this.initProperties = initProperties;
         }
     
    + /**
    + * 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.3 2001/01/25 19:05:17 burton Exp $
    + */
    + public ComponentHandle( String name,
    + String interfaceClassname,
    + String implementationClassname,
    + PropertyManager initProperties ) {
    +
    + this( interfaceClassname, implementationClassname, initProperties );
    + this.setName( name );
    + }
    +
    +
         
         /**
          * Get the value of interfaceClassname.
    @@ -101,12 +146,20 @@
         /**
          * @see Component
          * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    - * @version $Id: ComponentHandle.java,v 1.2 2001/01/16 16:06:29 burton Exp $
    + * @version $Id: ComponentHandle.java,v 1.3 2001/01/25 19:05:17 burton Exp $
          */
         public PropertyManager getInitProperties() {
             return this.initProperties;
         }
     
    -
    + /**
    + * Dump Handle information..
    + *
    + * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
    + * @version $Id: ComponentHandle.java,v 1.3 2001/01/25 19:05:17 burton Exp $
    + */
    + public String toString() {
    + return name + ":" + this.getInterfaceClassname() + " -> " + this.getImplementationClassname();
    + }
         
     }



    This archive was generated by hypermail 2b30 : Thu Jan 25 2001 - 11:05:49 PST