jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r493133 - in /jackrabbit/branches/1.2/jackrabbit-core: ./ applications/test/ src/main/config/ src/main/java/org/apache/jackrabbit/core/ src/main/java/org/apache/jackrabbit/core/config/ src/test/java/org/apache/jackrabbit/core/config/
Date Fri, 05 Jan 2007 18:41:01 GMT
Author: jukka
Date: Fri Jan  5 10:41:00 2007
New Revision: 493133

URL: http://svn.apache.org/viewvc?view=rev&rev=493133
Log:
1.2: Merged revisions 493026 and 493031 (JCR-695)

Added:
    jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/repository-1.0.dtd
      - copied unchanged from r493026, jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/repository-1.0.dtd
    jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/repository-1.2.dtd
      - copied unchanged from r493026, jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/repository-1.2.dtd
Removed:
    jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/config.dtd
Modified:
    jackrabbit/branches/1.2/jackrabbit-core/applications/test/repository.xml
    jackrabbit/branches/1.2/jackrabbit-core/pom.xml
    jackrabbit/branches/1.2/jackrabbit-core/src/main/config/repository.xml
    jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java
    jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
    jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/repository.xml
    jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/test-repository.xml
    jackrabbit/branches/1.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/repository.xml
    jackrabbit/branches/1.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/workspace.xml

Modified: jackrabbit/branches/1.2/jackrabbit-core/applications/test/repository.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.2/jackrabbit-core/applications/test/repository.xml?view=diff&rev=493133&r1=493132&r2=493133
==============================================================================
--- jackrabbit/branches/1.2/jackrabbit-core/applications/test/repository.xml (original)
+++ jackrabbit/branches/1.2/jackrabbit-core/applications/test/repository.xml Fri Jan  5 10:41:00
2007
@@ -15,7 +15,8 @@
    See the License for the specific language governing permissions and
    limitations under the License.
   -->
-<!DOCTYPE Repository SYSTEM "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.2//EN"
+                            "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
 <!-- Example Repository Configuration File -->
 <Repository>
     <!--

Modified: jackrabbit/branches/1.2/jackrabbit-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.2/jackrabbit-core/pom.xml?view=diff&rev=493133&r1=493132&r2=493133
==============================================================================
--- jackrabbit/branches/1.2/jackrabbit-core/pom.xml (original)
+++ jackrabbit/branches/1.2/jackrabbit-core/pom.xml Fri Jan  5 10:41:00 2007
@@ -46,6 +46,7 @@
           <include>**/*.ddl</include>
           <include>META-INF/services/*</include>
           <include>**/*.cnd</include>
+          <include>**/*.dtd</include>
         </includes>
       </resource>
     </resources>

Modified: jackrabbit/branches/1.2/jackrabbit-core/src/main/config/repository.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.2/jackrabbit-core/src/main/config/repository.xml?view=diff&rev=493133&r1=493132&r2=493133
==============================================================================
--- jackrabbit/branches/1.2/jackrabbit-core/src/main/config/repository.xml (original)
+++ jackrabbit/branches/1.2/jackrabbit-core/src/main/config/repository.xml Fri Jan  5 10:41:00
2007
@@ -15,7 +15,8 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<!DOCTYPE Repository SYSTEM "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.2//EN"
+                            "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
 <!-- Example Repository Configuration File -->
 <Repository>
     <!--

Modified: jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java?view=diff&rev=493133&r1=493132&r2=493133
==============================================================================
--- jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java
(original)
+++ jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java
Fri Jan  5 10:41:00 2007
@@ -22,42 +22,68 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Entity resolver for Jackrabbit configuration files.
  * This simple resolver contains mappings for the following
- * public identifiers used for the Jackrabbit configuration files.
+ * public identifiers used for the Jackrabbit configuration files:
  * <ul>
- * <li><code>-//The Apache Software Foundation//DTD Workspace//EN</code></li>
- * <li><code>-//The Apache Software Foundation//DTD Repository//EN</code></li>
+ * <li><code>-//The Apache Software Foundation//DTD Jackrabbit 1.0//EN</code></li>
+ * <li><code>-//The Apache Software Foundation//DTD Jackrabbit 1.2//EN</code></li>
  * </ul>
  * <p>
- * The public identifiers are mapped to a document type definition
- * file included in the Jackrabbit jar archive.
+ * Also the following system identifiers are mapped to local resources:
+ * <ul>
+ * <li><code>http://jackrabbit.apache.org/dtd/repository-1.2.dtd</code></li>
+ * <li><code>http://jackrabbit.apache.org/dtd/repository-1.0.dtd</code></li>
+ * </ul>
+ * <p>
+ * The public identifiers are mapped to document type definition
+ * files included in the Jackrabbit jar archive.
  */
 class ConfigurationEntityResolver implements EntityResolver {
 
     /**
-     * Public identifier of the repository configuration DTD.
+     * The singleton instance of this class.
      */
-    public static final String REPOSITORY_ID =
-        "-//The Apache Software Foundation//DTD Repository//EN";
+    public static final EntityResolver INSTANCE =
+        new ConfigurationEntityResolver();
 
     /**
-     * Public identifier of the workspace configuration DTD.
+     * Public identifiers.
      */
-    public static final String WORKSPACE_ID =
-        "-//The Apache Software Foundation//DTD Workspace//EN";
+    private final Map publicIds = new HashMap();
 
     /**
-     * Resource path of the internal configuration DTD file.
+     * System identifiers.
      */
-    private static final String CONFIG_DTD =
-            "org/apache/jackrabbit/core/config/config.dtd";
+    private final Map systemIds = new HashMap();
+
+    /**
+     * Creates the singleton instance of this class.
+     */
+    private ConfigurationEntityResolver() {
+        // Apache Jackrabbit 1.2 DTD
+        publicIds.put(
+                "-//The Apache Software Foundation//DTD Jackrabbit 1.2//EN",
+                "repository-1.2.dtd");
+        systemIds.put(
+                "http://jackrabbit.apache.org/dtd/repository-1.2.dtd",
+                "repository-1.2.dtd");
+
+        // Apache Jackrabbit 1.0 DTD
+        publicIds.put(
+                "-//The Apache Software Foundation//DTD Jackrabbit 1.0//EN",
+                "repository-1.0.dtd");
+        systemIds.put(
+                "http://jackrabbit.apache.org/dtd/repository-1.0.dtd",
+                "repository-1.0.dtd");
+    }
 
     /**
      * Resolves an entity to the corresponding input source.
-     * {@inheritDoc}
      *
      * @param publicId public identifier
      * @param systemId system identifier
@@ -67,13 +93,25 @@
      */
     public InputSource resolveEntity(String publicId, String systemId)
             throws SAXException, IOException {
-        if (REPOSITORY_ID.equals(publicId) || WORKSPACE_ID.equals(publicId)) {
-            InputStream dtd =
-                getClass().getClassLoader().getResourceAsStream(CONFIG_DTD);
-            return new InputSource(dtd);
-        } else {
-            return null;
+        String name;
+
+        name = (String) publicIds.get(publicId);
+        if (name != null) {
+            InputStream stream = getClass().getResourceAsStream(name);
+            if (stream != null) {
+                return new InputSource(stream);
+            }
         }
+
+        name = (String) systemIds.get(systemId);
+        if (name != null) {
+            InputStream stream = getClass().getResourceAsStream(name);
+            if (stream != null) {
+                return new InputSource(stream);
+            }
+        }
+
+        return null;
     }
 
 }

Modified: jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java?view=diff&rev=493133&r1=493132&r2=493133
==============================================================================
--- jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
(original)
+++ jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
Fri Jan  5 10:41:00 2007
@@ -189,7 +189,7 @@
             DocumentBuilderFactory factory =
                 DocumentBuilderFactory.newInstance();
             DocumentBuilder builder = factory.newDocumentBuilder();
-            builder.setEntityResolver(new ConfigurationEntityResolver());
+            builder.setEntityResolver(ConfigurationEntityResolver.INSTANCE);
             Document document = builder.parse(xml);
             return document.getDocumentElement();
         } catch (ParserConfigurationException e) {

Modified: jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/repository.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/repository.xml?view=diff&rev=493133&r1=493132&r2=493133
==============================================================================
--- jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/repository.xml
(original)
+++ jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/repository.xml
Fri Jan  5 10:41:00 2007
@@ -15,7 +15,8 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<!DOCTYPE Repository SYSTEM "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.2//EN"
+                            "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
 <!-- Example Repository Configuration File -->
 <Repository>
     <!--

Modified: jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/test-repository.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/test-repository.xml?view=diff&rev=493133&r1=493132&r2=493133
==============================================================================
--- jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/test-repository.xml
(original)
+++ jackrabbit/branches/1.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/test-repository.xml
Fri Jan  5 10:41:00 2007
@@ -15,7 +15,8 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<!DOCTYPE Repository SYSTEM "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.2//EN"
+                            "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
 <Repository>
     <!--
         virtual file system where the repository stores global state

Modified: jackrabbit/branches/1.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/repository.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/repository.xml?view=diff&rev=493133&r1=493132&r2=493133
==============================================================================
--- jackrabbit/branches/1.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/repository.xml
(original)
+++ jackrabbit/branches/1.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/repository.xml
Fri Jan  5 10:41:00 2007
@@ -15,7 +15,8 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<!DOCTYPE Repository SYSTEM "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.2//EN"
+                            "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
 <!-- Example Repository Configuration File -->
 <Repository>
     <!--

Modified: jackrabbit/branches/1.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/workspace.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/workspace.xml?view=diff&rev=493133&r1=493132&r2=493133
==============================================================================
--- jackrabbit/branches/1.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/workspace.xml
(original)
+++ jackrabbit/branches/1.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/workspace.xml
Fri Jan  5 10:41:00 2007
@@ -1,44 +1,45 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-<!DOCTYPE Workspace SYSTEM "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
-<Workspace name="default">
-  <!--
-      virtual file system of the workspace:
-      class: FQN of class implementing FileSystem interface
-  -->
-  <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
-    <param name="path" value="${wsp.home}"/>
-  </FileSystem>
-  <!--
-      persistence of the workspace:
-      class: FQN of class implementing PersistenceManager interface
-  -->
-  <PersistenceManager class="org.apache.jackrabbit.core.persistence.obj.ObjectPersistenceManager"/>
-  <!--
-      Search index and the file system it uses.
-  -->
-  <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
-    <param name="useCompoundFile" value="true" />
-    <param name="minMergeDocs" value="1000" />
-    <param name="maxMergeDocs" value="10000" />
-    <param name="mergeFactor" value="10" />
-    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
-      <param name="path" value="${wsp.home}/index" />
-    </FileSystem>
-  </SearchIndex>
-</Workspace>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<!DOCTYPE Workspace PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.2//EN"
+                           "http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
+<Workspace name="default">
+  <!--
+      virtual file system of the workspace:
+      class: FQN of class implementing FileSystem interface
+  -->
+  <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+    <param name="path" value="${wsp.home}"/>
+  </FileSystem>
+  <!--
+      persistence of the workspace:
+      class: FQN of class implementing PersistenceManager interface
+  -->
+  <PersistenceManager class="org.apache.jackrabbit.core.persistence.obj.ObjectPersistenceManager"/>
+  <!--
+      Search index and the file system it uses.
+  -->
+  <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+    <param name="useCompoundFile" value="true" />
+    <param name="minMergeDocs" value="1000" />
+    <param name="maxMergeDocs" value="10000" />
+    <param name="mergeFactor" value="10" />
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+      <param name="path" value="${wsp.home}/index" />
+    </FileSystem>
+  </SearchIndex>
+</Workspace>



Mime
View raw message