Update of /var/cvs/src/org/mmbase/storage In directory james.mmbase.org:/tmp/cvs-serv24305
Modified Files: StorageManagerFactory.java Log Message: See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/storage Index: StorageManagerFactory.java =================================================================== RCS file: /var/cvs/src/org/mmbase/storage/StorageManagerFactory.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -b -r1.35 -r1.36 --- StorageManagerFactory.java 19 Aug 2008 17:15:45 -0000 1.35 +++ StorageManagerFactory.java 19 Aug 2008 21:29:43 -0000 1.36 @@ -38,10 +38,11 @@ * * @author Pierre van Rooden * @since MMBase-1.7 - * @version $Id: StorageManagerFactory.java,v 1.35 2008/08/19 17:15:45 michiel Exp $ + * @version $Id: StorageManagerFactory.java,v 1.36 2008/08/19 21:29:43 michiel Exp $ */ public abstract class StorageManagerFactory<SM extends StorageManager> { + private static final Object NULL = new Object(); private static final Logger log = Logging.getLoggerInstance(StorageManagerFactory.class); /** @@ -387,7 +388,7 @@ */ public void setAttributes(Map<String, Object> attributes) { for (Map.Entry<String, Object> entry : attributes.entrySet()) { - setAttribute(entry.getKey(), entry.getKey()); + setAttribute(entry.getKey(), entry.getValue()); } log.debug("Database attributes " + this.attributes); } @@ -399,7 +400,9 @@ * @return the attribute value, or null if it is unknown */ public Object getAttribute(String key) { - return attributes.get(key); + Object o = attributes.get(key); + if (o == NULL) o = null; + return o; } /** @@ -411,7 +414,7 @@ * @param value the value of the attribute */ public void setAttribute(String key, Object value) { - if (value == null) value = ""; + if (value == null) value = NULL; attributes.put(key, value); } @@ -436,6 +439,8 @@ * @return the scheme value, <code>null</code> if there is no scheme */ public Scheme getScheme(String key, String defaultPattern) { + Object o = getAttribute(key); + if (o!= null && ! (o instanceof Scheme)) throw new RuntimeException("value of " + key + " is not a Schema, but " + (o == null ? "NuLL" : o.getClass()) + " " + o); Scheme scheme = (Scheme) getAttribute(key); if (scheme == null && defaultPattern != null) { if (attributes.containsKey(key)) return null; @@ -456,7 +461,7 @@ if (pattern == null || pattern.equals("")) { setAttribute(key, null); } else { - setAttribute(key, new Scheme(this,pattern)); + setAttribute(key, new Scheme(this, pattern)); } } _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs