You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by sg...@apache.org on 2001/05/01 19:35:22 UTC
cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/util SingletonHolder.java
sgala 01/05/01 10:35:22
Modified: src/java/org/apache/jetspeed/util SingletonHolder.java
Log:
Change suggested by Chris Kimpton, to overcome problem in
JDK implementation. It would be better to have a SingletonHolder
that does NOT extend Properties.
I don't really understand the purpose of this extension, also.
Revision Changes Path
1.8 +21 -9 jakarta-jetspeed/src/java/org/apache/jetspeed/util/SingletonHolder.java
Index: SingletonHolder.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/SingletonHolder.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SingletonHolder.java 2001/03/07 06:50:05 1.7
+++ SingletonHolder.java 2001/05/01 17:35:20 1.8
@@ -76,7 +76,7 @@
</p>
@author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- @version $Id: SingletonHolder.java,v 1.7 2001/03/07 06:50:05 taylor Exp $
+ @version $Id: SingletonHolder.java,v 1.8 2001/05/01 17:35:20 sgala Exp $
*/
public class SingletonHolder {
@@ -84,7 +84,7 @@
* Place a Singleton in the holder
*
* @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: SingletonHolder.java,v 1.7 2001/03/07 06:50:05 taylor Exp $
+ * @version $Id: SingletonHolder.java,v 1.8 2001/05/01 17:35:20 sgala Exp $
*/
public static void put( Singleton singleton ) {
if ( singleton.getSingletonHandle() == null ) {
@@ -105,7 +105,7 @@
* Get a Singleton from the holder
*
* @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: SingletonHolder.java,v 1.7 2001/03/07 06:50:05 taylor Exp $
+ * @version $Id: SingletonHolder.java,v 1.8 2001/05/01 17:35:20 sgala Exp $
*/
public static Singleton get( String handle ) {
@@ -132,7 +132,7 @@
* Return true if this handle is in the SingletonHolder
*
* @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: SingletonHolder.java,v 1.7 2001/03/07 06:50:05 taylor Exp $
+ * @version $Id: SingletonHolder.java,v 1.8 2001/05/01 17:35:20 sgala Exp $
*/
public static boolean isHolding( String handle ) {
return PropertyHolder.getInstance().get( handle ) != null;
@@ -146,7 +146,7 @@
*
*
* @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: SingletonHolder.java,v 1.7 2001/03/07 06:50:05 taylor Exp $
+ * @version $Id: SingletonHolder.java,v 1.8 2001/05/01 17:35:20 sgala Exp $
*/
class PropertyHolder extends Properties {
@@ -161,7 +161,7 @@
*
*
* @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: SingletonHolder.java,v 1.7 2001/03/07 06:50:05 taylor Exp $
+ * @version $Id: SingletonHolder.java,v 1.8 2001/05/01 17:35:20 sgala Exp $
*/
private PropertyHolder() {
@@ -176,7 +176,7 @@
* Get and instance of the property holder.
*
* @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: SingletonHolder.java,v 1.7 2001/03/07 06:50:05 taylor Exp $
+ * @version $Id: SingletonHolder.java,v 1.8 2001/05/01 17:35:20 sgala Exp $
*/
public static PropertyHolder getInstance() {
@@ -196,7 +196,7 @@
* then go ahead and return it. If not return it from my store.
*
* @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: SingletonHolder.java,v 1.7 2001/03/07 06:50:05 taylor Exp $
+ * @version $Id: SingletonHolder.java,v 1.8 2001/05/01 17:35:20 sgala Exp $
*/
public Object get( Object key ) {
@@ -210,11 +210,23 @@
}
+ /** HACK TO GET ROUND JDK BUG.
+ * until the Properties.getProperty version of this
+ * method is fixed to not use super.get, this can then be removed
+ **/
+ public String getProperty(String key) {
+ Object oval = get(key);
+ String sval = (oval instanceof String) ? (String)oval : null;
+ return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval;
+ }
+
+
+
/**
* Get an object form the PropertyHolder.
*
* @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: SingletonHolder.java,v 1.7 2001/03/07 06:50:05 taylor Exp $
+ * @version $Id: SingletonHolder.java,v 1.8 2001/05/01 17:35:20 sgala Exp $
*/
public Object put( Object key, Object object ) {
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org