CVS update: talon/src/java/talon

From: cvs@openprivacy.org
Date: Tue Jan 16 2001 - 08:06:30 PST


Date: Tuesday January 16, 19101 @ 8:06
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/cvsroot/talon/src/java/talon
In directory openprivacy.org:/tmp/cvs-serv18519/src/java/talon

Modified Files:
        BaseComponent.java Component.java ComponentFactory.java
        ComponentHandle.java
Log Message:
Impl of a basic Logger interface... stolen from Turbine/jEdit/Jetspeed

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

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

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

Index: talon/src/java/talon/BaseComponent.java
diff -u talon/src/java/talon/BaseComponent.java:1.1 talon/src/java/talon/BaseComponent.java:1.2
--- talon/src/java/talon/BaseComponent.java:1.1 Tue Jan 16 02:42:32 2001
+++ talon/src/java/talon/BaseComponent.java Tue Jan 16 08:06:29 2001
@@ -11,11 +11,14 @@
 
 import java.util.*;
 
+import talon.interfaces.*;
+import talon.implementations.*;
+
 /**
  *
  *
  * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BaseComponent.java,v 1.1 2001/01/16 10:42:32 burton Exp $
+ * @version $Id: BaseComponent.java,v 1.2 2001/01/16 16:06:29 burton Exp $
  */
 public abstract class BaseComponent implements Component {
 
@@ -25,7 +28,7 @@
     /**
      * @see Component
      * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BaseComponent.java,v 1.1 2001/01/16 10:42:32 burton Exp $
+ * @version $Id: BaseComponent.java,v 1.2 2001/01/16 16:06:29 burton Exp $
      */
     public ComponentHandle getComponentHandle() {
         return this.handle;
@@ -34,12 +37,11 @@
     /**
      * @see Component
      * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BaseComponent.java,v 1.1 2001/01/16 10:42:32 burton Exp $
+ * @version $Id: BaseComponent.java,v 1.2 2001/01/16 16:06:29 burton Exp $
      */
     public void setComponentHandle( ComponentHandle handle ) {
         this.handle = handle;
     }
-
     
 }
 

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

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

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

Index: talon/src/java/talon/Component.java
diff -u talon/src/java/talon/Component.java:1.1 talon/src/java/talon/Component.java:1.2
--- talon/src/java/talon/Component.java:1.1 Tue Jan 16 02:42:32 2001
+++ talon/src/java/talon/Component.java Tue Jan 16 08:06:29 2001
@@ -12,11 +12,14 @@
 
 import java.util.*;
 
+//import talon.interfaces.*;
+//import talon.implementations.*;
+
 /**
  *
  *
  * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: Component.java,v 1.1 2001/01/16 10:42:32 burton Exp $
+ * @version $Id: Component.java,v 1.2 2001/01/16 16:06:29 burton Exp $
  */
 public interface Component {
 
@@ -25,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.1 2001/01/16 10:42:32 burton Exp $
+ * @version $Id: Component.java,v 1.2 2001/01/16 16:06:29 burton Exp $
      */
     public void init() throws TalonException;
 
@@ -34,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.1 2001/01/16 10:42:32 burton Exp $
+ * @version $Id: Component.java,v 1.2 2001/01/16 16:06:29 burton Exp $
      */
     public ComponentHandle getComponentHandle();
 
@@ -42,7 +45,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.1 2001/01/16 10:42:32 burton Exp $
+ * @version $Id: Component.java,v 1.2 2001/01/16 16:06:29 burton Exp $
      */
     public void setComponentHandle( ComponentHandle handle );
     

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

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

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

Index: talon/src/java/talon/ComponentFactory.java
diff -u talon/src/java/talon/ComponentFactory.java:1.1 talon/src/java/talon/ComponentFactory.java:1.2
--- talon/src/java/talon/ComponentFactory.java:1.1 Tue Jan 16 02:42:32 2001
+++ talon/src/java/talon/ComponentFactory.java Tue Jan 16 08:06:29 2001
@@ -15,7 +15,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.1 2001/01/16 10:42:32 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.2 2001/01/16 16:06:29 burton Exp $
  */
 public class ComponentFactory {
 
@@ -33,13 +33,17 @@
      * Given a ComponentHandle get a Component
      *
      * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentFactory.java,v 1.1 2001/01/16 10:42:32 burton Exp $
+ * @version $Id: ComponentFactory.java,v 1.2 2001/01/16 16:06:29 burton Exp $
      */
     public static Component getInstance( ComponentHandle handle )
- throws NotFoundException {
+ throws TalonException {
 
         //FIXME: only smart enough to use Singletons :(
 
+ //FIXME: if the component we fetch isn't the correct implementation of
+ //the given interface... throw an Exception because the resulting object
+ //won't be able to be (cast) and the application will get a RuntimeException
+
         try {
         
             Component comp = (Component)singletons.get( handle );

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

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

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

Index: talon/src/java/talon/ComponentHandle.java
diff -u talon/src/java/talon/ComponentHandle.java:1.1 talon/src/java/talon/ComponentHandle.java:1.2
--- talon/src/java/talon/ComponentHandle.java:1.1 Tue Jan 16 02:42:32 2001
+++ talon/src/java/talon/ComponentHandle.java Tue Jan 16 08:06:29 2001
@@ -11,11 +11,14 @@
 
 import java.util.*;
 
+import talon.interfaces.*;
+import talon.implementations.*;
+
 /**
  *
  *
  * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: ComponentHandle.java,v 1.1 2001/01/16 10:42:32 burton Exp $
+ * @version $Id: ComponentHandle.java,v 1.2 2001/01/16 16:06:29 burton Exp $
  */
 public class ComponentHandle {
 
@@ -23,8 +26,9 @@
     private String interfaceClassname = null;
 
     private String implementationClassname = null;
-
 
+ private PropertyManager initProperties = new SimplePropertyManager();
+
     /**
      * Support for named components. Handles can have names that are each
      * different from each other. This means you could have say multiple
@@ -33,13 +37,7 @@
      */
     private String name = null;
     
-
- /**
- Parameters for this component.
- */
- private Hashtable params = new Hashtable();
-
-
+
     public ComponentHandle( String interfaceClassname ) {
 
         this.interfaceClassname = interfaceClassname;
@@ -87,75 +85,6 @@
     }
 
     /**
- * Retrieve a parameter.
- *
- * @param name the name of parameter
- * @return the value of parameter
- */
- public String getInitParameter( String name ) {
- return (String)this.params.get( name );
- }
-
- /**
- * Retrieve a parameter, throwing an Exception if it is not present.
- *
- * @param name the name of parameter
- * @return the value of parameter
- */
- public String getInitParameter( String name, boolean required ) throws TalonException {
-
- String v = (String)this.params.get( name );
-
- if ( v == null && required ) {
- throw new TalonException( "Property not defined for component: " +
- this.getInterfaceClassname() +
- " parameter: " +
- name );
- }
-
- return v;
- }
-
-
- /**
- * Retrieve a parameter.
- *
- * @param name the name of parameter
- * @param value the default value if no init parameter is set
- * @return the value of parameter
- */
- public String getInitParameter( String name, String value ) {
-
- String v = (String)this.params.get( name );
-
- if ( v == null) {
- v = value;
- }
-
- return v;
- }
-
- /**
- * Set a parameter.
- *
- * @param name the name of parameter
- * @param value the default value if no init parameter is set
- * @return the value of parameter
- */
- public void setInitParameter( String name, String value ) {
- this.params.put( name, value );
- }
-
- /**
- * Retrieve an enumeration of all parameter names.
- *
- * @return the enumeration of parameter names
- */
- public Enumeration getInitParameterNames() {
- return this.params.keys();
- }
-
- /**
      * Get the name for this component.
      */
     public String getName() {
@@ -169,4 +98,15 @@
         this.name = name;
     }
 
+ /**
+ * @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 $
+ */
+ public PropertyManager getInitProperties() {
+ return this.initProperties;
+ }
+
+
+
 }



This archive was generated by hypermail 2b30 : Mon Jan 22 2001 - 15:52:15 PST