From: cvs@openprivacy.orgCVS update: talon/src/java/talon/util
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/util
-----------------------------------
Update of /usr/local/cvs/public/talon/src/java/talon/util
In directory giga:/tmp/cvs-serv19426/src/java/talon/util
Modified Files:
BasePropertyManager.java
Log Message:
now we can't have duplicate property names
*****************************************************************
File: talon/src/java/talon/util/BasePropertyManager.java
CVSWEB Options: -------------------
CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/util/BasePropertyManager.java?annotate=1.8
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/util/BasePropertyManager.java?rev=1.8&content-type=text/x-cvsweb-markup
CVSWeb: Diff to previous version: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/talon/src/java/talon/util/BasePropertyManager.java.diff?r1=1.8&r2=1.7
-----------------------------------
Index: talon/src/java/talon/util/BasePropertyManager.java
diff -u talon/src/java/talon/util/BasePropertyManager.java:1.7 talon/src/java/talon/util/BasePropertyManager.java:1.8
--- talon/src/java/talon/util/BasePropertyManager.java:1.7 Fri Mar 9 16:10:44 2001
+++ talon/src/java/talon/util/BasePropertyManager.java Sun Mar 11 01:21:43 2001
@@ -15,13 +15,14 @@
import talon.*;
import talon.interfaces.*;
+import talon.interfaces.exceptions.*;
import talon.implementations.*;
/**
* Base class for handling properties.
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public abstract class BasePropertyManager extends BaseComponent implements Component, PropertyManager {
@@ -30,7 +31,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public Object getProperty( String name ) {
return this.props.get( name );
@@ -39,7 +40,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public Object getProperty( String name, Object _default ) {
@@ -55,7 +56,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public boolean getBoolean( String name ) {
String value = getString( name );
@@ -73,7 +74,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public PropertyManager setBoolean( String name, boolean value ) {
@@ -89,7 +90,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public PropertyManager setString( String name, String value ) {
setProperty( name, value );
@@ -99,7 +100,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public String getString( String name ) {
return (String)getProperty( name );
@@ -109,7 +110,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public String getString( String _name, String _default ) {
@@ -127,7 +128,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public Vector getVector( String name ) {
@@ -154,7 +155,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public PropertyManager getGroup( String key ) {
@@ -195,7 +196,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public PropertyManager setProperty( String name, Object value ) {
@@ -211,7 +212,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public Enumeration getKeys() {
return this.props.keys();
@@ -220,7 +221,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public void setProperties( Properties props ) {
this.props = props;
@@ -229,13 +230,15 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
- public void require( String[] properties ) throws TalonException {
+ public void require( String[] requirements ) throws RequiredPropertyException {
- for ( int i = 0; i < properties.length; ++i ) {
- if ( ! this.exists( properties[i] ) ) {
- throw new TalonException( "The required property for this component does not exist: " + properties[i] );
+ this.dump(); //FIXME
+
+ for ( int i = 0; i < requirements.length; ++i ) {
+ if ( ! this.props.containsKey( requirements[i] ) ) {
+ throw new RequiredPropertyException( "The required property for this component does not exist: " + requirements[i] );
}
}
@@ -244,17 +247,29 @@
/**
* @see PropertyManager
+ * @see Hashtable
+ * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
+ */
+ public boolean containsKey( String key ) {
+ return props.containsKey( key );
+ }
+
+ /**
+ * @see PropertyManager
+ * @see Hashtable
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
- public boolean exists( String key ) {
- return props.get( key ) != null;
+ public boolean contains( Object object ) {
+ return props.containsKey( object );
}
+
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public void dump() {
dump( System.out );
@@ -263,7 +278,7 @@
/**
* @see PropertyManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
public void dump( PrintStream ps) {
@@ -272,7 +287,7 @@
/**
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: BasePropertyManager.java,v 1.7 2001/03/10 00:10:44 burton Exp $
+ * @version $Id: BasePropertyManager.java,v 1.8 2001/03/11 09:21:43 burton Exp $
*/
private String getPrettyPrint() {
This archive was generated by hypermail 2b30 : Sun Mar 11 2001 - 01:23:15 PST