jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r468429 - in /jackrabbit/trunk/contrib/spi: jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/ spi/src/main/java/org/apache/jackrabbit/spi/ spi2dav/src/main/java/org/apache/jackrab...
Date Fri, 27 Oct 2006 15:51:42 GMT
Author: mreutegg
Date: Fri Oct 27 08:51:42 2006
New Revision: 468429

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

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java
    jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
    jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NamespaceResolverImpl.java
    jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java?view=diff&rev=468429&r1=468428&r2=468429
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
Fri Oct 27 08:51:42 2006
@@ -28,7 +28,7 @@
 import javax.jcr.Credentials;
 import javax.jcr.LoginException;
 import javax.jcr.NoSuchWorkspaceException;
-import java.util.Properties;
+import java.util.Map;
 
 /**
  * <code>RepositoryImpl</code>...
@@ -39,7 +39,7 @@
 
     // configuration of the repository
     private final RepositoryConfig config;
-    private final Properties descriptors;
+    private final Map descriptors;
 
     private RepositoryImpl(RepositoryConfig config) throws RepositoryException {
         this.config = config;
@@ -63,7 +63,7 @@
      * @see Repository#getDescriptor(String)
      */
     public String getDescriptor(String descriptorKey) {
-	return descriptors.getProperty(descriptorKey);
+	return (String) descriptors.get(descriptorKey);
     }
 
     /**

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?view=diff&rev=468429&r1=468428&r2=468429
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
Fri Oct 27 08:51:42 2006
@@ -98,10 +98,10 @@
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.Properties;
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collection;
+import java.util.Map;
 import java.io.InputStream;
 
 /**
@@ -149,7 +149,7 @@
 
         cache = createItemStateManager();
 
-        Properties repositoryDescriptors = service.getRepositoryDescriptors();
+        Map repositoryDescriptors = service.getRepositoryDescriptors();
 
         nsRegistry = createNamespaceRegistry(repositoryDescriptors);
         ntRegistry = createNodeTypeRegistry(nsRegistry, repositoryDescriptors);
@@ -263,8 +263,8 @@
      * @return
      * @throws RepositoryException
      */
-    private NamespaceRegistryImpl createNamespaceRegistry(Properties descriptors) throws
RepositoryException {
-        boolean level2 = Boolean.valueOf(descriptors.getProperty(Repository.LEVEL_2_SUPPORTED)).booleanValue();
+    private NamespaceRegistryImpl createNamespaceRegistry(Map descriptors) throws RepositoryException
{
+        boolean level2 = Boolean.valueOf((String) descriptors.get(Repository.LEVEL_2_SUPPORTED)).booleanValue();
         return new NamespaceRegistryImpl(this, service.getRegisteredNamespaces(sessionInfo),
level2);
     }
 
@@ -275,7 +275,7 @@
      * @return
      * @throws RepositoryException
      */
-    private NodeTypeRegistry createNodeTypeRegistry(NamespaceRegistry nsRegistry, Properties
descriptors) throws RepositoryException {
+    private NodeTypeRegistry createNodeTypeRegistry(NamespaceRegistry nsRegistry, Map descriptors)
throws RepositoryException {
         QNodeDefinition rootNodeDef = service.getNodeDefinition(sessionInfo, service.getRootId(sessionInfo));
         QNodeTypeDefinitionIterator it = service.getNodeTypeDefinitions(sessionInfo);
         List ntDefs = new ArrayList();
@@ -294,8 +294,8 @@
      * @return the background polling thread or <code>null</code> if the underlying
      *         <code>RepositoryService</code> does not support observation.
      */
-    private Thread createChangeFeed(Properties descriptors, int pollingInterval) {
-        String desc = descriptors.getProperty(Repository.OPTION_OBSERVATION_SUPPORTED);
+    private Thread createChangeFeed(Map descriptors, int pollingInterval) {
+        String desc = (String) descriptors.get(Repository.OPTION_OBSERVATION_SUPPORTED);
         Thread t = null;
         if (Boolean.valueOf(desc).booleanValue()) {
             t = new Thread(new ExternalChangePolling(pollingInterval));

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java?view=diff&rev=468429&r1=468428&r2=468429
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java
Fri Oct 27 08:51:42 2006
@@ -30,9 +30,9 @@
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.RepositoryException;
 import java.util.HashMap;
-import java.util.Properties;
-import java.util.Enumeration;
 import java.util.HashSet;
+import java.util.Map;
+import java.util.Iterator;
 
 /**
  * <code>NamespaceRegistryImpl</code>...
@@ -72,7 +72,7 @@
 
     private final boolean level2Repository;
 
-    public NamespaceRegistryImpl(NamespaceStorage storage, Properties nsValues, boolean level2Repository)
{
+    public NamespaceRegistryImpl(NamespaceStorage storage, Map nsValues, boolean level2Repository)
{
         super(true); // enable listener support
         resolver = new CachingNamespaceResolver(this, 1000);
         this.storage = storage;
@@ -80,12 +80,12 @@
         load(nsValues);
     }
 
-    private void load(Properties nsValues) {
-        Enumeration prefixes = nsValues.propertyNames();
-        while (prefixes.hasMoreElements()) {
-            String prefix = (String) prefixes.nextElement();
+    private void load(Map nsValues) {
+        Iterator prefixes = nsValues.keySet().iterator();
+        while (prefixes.hasNext()) {
+            String prefix = (String) prefixes.next();
             if (!prefixToURI.containsKey(prefix)) {
-                String uri = nsValues.getProperty(prefix);
+                String uri = (String) nsValues.get(prefix);
                 prefixToURI.put(prefix, uri);
                 uriToPrefix.put(uri, prefix);
             }

Modified: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java?view=diff&rev=468429&r1=468428&r2=468429
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
(original)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
Fri Oct 27 08:51:42 2006
@@ -37,7 +37,7 @@
 import javax.jcr.ValueFormatException;
 import javax.jcr.Node;
 import javax.jcr.LoginException;
-import java.util.Properties;
+import java.util.Map;
 import java.io.InputStream;
 
 /**
@@ -59,7 +59,7 @@
      * @see javax.jcr.Repository#getDescriptorKeys()
      * @see javax.jcr.Repository#getDescriptor(String)
      */
-    public Properties getRepositoryDescriptors() throws RepositoryException;
+    public Map getRepositoryDescriptors() throws RepositoryException;
 
     //-----------------------------------< SessionInfo creation and release >---
     /**
@@ -535,7 +535,8 @@
 
     //---------------------------------------------------------< Namespaces >---
     /**
-     * Retrieve all registered namespaces.
+     * Retrieve all registered namespaces. The namespace to prefix mapping is
+     * done using the prefix as key and the namespace as value in the Map.
      *
      * @param sessionInfo
      * @return
@@ -546,7 +547,7 @@
      * @see javax.jcr.NamespaceRegistry#getPrefix(String)
      * @see javax.jcr.NamespaceRegistry#getURI(String)
      */
-    public Properties getRegisteredNamespaces(SessionInfo sessionInfo) throws RepositoryException;
+    public Map getRegisteredNamespaces(SessionInfo sessionInfo) throws RepositoryException;
 
     /**
      * Register a new namespace with the given prefix and uri

Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NamespaceResolverImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NamespaceResolverImpl.java?view=diff&rev=468429&r1=468428&r2=468429
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NamespaceResolverImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NamespaceResolverImpl.java
Fri Oct 27 08:51:42 2006
@@ -22,7 +22,9 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 
 import javax.jcr.NamespaceException;
-import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
 
 /**
  * <code>NamespaceResolverImpl</code>...
@@ -33,8 +35,8 @@
 
     // TODO: TO_BE_FIXED. missing notification and subsequent reloading of namespaces causes
this resolver to throw NameException
 
-    private Properties prefixToURI = new Properties();
-    private Properties uriToPrefix = new Properties();
+    private Map prefixToURI = new HashMap();
+    private Map uriToPrefix = new HashMap();
 
     void add(String prefix, String uri) {
         prefixToURI.put(prefix, uri);
@@ -46,10 +48,8 @@
         uriToPrefix.remove(uri);
     }
 
-    Properties getNamespaces() {
-        Properties namespaces = new Properties();
-        namespaces.putAll(prefixToURI);
-        return namespaces;
+    Map getNamespaces() {
+        return Collections.unmodifiableMap(prefixToURI);
     }
     
     //--------------------------------------------------< NamespaceResolver >---

Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?view=diff&rev=468429&r1=468428&r2=468429
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
Fri Oct 27 08:51:42 2006
@@ -144,7 +144,6 @@
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.version.VersionException;
 import javax.xml.parsers.ParserConfigurationException;
-import java.util.Properties;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -152,6 +151,7 @@
 import java.util.Set;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Map;
 import java.io.InputStream;
 import java.io.IOException;
 
@@ -348,7 +348,7 @@
     /**
      * @see RepositoryService#getRepositoryDescriptors()
      */
-    public Properties getRepositoryDescriptors() throws RepositoryException {
+    public Map getRepositoryDescriptors() throws RepositoryException {
         ReportInfo info = new ReportInfo(RepositoryDescriptorsReport.REPOSITORY_DESCRIPTORS_REPORT,
DavConstants.DEPTH_0);
         ReportMethod method = null;
         try {
@@ -357,7 +357,7 @@
             getClient((org.apache.commons.httpclient.Credentials) null).executeMethod(method);
             method.checkSuccess();
             Document doc = method.getResponseBodyAsDocument();
-            Properties descriptors = new Properties();
+            Map descriptors = new HashMap();
             if (doc != null) {
                 Element rootElement = doc.getDocumentElement();
                 ElementIterator nsElems = DomUtil.getChildren(rootElement, ItemResourceConstants.XML_DESCRIPTOR,
ItemResourceConstants.NAMESPACE);
@@ -366,7 +366,7 @@
                     String key = DomUtil.getChildText(elem, ItemResourceConstants.XML_DESCRIPTORKEY,
ItemResourceConstants.NAMESPACE);
                     String descriptor = DomUtil.getChildText(elem, ItemResourceConstants.XML_DESCRIPTORVALUE,
ItemResourceConstants.NAMESPACE);
                     if (key != null && descriptor != null) {
-                        descriptors.setProperty(key, descriptor);
+                        descriptors.put(key, descriptor);
                     } else {
                         log.error("Invalid descriptor key / value pair: " + key + " ->
" + descriptor);
                     }
@@ -1241,7 +1241,7 @@
     /**
      * @see RepositoryService#getRegisteredNamespaces(SessionInfo)
      */
-    public Properties getRegisteredNamespaces(SessionInfo sessionInfo) throws RepositoryException
{
+    public Map getRegisteredNamespaces(SessionInfo sessionInfo) throws RepositoryException
{
         ReportInfo info = new ReportInfo(RegisteredNamespacesReport.REGISTERED_NAMESPACES_REPORT,
DEPTH_0);
         ReportMethod method = null;
         try {
@@ -1250,7 +1250,7 @@
             method.checkSuccess();
 
             Document doc = method.getResponseBodyAsDocument();
-            Properties namespaces = new Properties();
+            Map namespaces = new HashMap();
             if (doc != null) {
                 Element rootElement = doc.getDocumentElement();
                 ElementIterator nsElems = DomUtil.getChildren(rootElement, ItemResourceConstants.XML_NAMESPACE,
ItemResourceConstants.NAMESPACE);
@@ -1264,7 +1264,7 @@
                     }
                     // any other uri must not be null
                     if (uri != null) {
-                        namespaces.setProperty(prefix, uri);
+                        namespaces.put(prefix, uri);
                         // TODO: not correct since nsRegistry is retrieved from each session
                         nsResolver.add(prefix, uri);
                     } else {
@@ -1288,9 +1288,9 @@
      * @see RepositoryService#registerNamespace(SessionInfo, String, String)
      */
     public void registerNamespace(SessionInfo sessionInfo, String prefix, String uri) throws
NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException
{
-        Properties namespaces = nsResolver.getNamespaces();
+        Map namespaces = new HashMap(nsResolver.getNamespaces());
         // add new pair that needs to be registered.
-        namespaces.setProperty(prefix, uri);
+        namespaces.put(prefix, uri);
 
         internalSetNamespaces(sessionInfo, namespaces);
         // adjust internal mappings:
@@ -1303,7 +1303,7 @@
      */
     public void unregisterNamespace(SessionInfo sessionInfo, String uri) throws NamespaceException,
UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException {
         String prefix = nsResolver.getPrefix(uri);
-        Properties namespaces = nsResolver.getNamespaces();
+        Map namespaces = new HashMap(nsResolver.getNamespaces());
         // remove pair that needs to be unregistered
         namespaces.remove(prefix);
 
@@ -1322,7 +1322,7 @@
      * @throws AccessDeniedException
      * @throws RepositoryException
      */
-    private void internalSetNamespaces(SessionInfo sessionInfo, Properties namespaces) throws
NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException
{
+    private void internalSetNamespaces(SessionInfo sessionInfo, Map namespaces) throws NamespaceException,
UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException {
         DavPropertySet setProperties = new DavPropertySet();
         setProperties.add(new NamespacesProperty(namespaces));
 



Mime
View raw message