jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r468427 - in /jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr: WorkspaceResourceImpl.java property/NamespacesProperty.java
Date Fri, 27 Oct 2006 15:50:14 GMT
Author: mreutegg
Date: Fri Oct 27 08:50:13 2006
New Revision: 468427

URL: http://svn.apache.org/viewvc?view=rev&rev=468427
Log:
- use Map instead of Properties

Modified:
    jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java
    jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/property/NamespacesProperty.java

Modified: jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java?view=diff&rev=468427&r1=468426&r2=468427
==============================================================================
--- jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java
(original)
+++ jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java
Fri Oct 27 08:50:13 2006
@@ -51,11 +51,12 @@
 import javax.jcr.Session;
 import javax.jcr.version.Version;
 import javax.jcr.observation.EventListener;
-import java.util.Properties;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
 import java.io.IOException;
 
 /**
@@ -209,7 +210,7 @@
         if (ItemResourceConstants.JCR_NAMESPACES.equals(property.getName())) {
             NamespacesProperty nsp = new NamespacesProperty(property);
             try {
-                Properties changes = nsp.getNamespaces();
+                Map changes = new HashMap(nsp.getNamespaces());
                 NamespaceRegistry nsReg = getRepositorySession().getWorkspace().getNamespaceRegistry();
                 String[] registeredPrefixes = nsReg.getPrefixes();
                 for (int i = 0; i < registeredPrefixes.length; i++) {

Modified: jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/property/NamespacesProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/property/NamespacesProperty.java?view=diff&rev=468427&r1=468426&r2=468427
==============================================================================
--- jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/property/NamespacesProperty.java
(original)
+++ jackrabbit/trunk/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/property/NamespacesProperty.java
Fri Oct 27 08:50:13 2006
@@ -30,10 +30,11 @@
 
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.RepositoryException;
-import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
 
 /**
  * <code>NamespacesProperty</code>...
@@ -42,19 +43,19 @@
 
     private static Logger log = LoggerFactory.getLogger(NamespacesProperty.class);
 
-    private final Properties value = new Properties();
+    private final Map value = new HashMap();
 
     public NamespacesProperty(NamespaceRegistry nsReg) throws RepositoryException {
         super(JCR_NAMESPACES, false);
         if (nsReg != null) {
             String[] prefixes = nsReg.getPrefixes();
             for (int i = 0; i < prefixes.length; i++) {
-                value.setProperty(prefixes[i], nsReg.getURI(prefixes[i]));
+                value.put(prefixes[i], nsReg.getURI(prefixes[i]));
             }
         }
     }
 
-    public NamespacesProperty(Properties namespaces) {
+    public NamespacesProperty(Map namespaces) {
         super(JCR_NAMESPACES, false);
         value.putAll(namespaces);
     }
@@ -78,18 +79,18 @@
                     String prefix = DomUtil.getText(pElem, Namespace.EMPTY_NAMESPACE.getPrefix());
                     Element uElem = DomUtil.getChildElement(e, XML_URI, ItemResourceConstants.NAMESPACE);
                     String uri = DomUtil.getText(uElem, Namespace.EMPTY_NAMESPACE.getURI());
-                    value.setProperty(prefix, uri);
+                    value.put(prefix, uri);
                 }
             }
         }
     }
 
-    public Properties getNamespaces() {
-        return value;
+    public Map getNamespaces() {
+        return Collections.unmodifiableMap(value);
     }
 
     public Object getValue() {
-        return value;
+        return Collections.unmodifiableMap(value);
     }
 
     /**
@@ -97,10 +98,10 @@
      */
     public Element toXml(Document document) {
         Element elem = getName().toXml(document);
-        Enumeration prefixes = value.propertyNames();
-        while (prefixes.hasMoreElements()) {
-            String prefix = (String)prefixes.nextElement();
-            String uri = value.getProperty(prefix);
+        Iterator prefixes = value.keySet().iterator();
+        while (prefixes.hasNext()) {
+            String prefix = (String) prefixes.next();
+            String uri = (String) value.get(prefix);
             Element nsElem = DomUtil.addChildElement(elem, XML_NAMESPACE, ItemResourceConstants.NAMESPACE);
             DomUtil.addChildElement(nsElem, XML_PREFIX, ItemResourceConstants.NAMESPACE,
prefix);
             DomUtil.addChildElement(nsElem, XML_URI, ItemResourceConstants.NAMESPACE, uri);



Mime
View raw message