jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r280292 - in /incubator/jackrabbit/trunk: commons/src/java/org/apache/jackrabbit/name/ commons/src/java/org/apache/jackrabbit/util/ core/src/java/org/apache/jackrabbit/core/xml/
Date Mon, 12 Sep 2005 08:52:01 GMT
Author: tripod
Date: Mon Sep 12 01:51:51 2005
New Revision: 280292

URL: http://svn.apache.org/viewcvs?rev=280292&view=rev
Log:
moving SessionNamespaceResolver to o.a.j.name.*

Added:
    incubator/jackrabbit/trunk/commons/src/java/org/apache/jackrabbit/name/SessionNamespaceResolver.java
  (with props)
Removed:
    incubator/jackrabbit/trunk/commons/src/java/org/apache/jackrabbit/util/SessionNamespaceResolver.java
Modified:
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java

Added: incubator/jackrabbit/trunk/commons/src/java/org/apache/jackrabbit/name/SessionNamespaceResolver.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/commons/src/java/org/apache/jackrabbit/name/SessionNamespaceResolver.java?rev=280292&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/commons/src/java/org/apache/jackrabbit/name/SessionNamespaceResolver.java
(added)
+++ incubator/jackrabbit/trunk/commons/src/java/org/apache/jackrabbit/name/SessionNamespaceResolver.java
Mon Sep 12 01:51:51 2005
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed 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.
+ */
+package org.apache.jackrabbit.name;
+
+import javax.jcr.NamespaceException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/**
+ * helper class that exposes the <code>NamespaceResolver</code>
+ * interface on a <code>Session</code>
+ */
+public class SessionNamespaceResolver implements NamespaceResolver {
+
+    /**
+     * the session for the namespace lookups
+     */
+    private final Session session;
+
+    /**
+     * Creates a new namespace resolver based on a session
+     * @param session
+     */
+    public SessionNamespaceResolver(Session session) {
+        this.session = session;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getPrefix(String uri) throws NamespaceException {
+        try {
+            return session.getNamespacePrefix(uri);
+        } catch (RepositoryException e) {
+            // should never get here...
+            throw new NamespaceException("internal error: failed to resolve namespace uri",
e);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getURI(String prefix) throws NamespaceException {
+        try {
+            return session.getNamespaceURI(prefix);
+        } catch (RepositoryException e) {
+            // should never get here...
+            throw new NamespaceException("internal error: failed to resolve namespace prefix",
e);
+        }
+    }
+}

Propchange: incubator/jackrabbit/trunk/commons/src/java/org/apache/jackrabbit/name/SessionNamespaceResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/jackrabbit/trunk/commons/src/java/org/apache/jackrabbit/name/SessionNamespaceResolver.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java?rev=280292&r1=280291&r2=280292&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
(original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
Mon Sep 12 01:51:51 2005
@@ -18,7 +18,7 @@
 
 import org.apache.jackrabbit.BaseException;
 import org.apache.jackrabbit.Constants;
-import org.apache.jackrabbit.util.SessionNamespaceResolver;
+import org.apache.jackrabbit.name.SessionNamespaceResolver;
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.log4j.Logger;
 import org.xml.sax.ContentHandler;



Mime
View raw message