From: cvs@openprivacy.orgCVS update: talon/src/java/talon
Date: Sunday March 11, 19101 @ 1:21
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-serv19426/src/java/talon
Modified Files:
HandleManager.java
Log Message:
now we can't have duplicate property names
*****************************************************************
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.5
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/HandleManager.java?rev=1.5&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.5&r2=1.4
-----------------------------------
Index: talon/src/java/talon/HandleManager.java
diff -u talon/src/java/talon/HandleManager.java:1.4 talon/src/java/talon/HandleManager.java:1.5
--- talon/src/java/talon/HandleManager.java:1.4 Fri Mar 9 16:10:43 2001
+++ talon/src/java/talon/HandleManager.java Sun Mar 11 01:21:42 2001
@@ -21,7 +21,7 @@
* them.
*
* @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 $
+ * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
*/
public class HandleManager extends BaseComponent {
@@ -33,7 +33,7 @@
//required for Dumpable interface
public void init() throws TalonException { }
- public static void registerComponentHandle( ComponentHandle handle ) {
+ public static void registerComponentHandle( ComponentHandle handle ) throws TalonException {
Logger logger = ComponentFactory.getLogger();
@@ -42,28 +42,48 @@
//register by name...
if ( handle.getName() != null ) {
logger.message( "registering handle (byName):" + handle.toString() );
- byName.setProperty( handle.getName(), handle );
+
+ registerComponentHandle( byName, handle.getName(), handle );
}
//register by interface
if ( handle.getInterface() != null ) {
logger.message( "registering handle (byInterface):" + handle.toString() );
- byInterface.setProperty( handle.getInterface(), handle );
+ registerComponentHandle( byInterface, handle.getInterface(), handle );
}
//register by implementation
if ( handle.getImplementation() != null ) {
logger.message( "registering handle (byImplementation):" + handle.toString() );
- byImplementation.setProperty( handle.getImplementation(), handle );
+ registerComponentHandle( byImplementation, handle.getImplementation(), handle );
}
}
/**
+ * 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 $
+ */
+ private static void registerComponentHandle( SimplePropertyManager manager,
+ String key,
+ ComponentHandle handle )
+ throws TalonException {
+
+ if ( manager.contains( key ) ) {
+ throw new TalonException( "HandleManager already contains this component: " + handle.toString() );
+ } else {
+ manager.setProperty( key, handle );
+ }
+
+ }
+
+ /**
* Get a handle by its name
*
* @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 $
+ * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
*/
public static ComponentHandle byName( String _name )
throws TalonException {
@@ -83,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.4 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
*/
public static ComponentHandle byInterface( String _interface )
throws TalonException {
@@ -96,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.4 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
*/
public static ComponentHandle byImplementation( String _implementation )
throws TalonException {
@@ -115,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.4 2001/03/10 00:10:43 burton Exp $
+ * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
*/
public static PropertyManager getRegistry() {
return byName;
@@ -124,7 +144,7 @@
/**
* @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 $
+ * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
*/
public static void dump() {
dump(System.out);
@@ -134,7 +154,7 @@
/**
* @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 $
+ * @version $Id: HandleManager.java,v 1.5 2001/03/11 09:21:42 burton Exp $
*/
public static void dump( PrintStream ps ) {
This archive was generated by hypermail 2b30 : Sun Mar 11 2001 - 01:21:47 PST