diff --git a/.asf.yaml b/.asf.yaml new file mode 100644 index 00000000000..5948afd1371 --- /dev/null +++ b/.asf.yaml @@ -0,0 +1,31 @@ +# 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. + +# https://cwiki.apache.org/confluence/x/7guYBw +github: + description: "Apache Jackrabbit" + homepage: "https://jackrabbit.apache.org/" + labels: + - java + - jackrabbit + - jcr + - repository + - database + autolink_jira: + - OAK + - JCR + - JCRVLT + - SLING + - FELIX \ No newline at end of file diff --git a/README.txt b/README.txt index 2143f553530..776b26e2d81 100644 --- a/README.txt +++ b/README.txt @@ -19,7 +19,7 @@ You can build Jackrabbit like this: mvn clean install -You need Maven 3 (or higher) with Java 8 (or higher) for the +You need Maven 3 (or higher) with Java 11 (or higher) for the build. For more instructions, please see the documentation at: http://jackrabbit.apache.org/building-jackrabbit.html @@ -56,21 +56,9 @@ Jackrabbit mailing lists as well as links to list archives, please see: Latest development ================== -The latest Jackrabbit source code is available via Subversion at +The latest Jackrabbit source code is available at - https://svn.apache.org/repos/asf/jackrabbit/trunk/ - -or with ViewVC at - - https://svn.apache.org/viewvc/jackrabbit/trunk/ - -To checkout the main Jackrabbit source tree, run - - svn checkout https://svn.apache.org/repos/asf/jackrabbit/trunk jackrabbit - -If you use Git, you can clone Jackrabbit with - - git clone git://git.apache.org/jackrabbit.git + https://github.com/apache/jackrabbit Credits ======= diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 397e50f284e..eedb68ca538 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,45 +1,55 @@ -Release Notes -- Apache Jackrabbit -- Version 2.21.15 +Release Notes -- Apache Jackrabbit -- Version 2.23.1-beta Introduction ------------ -This is Apache Jackrabbit(TM) 2.21.15, a fully compliant implementation of the +This is Apache Jackrabbit(TM) 2.23.1-beta, a fully compliant implementation of the Content Repository for Java(TM) Technology API, version 2.0 (JCR 2.0) as specified in the Java Specification Request 283 (JSR 283). -Apache Jackrabbit 2.21.15 is an unstable release cut directly from +Apache Jackrabbit 2.23.1-beta is an unstable release cut directly from Jackrabbit trunk, with a focus on new features and other improvements. For production use we recommend the latest stable 2.20.x release. -Changes in Jackrabbit 2.21.15 ------------------------------ +Changes in Jackrabbit 2.23.1-beta +---------------------------------- + +Bug + + [JCR-5107] - DbInputStream makes incorrect assumptions about commons-io internals + +Improvement + + [JCR-5093] - jcr2spi: get rid of Commons IO dependency + [JCR-5106] - core tests: improve diagnostics in DBDataStoreTest + +Test + + [JCR-5098] - jackrabbit-jcr-server: Java 24 javadoc errors Task - [JCR-4878] - Javadoc fixes - [JCR-4879] - update checkstyle-plugin dependency to 3.2.0 - [JCR-4880] - Update javadoc-plugin dependency to 3.4.1 - [JCR-4881] - Update maven-jar-plugin to 3.3.0 - [JCR-4882] - Update animal-sniffer plugin dependency to 1.22 - [JCR-4883] - Update pmd-plugin dependency to 3.19.0 - [JCR-4884] - Update spotbugs-maven-plugin to 4.7.3.0 - [JCR-4885] - update Apache parent pom to version 28 - [JCR-4886] - Update Jackrabbit trunk to Oak 1.46.0 - [JCR-4888] - update Apache parent pom to version 29 - [JCR-4889] - Update javacc-maven-plugin to version 3.0.1 - [JCR-4891] - set baseline comparisonVersion to latest stable (2.20.8) - [JCR-4893] - Update mockito dependency to 4.11.0 - [JCR-4894] - webapp: update htmlunit dependency to 2.69.0 - [JCR-4895] - update aws java sdk version to 1.12.383 - [JCR-4896] - Update easymock dependency to 5.1.0 - [JCR-4897] - update kotlin-stdlib dependency to 1.8.0 - [JCR-4898] - Update oak-jackrabbit-api.version.used in trunk and 2.20 to Oak 1.22.14 - [JCR-4899] - Update tomcat dependency to 8.5.85 - [JCR-4900] - Update oak-jackrabbit-api.version.implemented in trunk and 2.20 to Oak 1.48.0 - [JCR-4901] - webapp: update htmlunit dependency to 2.70.0 - [JCR-4903] - update checkstyle-plugin dependency to 3.2.1 - [JCR-4905] - Update pmd-plugin dependency to 3.20.0 + [JCR-5088] - remove warnings about missing @deprecated annotations + [JCR-5089] - avoid use of deprecated junit.framework.Assert + [JCR-5094] - webapp: bump htmlunit to 4.4.0 + [JCR-5096] - JcrConstants: refer to the constants in javax.jcr.Property and javax.jcr.nodetype.NodeType + [JCR-5097] - Update oak-jackrabbit-api.version.implemented in trunk to Oak 1.68.0 + [JCR-5099] - Update Logback version to 1.2.13 + [JCR-5100] - Update commons-cli dependency to 1.9.0 + [JCR-5101] - Update easymock dependency to 5.4.0 + [JCR-5102] - Update mockito dependency to 5.14.1 + [JCR-5103] - Update oak-jackrabbit-api.version.used to Oak 1.22.21 + [JCR-5104] - Update oak-jackrabbit-api.version.implemented in trunk to Oak 1.70.0 + [JCR-5105] - Update commons-io dependency to 2.17.0 + [JCR-5108] - remove commons-collections4 version-specific dependency from jackrabbit-standalone + [JCR-5109] - Update tomcat dependency to 9.0.95 + [JCR-5110] - update aws java sdk version to 1.12.773 + [JCR-5111] - update kotlin-stdlib dependency to 1.9.25 + [JCR-5112] - update Jetty to 9.4.56.v20240826 + [JCR-5113] - Update pmd-plugin dependency to 3.25.0 + [JCR-5114] - update checkstyle-plugin dependency to 3.5.0 + [JCR-5115] - Update spotbugs-maven-plugin to 4.8.6.4 For more detailed information about all the changes in this and other @@ -88,5 +98,3 @@ Trademarks Apache Jackrabbit, Jackrabbit, Apache, the Apache feather logo, and the Apache Jackrabbit project logo are trademarks of The Apache Software Foundation. - - diff --git a/jackrabbit-aws-ext/pom.xml b/jackrabbit-aws-ext/pom.xml index 09e77748a8e..c16d7718e3a 100644 --- a/jackrabbit-aws-ext/pom.xml +++ b/jackrabbit-aws-ext/pom.xml @@ -20,7 +20,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-aws-ext @@ -49,7 +49,7 @@ com.amazonaws aws-java-sdk-s3 - 1.12.383 + 1.12.773 org.apache.jackrabbit @@ -61,6 +61,7 @@ jackrabbit-data ${project.version} test-jar + test org.slf4j diff --git a/jackrabbit-core/pom.xml b/jackrabbit-core/pom.xml index 09a4d8b2bc8..07176a8342f 100644 --- a/jackrabbit-core/pom.xml +++ b/jackrabbit-core/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-core @@ -114,6 +114,8 @@ org.apache.jackrabbit.core.security.user.MembershipCachePerfTest org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testPathLiteral org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testURILiteral +org.apache.jackrabbit.core.version.ModifyNonVersionableCheckedOutTest#testNonVersionableCheckedOut +org.apache.jackrabbit.core.version.ModifyNonVersionableCheckedOutTest#testModifyNonVersionableNodeWithCheckedOutProperty @@ -291,6 +293,11 @@ org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testURILiteral derby test + + org.apache.derby + derbytools + test + org.apache.jackrabbit jackrabbit-jcr-tests @@ -302,11 +309,6 @@ org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testURILiteral junit test - - commons-beanutils - commons-beanutils - test - org.apache.jackrabbit jackrabbit-jcr-benchmark @@ -330,7 +332,7 @@ org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testURILiteral com.h2database h2 - 2.1.214 + 2.2.224 test @@ -355,7 +357,7 @@ org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testURILiteral Note: the ${config.db.name} database is dropped and re-created in the clean phase. --> - + mssql @@ -441,13 +443,13 @@ org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testURILiteral org.codehaus.mojo sql-maven-plugin - + net.sourceforge.jtds jtds @@ -539,13 +541,13 @@ org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testURILiteral - + net.sourceforge.jtds jtds diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManager.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManager.java index 7ba4245b5a0..f5b3c222ae5 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManager.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManager.java @@ -49,6 +49,7 @@ public interface HierarchyManager { * if there's no item at path. * @throws RepositoryException if an error occurs */ + @Deprecated ItemId resolvePath(Path path) throws RepositoryException; /** diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java index dbd40a4c8c1..322e9d699c7 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java @@ -467,6 +467,7 @@ private boolean canRead(ItemData parent, ItemId childId) throws RepositoryExcept * @param path path to the item to be checked * @return true if the specified item exists */ + @Deprecated public boolean itemExists(Path path) { try { sanityCheck(); @@ -544,6 +545,7 @@ NodeImpl getRootNode() throws RepositoryException { * @throws AccessDeniedException * @throws RepositoryException */ + @Deprecated public ItemImpl getItem(Path path) throws PathNotFoundException, AccessDeniedException, RepositoryException { ItemId id = hierMgr.resolvePath(path); diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java index 3519d9211d6..7f59ef4bb56 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java @@ -565,6 +565,7 @@ protected synchronized NodeImpl createChildNode(Name name, * @throws RepositoryException * @deprecated use #renameChildNode(NodeId, Name, boolean) */ + @Deprecated protected void renameChildNode(Name oldName, int index, NodeId id, Name newName) throws RepositoryException { @@ -3072,6 +3073,7 @@ public boolean isLocked() throws RepositoryException { * @throws RepositoryException if some other error occurs * @deprecated */ + @Deprecated protected void checkLock() throws LockException, RepositoryException { if (isNew()) { // a new node needs no check diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java index ce105bb7656..95e94d8f7e4 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java @@ -22,8 +22,6 @@ import java.io.OutputStream; import java.io.StringReader; import java.nio.charset.StandardCharsets; -import java.security.AccessControlContext; -import java.security.AccessController; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -80,6 +78,7 @@ import org.apache.jackrabbit.core.gc.GarbageCollector; import org.apache.jackrabbit.core.id.NodeId; import org.apache.jackrabbit.core.id.NodeIdFactory; +import org.apache.jackrabbit.core.jdkcompat.Java23Subject; import org.apache.jackrabbit.core.lock.LockManager; import org.apache.jackrabbit.core.lock.LockManagerImpl; import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry; @@ -1025,8 +1024,7 @@ private Session extendAuthentication(String workspaceName) Subject subject = null; try { - AccessControlContext acc = AccessController.getContext(); - subject = Subject.getSubject(acc); + subject = Java23Subject.getSubject(); } catch (SecurityException e) { log.warn("Can't check for preauthentication. Reason: {}", e.getMessage()); } diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockRecord.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockRecord.java index e29c3cf7f96..94dd49ca128 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockRecord.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockRecord.java @@ -166,6 +166,7 @@ public boolean isDeep() { * @return user id * @deprecated User {@link #getOwner()} instead. */ + @Deprecated public String getUserId() { return lockOwner; } diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java index 7801c01dacd..d0c78d61793 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java @@ -933,6 +933,7 @@ public FileSystem getFileSystem() throws RepositoryException { * @return repository name * @deprecated Use {@link SecurityConfig#getAppName()} instead. */ + @Deprecated public String getAppName() { return sec.getAppName(); } @@ -943,6 +944,7 @@ public String getAppName() { * @return access manager configuration * @deprecated Use {@link SecurityConfig#getAccessManagerConfig()} instead. */ + @Deprecated public AccessManagerConfig getAccessManagerConfig() { return sec.getAccessManagerConfig(); } @@ -954,6 +956,7 @@ public AccessManagerConfig getAccessManagerConfig() { * JAAS mechanism should be used. * @deprecated Use {@link SecurityConfig#getLoginModuleConfig()} instead. */ + @Deprecated public LoginModuleConfig getLoginModuleConfig() { return sec.getLoginModuleConfig(); } diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/JNDIDatabaseFileSystem.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/JNDIDatabaseFileSystem.java index 7d21a066fe5..93eb6698c0d 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/JNDIDatabaseFileSystem.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/JNDIDatabaseFileSystem.java @@ -35,6 +35,7 @@ * for the entire lifetime of the file system instance. The configured data * source should be prepared for this. */ +@Deprecated public class JNDIDatabaseFileSystem extends DatabaseFileSystem { /** diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jdkcompat/Java23Subject.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jdkcompat/Java23Subject.java new file mode 100644 index 00000000000..95ea967ee8d --- /dev/null +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jdkcompat/Java23Subject.java @@ -0,0 +1,58 @@ +/* + * 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. + */ +package org.apache.jackrabbit.core.jdkcompat; + +import javax.security.auth.Subject; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.security.AccessControlContext; +import java.security.AccessController; +import java.util.concurrent.Callable; + +/** + * This class contains methods replacing the deprecated + * {@link Subject#getSubject(AccessControlContext)} + * and associated methods, which changed their behavior + * with Java 23 (@see https://inside.java/2024/07/08/quality-heads-up). + *

+ * Subset borrowed from org.apache.jackrabbit.oak.commons.jdkcompat + * (see JCR-5121 and OAK-11199). + */ +public class Java23Subject { + + static Method current; + + static { + try { + current = Subject.class.getMethod("current"); + } catch (NoSuchMethodException ignored) {} + } + + public static Subject getSubject() { + Subject result; + if (current != null) { + try { + result = (Subject) current.invoke(null); + } catch (InvocationTargetException | IllegalAccessException e) { + throw new SecurityException(e); + } + } else { + result = Subject.getSubject(AccessController.getContext()); + } + return result; + } +} diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/RegistryHelper.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/RegistryHelper.java index 5a8e406ce17..6784a70e2a1 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/RegistryHelper.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/RegistryHelper.java @@ -25,6 +25,8 @@ import org.apache.jackrabbit.api.JackrabbitRepository; +import static org.apache.jackrabbit.commons.JndiRepositoryFactory.JNDI_ENABLED; + /** * JNDI helper functionality. This class contains static utility * methods for binding and unbinding Jackrabbit repositories to and @@ -59,24 +61,28 @@ public static void registerRepository(Context ctx, String name, String repHomeDir, boolean overwrite) throws NamingException, RepositoryException { - Reference reference = new Reference( - Repository.class.getName(), - BindableRepositoryFactory.class.getName(), - null); // no classpath defined - reference.add(new StringRefAddr( - BindableRepository.CONFIGFILEPATH_ADDRTYPE, configFilePath)); - reference.add(new StringRefAddr( - BindableRepository.REPHOMEDIR_ADDRTYPE, repHomeDir)); + if (JNDI_ENABLED) { + Reference reference = new Reference( + Repository.class.getName(), + BindableRepositoryFactory.class.getName(), + null); // no classpath defined + reference.add(new StringRefAddr( + BindableRepository.CONFIGFILEPATH_ADDRTYPE, configFilePath)); + reference.add(new StringRefAddr( + BindableRepository.REPHOMEDIR_ADDRTYPE, repHomeDir)); - // always create instance by using BindableRepositoryFactory - // which maintains an instance cache; - // see http://issues.apache.org/jira/browse/JCR-411 for details - Object obj = new BindableRepositoryFactory().getObjectInstance( - reference, null, null, null); - if (overwrite) { - ctx.rebind(name, obj); + // always create instance by using BindableRepositoryFactory + // which maintains an instance cache; + // see http://issues.apache.org/jira/browse/JCR-411 for details + Object obj = new BindableRepositoryFactory().getObjectInstance( + reference, null, null, null); + if (overwrite) { + ctx.rebind(name, obj); + } else { + ctx.bind(name, obj); + } } else { - ctx.bind(name, obj); + throw new RepositoryException("JNDI is not enabled"); } } @@ -91,8 +97,10 @@ public static void registerRepository(Context ctx, String name, */ public static void unregisterRepository(Context ctx, String name) throws NamingException { - ((JackrabbitRepository) ctx.lookup(name)).shutdown(); - ctx.unbind(name); + if (JNDI_ENABLED) { + ((JackrabbitRepository) ctx.lookup(name)).shutdown(); + ctx.unbind(name); + } } } diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java index 786c92c1e60..2a0b71d7496 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java @@ -651,6 +651,7 @@ public String getDatabaseType() { * * @return the database type */ + @Deprecated public String getSchema() { return databaseType; } @@ -706,6 +707,7 @@ public void setDatabaseType(String databaseType) { * * @param databaseType the database type */ + @Deprecated public void setSchema(String databaseType) { this.databaseType = databaseType; } diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JNDIDatabaseJournal.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JNDIDatabaseJournal.java index fa4a0d24743..48b149fae60 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JNDIDatabaseJournal.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JNDIDatabaseJournal.java @@ -38,6 +38,7 @@ * for the entire lifetime of the journal instance. The configured data * source should be prepared for this. */ +@Deprecated public class JNDIDatabaseJournal extends DatabaseJournal { /** diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java index 8d5a6cd0de8..86fdc7304aa 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java @@ -296,6 +296,7 @@ public void setSchemaObjectPrefix(String schemaObjectPrefix) { * * @return the database type name. */ + @Deprecated public String getSchema() { return databaseType; } @@ -317,6 +318,7 @@ public String getDatabaseType() { * * @param databaseType database type name */ + @Deprecated public void setSchema(String databaseType) { this.databaseType = databaseType; } diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java index 40502b033e9..7fc6088e8b1 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/AbstractQueryHandler.java @@ -183,6 +183,7 @@ public String getQueryClass() { * * @param idleTime the query handler idle time. */ + @Deprecated public void setIdleTime(String idleTime) { log.warn("Parameter 'idleTime' is not supported anymore. " + "Please use 'maxIdleTime' in the repository configuration."); diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java index efc3c253abb..47d76cb40bf 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java @@ -665,6 +665,7 @@ protected void addURIValue(Document doc, String fieldName, URI internalValue) { * @deprecated Use {@link #addStringValue(Document, String, String, boolean) * addStringValue(Document, String, Object, boolean)} instead. */ + @Deprecated protected void addStringValue(Document doc, String fieldName, String internalValue) { addStringValue(doc, fieldName, internalValue, true, true, DEFAULT_BOOST, true); } @@ -702,6 +703,7 @@ protected void addStringValue(Document doc, String fieldName, * @param boost the boost value for this string field. * @deprecated use {@link #addStringValue(Document, String, String, boolean, boolean, float, boolean)} instead. */ + @Deprecated protected void addStringValue(Document doc, String fieldName, String internalValue, boolean tokenized, boolean includeInNodeIndex, float boost) { @@ -791,6 +793,7 @@ protected void addNameValue(Document doc, String fieldName, Name internalValue) * @return a lucene field. * @deprecated use {@link #createFulltextField(String, boolean, boolean, boolean)} instead. */ + @Deprecated protected Field createFulltextField(String value) { return createFulltextField(value, supportHighlighting, supportHighlighting); } @@ -804,6 +807,7 @@ protected Field createFulltextField(String value) { * @return a lucene field. * @deprecated use {@link #createFulltextField(String, boolean, boolean, boolean)} instead. */ + @Deprecated protected Field createFulltextField(String value, boolean store, boolean withOffsets) { @@ -855,6 +859,7 @@ protected Field createFulltextField(String value, * @return a lucene field. * @deprecated use {@link #createFulltextField(InternalValue, Metadata, boolean)} instead. */ + @Deprecated protected Fieldable createFulltextField( InternalValue value, Metadata metadata) { return createFulltextField(value, metadata, true); diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PredicateDerefQuery.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PredicateDerefQuery.java index b09d829812c..f91827f84b0 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PredicateDerefQuery.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/PredicateDerefQuery.java @@ -74,6 +74,11 @@ public class PredicateDerefQuery extends Query { * The scorer of the name test query */ private Scorer nameTestScorer; + + /** + * Flag indicating if the children have already been calculated + */ + private boolean childrenCalculated = false; /** * Creates a new DerefQuery based on a context * query. @@ -203,6 +208,7 @@ public void normalize(float norm) { public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException { subQueryScorer = subQuery.weight(searcher).scorer(reader, scoreDocsInOrder, false); + childrenCalculated = false; if (nameTest != null) { nameTestScorer = new NameQuery(nameTest, version, nsMappings).weight(searcher).scorer(reader, scoreDocsInOrder, false); } @@ -311,58 +317,62 @@ public int advance(int target) throws IOException { * @throws IOException */ private void calculateChildren() throws IOException { + + if (!childrenCalculated) { // subQueryHits.clear(); // hits.clear(); - subQueryScorer.score(new AbstractHitCollector() { - @Override - protected void collect(int doc, float score) { - subQueryHits.set(doc); - } - }); + subQueryScorer.score(new AbstractHitCollector() { + @Override + protected void collect(int doc, float score) { + subQueryHits.set(doc); + } + }); - TermDocs termDocs = reader.termDocs(new Term(FieldNames.PROPERTIES_SET, refProperty)); - String prefix = FieldNames.createNamedValue(refProperty, ""); - while (termDocs.next()) { - int doc = termDocs.doc(); + TermDocs termDocs = reader.termDocs(new Term(FieldNames.PROPERTIES_SET, refProperty)); + String prefix = FieldNames.createNamedValue(refProperty, ""); + while (termDocs.next()) { + int doc = termDocs.doc(); - String[] values = reader.document(doc).getValues(FieldNames.PROPERTIES); - if (values == null) { - // no reference properties at all on this node - continue; - } - for (int v = 0; v < values.length; v++) { - if (values[v].startsWith(prefix)) { - String uuid = values[v].substring(prefix.length()); - - TermDocs node = reader.termDocs(TermFactory.createUUIDTerm(uuid)); - try { - while (node.next()) { - if (subQueryHits.get(node.doc())) { - hits.set(doc); + String[] values = reader.document(doc).getValues(FieldNames.PROPERTIES); + if (values == null) { + // no reference properties at all on this node + continue; + } + for (int v = 0; v < values.length; v++) { + if (values[v].startsWith(prefix)) { + String uuid = values[v].substring(prefix.length()); + + TermDocs node = reader.termDocs(TermFactory.createUUIDTerm(uuid)); + try { + while (node.next()) { + if (subQueryHits.get(node.doc())) { + hits.set(doc); + } } + } finally { + node.close(); } - } finally { - node.close(); } } } - } - // collect nameTest hits - final BitSet nameTestHits = new BitSet(); - if (nameTestScorer != null) { - nameTestScorer.score(new AbstractHitCollector() { - @Override - protected void collect(int doc, float score) { - nameTestHits.set(doc); - } - }); - } + // collect nameTest hits + final BitSet nameTestHits = new BitSet(); + if (nameTestScorer != null) { + nameTestScorer.score(new AbstractHitCollector() { + @Override + protected void collect(int doc, float score) { + nameTestHits.set(doc); + } + }); + } - // filter out the target nodes that do not match the name test - // if there is any name test at all. - if (nameTestScorer != null) { - hits.and(nameTestHits); + // filter out the target nodes that do not match the name test + // if there is any name test at all. + if (nameTestScorer != null) { + hits.and(nameTestHits); + } + childrenCalculated = true; } } } diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java index 6baef1fdbe7..8e4db22cc2e 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java @@ -177,6 +177,7 @@ public class SearchIndex extends AbstractQueryHandler { * @deprecated this value is not used anymore. Instead the default value * is calculated as follows: 2 * Runtime.getRuntime().availableProcessors(). */ + @Deprecated public static final int DEFAULT_EXTRACTOR_POOL_SIZE = 0; /** @@ -2101,6 +2102,7 @@ public int getMaxExtractLength() { * @param filterClasses comma separated list of class names * @deprecated */ + @Deprecated public void setTextFilterClasses(String filterClasses) { log.warn("The textFilterClasses configuration parameter has" + " been deprecated, and the configured value will" @@ -2114,6 +2116,7 @@ public void setTextFilterClasses(String filterClasses) { * @return class names of the text filters in use. * @deprecated */ + @Deprecated public String getTextFilterClasses() { return "deprectated"; } diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/AccessManager.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/AccessManager.java index 3343bafe4d0..cc3f5cb6c1a 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/AccessManager.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/AccessManager.java @@ -36,18 +36,21 @@ public interface AccessManager { * READ permission constant * @deprecated */ + @Deprecated int READ = 1; /** * WRITE permission constant * @deprecated */ + @Deprecated int WRITE = 2; /** * REMOVE permission constant * @deprecated */ + @Deprecated int REMOVE = 4; /** @@ -102,6 +105,7 @@ void init(AMContext context, AccessControlProvider acProvider, * @throws RepositoryException it an error occurs * @deprecated */ + @Deprecated void checkPermission(ItemId id, int permissions) throws AccessDeniedException, ItemNotFoundException, RepositoryException; @@ -145,6 +149,7 @@ void checkPermission(ItemId id, int permissions) * @throws RepositoryException if another error occurs * @deprecated */ + @Deprecated boolean isGranted(ItemId id, int permissions) throws ItemNotFoundException, RepositoryException; diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/AbstractLoginModule.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/AbstractLoginModule.java index d2b5237d491..767c3da6b20 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/AbstractLoginModule.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/AbstractLoginModule.java @@ -77,6 +77,7 @@ public abstract class AbstractLoginModule implements LoginModule { * deprecated and will no longer be supported in a subsequent release. * See also JCR-3293 */ + @Deprecated private static final String PRE_AUTHENTICATED_ATTRIBUTE_OPTION = "trust_credentials_attribute"; private String principalProviderClassName; @@ -95,6 +96,7 @@ public abstract class AbstractLoginModule implements LoginModule { * has been deprecated and will no longer be available in a subsequent release. * See also JCR-3293 */ + @Deprecated private String preAuthAttributeName; @@ -759,6 +761,7 @@ public void setPrincipalProvider(String principalProvider) { * has been deprecated and will no longer be available in a subsequent release. * See also JCR-3293 */ + @Deprecated protected final String getPreAuthAttributeName() { return preAuthAttributeName; } @@ -783,6 +786,7 @@ protected final String getPreAuthAttributeName() { * has been deprecated and will no longer be available in a subsequent release. * See also JCR-3293 */ + @Deprecated protected boolean isPreAuthenticated(final Credentials creds) { final String preAuthAttrName = getPreAuthAttributeName(); boolean isPreAuth = preAuthAttrName != null diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/CryptedSimpleCredentials.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/CryptedSimpleCredentials.java index c4370edb0db..8d5bd048361 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/CryptedSimpleCredentials.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/CryptedSimpleCredentials.java @@ -51,6 +51,7 @@ public class CryptedSimpleCredentials implements Credentials { * @throws UnsupportedEncodingException * @deprecated */ + @Deprecated public CryptedSimpleCredentials(SimpleCredentials credentials) throws NoSuchAlgorithmException, UnsupportedEncodingException { userId = credentials.getUserID(); diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java index d578d217727..60409e1d928 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java @@ -58,6 +58,7 @@ public class TokenBasedAuthentication implements Authentication { * behavior of the {@code TokenBasedAuthentication}. Note that as of OAK 1.0 * this flag will no be supported. */ + @Deprecated public static final String PARAM_COMPAT = "TokenCompatMode"; private final TokenInfo tokenInfo; diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractCompiledPermissions.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractCompiledPermissions.java index fcb6d3d5ce0..939c5bed560 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractCompiledPermissions.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractCompiledPermissions.java @@ -159,6 +159,7 @@ public static class Result { /** * @deprecated */ + @Deprecated public Result(int allows, int denies, int allowPrivileges, int denyPrivileges) { this(allows, denies, PrivilegeBits.getInstance(allowPrivileges), PrivilegeBits.getInstance(denyPrivileges)); } @@ -178,6 +179,7 @@ public boolean grants(int permissions) { /** * @deprecated jackrabbit 2.3 (throws UnsupportedOperationException, use getPrivilegeBits instead) */ + @Deprecated public int getPrivileges() { throw new UnsupportedOperationException("use #getPrivilegeBits instead."); } diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/CompiledPermissions.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/CompiledPermissions.java index 57b9e92dd2d..cad868392bb 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/CompiledPermissions.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/CompiledPermissions.java @@ -62,6 +62,7 @@ public interface CompiledPermissions { * @throws RepositoryException if an error occurs * @deprecated Use {@link #getPrivilegeSet(Path)} instead. */ + @Deprecated int getPrivileges(Path absPath) throws RepositoryException; /** diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/PrivilegeRegistry.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/PrivilegeRegistry.java index 0114df4fe5c..8aa0d71273d 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/PrivilegeRegistry.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/PrivilegeRegistry.java @@ -183,6 +183,7 @@ public PrivilegeRegistry(NamespaceRegistry namespaceRegistry, FileSystem fs) * @deprecated Use {@link org.apache.jackrabbit.api.security.authorization.PrivilegeManager} instead. * @see org.apache.jackrabbit.api.JackrabbitWorkspace#getPrivilegeManager() */ + @Deprecated public PrivilegeRegistry(NameResolver resolver) { cacheDefinitions(createBuiltInPrivilegeDefinitions()); @@ -225,6 +226,7 @@ public void setEventChannel(PrivilegeEventChannel eventChannel) { * @return all registered privileges. * @deprecated Use {@link org.apache.jackrabbit.api.security.authorization.PrivilegeManager#getRegisteredPrivileges()} instead. */ + @Deprecated public Privilege[] getRegisteredPrivileges() { try { return new PrivilegeManagerImpl(this, resolver).getRegisteredPrivileges(); @@ -243,6 +245,7 @@ public Privilege[] getRegisteredPrivileges() { * @throws RepositoryException If another error occurs. * @deprecated Use {@link org.apache.jackrabbit.api.security.authorization.PrivilegeManager#getPrivilege(String)} instead. */ + @Deprecated public Privilege getPrivilege(String privilegeName) throws AccessControlException, RepositoryException { return new PrivilegeManagerImpl(this, resolver).getPrivilege(privilegeName); } @@ -258,6 +261,7 @@ public Privilege getPrivilege(String privilegeName) throws AccessControlExceptio * @see #getBits(Privilege[]) * @deprecated Use {@link PrivilegeManagerImpl#getPrivileges(PrivilegeBits)} instead. */ + @Deprecated public Privilege[] getPrivileges(int bits) { Set prvs = new PrivilegeManagerImpl(this, resolver).getPrivileges(PrivilegeBits.getInstance(bits)); return prvs.toArray(new Privilege[prvs.size()]); @@ -274,6 +278,7 @@ public Privilege[] getPrivileges(int bits) { * @see #getPrivileges(int) * @deprecated Use {@link PrivilegeManagerImpl#getBits(javax.jcr.security.Privilege...)} instead. */ + @Deprecated public static int getBits(Privilege[] privileges) throws AccessControlException { if (privileges == null || privileges.length == 0) { throw new AccessControlException("Privilege array is empty or null."); @@ -346,6 +351,7 @@ public static int calculatePermissions(PrivilegeBits privs, PrivilegeBits parent * @return the permissions granted evaluating the given privileges. * @deprecated Use {@link #calculatePermissions(PrivilegeBits, PrivilegeBits, boolean, boolean)} instead. */ + @Deprecated public static int calculatePermissions(int privs, int parentPrivs, boolean isAllow, boolean protectsPolicy) { return calculatePermissions((long) privs, (long) parentPrivs, isAllow, protectsPolicy); } diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserConstants.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserConstants.java index a5d994d278d..7eecd91db74 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserConstants.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserConstants.java @@ -52,6 +52,7 @@ interface UserConstants { * rep:userId property redundant. It has been removed from the node type * definition. */ + @Deprecated Name P_USERID = NF.create(Name.NS_REP_URI, "userId"); Name P_PASSWORD = NF.create(Name.NS_REP_URI, "password"); Name P_DISABLED = NF.create(Name.NS_REP_URI, "disabled"); @@ -60,6 +61,7 @@ interface UserConstants { * @deprecated As of 2.0 group membership is stored with the group node. * @see #P_MEMBERS */ + @Deprecated Name P_GROUPS = NF.create(Name.NS_REP_URI, "groups"); Name P_MEMBERS = NF.create(Name.NS_REP_URI, "members"); diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java index cc50a886f43..7c415683f27 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java @@ -190,6 +190,7 @@ public class UserManagerImpl extends ProtectedItemModifier /** * @deprecated Use {@link #PARAM_COMPATIBLE_JR16} instead. */ + @Deprecated public static final String PARAM_COMPATIBILE_JR16 = "compatibleJR16"; /** diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/RepositoryLock.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/RepositoryLock.java index d9268a7c5a7..5f100a2916d 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/RepositoryLock.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/RepositoryLock.java @@ -98,6 +98,7 @@ public RepositoryLock() { * @throws RepositoryException if the canonical path of the directory * can not be determined */ + @Deprecated public RepositoryLock(String path) throws RepositoryException { init(path); } diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java index 05d3c22ff94..df812e9253c 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenVersionHistory.java @@ -55,6 +55,7 @@ InternalVersionHistory getVersionHistory() /** * @deprecated use {@link #getBaseVersion()} instead */ + @Deprecated InternalVersion getBaseVesion() throws VersionException; /** diff --git a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java index 26bdc9c9081..c2339f045e9 100644 --- a/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java +++ b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java @@ -45,6 +45,7 @@ public interface VirtualItemStateProvider extends ItemStateManager { * @return the id of the root node of the virtual tree. * @deprecated use {@link #getVirtualRootIds()} instead. */ + @Deprecated NodeId getVirtualRootId(); /** diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/JackrabbitSessionTest.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/JackrabbitSessionTest.java new file mode 100644 index 00000000000..f1a36298b72 --- /dev/null +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/JackrabbitSessionTest.java @@ -0,0 +1,83 @@ +/* + * 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. + */ +package org.apache.jackrabbit.api; + +import org.apache.jackrabbit.test.AbstractJCRTest; +import org.apache.jackrabbit.test.NotExecutableException; +import org.junit.Ignore; + +import javax.jcr.GuestCredentials; +import javax.jcr.Item; +import javax.jcr.Node; +import javax.jcr.Property; +import javax.jcr.RepositoryException; + +import static org.mockito.Mockito.mock; + +public class JackrabbitSessionTest extends AbstractJCRTest { + + private JackrabbitSession s; + + @Override + protected void setUp() throws Exception { + super.setUp(); + if (superuser instanceof JackrabbitSession) { + s = (JackrabbitSession) superuser; + } else { + throw new NotExecutableException("JackrabbitSession expected"); + } + } + + public void testGetParentOrNullRootNode() throws Exception { + assertNull(s.getParentOrNull(s.getRootNode())); + } + + public void testGetParentOrNull() throws Exception { + Node n = s.getNode(testRoot); + assertEquivalentNode(n, s.getParentOrNull(n.getProperty(Property.JCR_PRIMARY_TYPE))); + assertEquivalentNode(n.getParent(), s.getParentOrNull(n)); + } + + private static void assertEquivalentNode(Node expected, Node result) throws Exception { + assertNotNull(result); + assertEquals(expected.getPath(), result.getPath()); + } + + // @Ignore("Jackrabbit does not check cross-Session request") + public void ignoreTestGetParentOrNullSessionMismatch() throws Exception { + JackrabbitSession guest = (JackrabbitSession) getHelper().getRepository().login(new GuestCredentials()); + try { + guest.getParentOrNull(s.getNode(testRoot)); + fail("RepositoryException expected"); + } catch (RepositoryException e) { + // success + } finally { + guest.logout(); + } + } + + // @Ignore("Jackrabbit does not verify that the Item was obtained from Jackrabbit") + public void ignoreTestGetParentOrNullImplMismatch() { + try { + Item item = mock(Item.class); + s.getParentOrNull(item); + fail("RepositoryException expected"); + } catch (RepositoryException e) { + // success + } + } +} \ No newline at end of file diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java index d3706f58726..ddcd61abc67 100644 --- a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/AbstractConcurrencyTest.java @@ -153,11 +153,11 @@ protected long getOneYearAhead() { */ protected static void dumpStacks(Thread[] threads) { try { - Method m = Thread.class.getMethod("getStackTrace", null); + Method m = Thread.class.getMethod("getStackTrace", (Class[]) null); StringBuffer dumps = new StringBuffer(); for (int t = 0; t < threads.length; t++) { StackTraceElement[] elements = (StackTraceElement[]) m.invoke( - threads[t], null); + threads[t], (Object[]) null); dumps.append(threads[t].toString()).append('\n'); for (int i = 0; i < elements.length; i++) { dumps.append("\tat " + elements[i]).append('\n'); diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestRepository.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestRepository.java index da11586e8a5..b970f2a14a2 100644 --- a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestRepository.java +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestRepository.java @@ -17,14 +17,14 @@ package org.apache.jackrabbit.core; import java.io.InputStream; -import java.util.Map; +import java.lang.reflect.Field; +import java.lang.reflect.Method; import javax.jcr.Credentials; import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.Session; -import org.apache.commons.beanutils.BeanMap; import org.apache.jackrabbit.commons.repository.ProxyRepository; import org.apache.jackrabbit.commons.repository.RepositoryFactory; import org.apache.jackrabbit.core.config.ConfigurationException; @@ -117,11 +117,16 @@ public static synchronized Repository getInstance() throws RepositoryException { private static Repository getIntegratedInstance() throws Exception { Class test = Class.forName("org.apache.jackrabbit.test.AbstractJCRTest"); - Map helper = new BeanMap(test.getField("helper").get(null)); + Field helperField = test.getField("helper"); + helperField.setAccessible(true); + Object helper = helperField.get(null); + Method getRepository = helper.getClass().getMethod("getRepository"); + Method getSuperuserCredentials = helper.getClass().getMethod("getSuperuserCredentials"); final Repository repository = - (Repository) helper.get("repository"); + (Repository) getRepository.invoke(helper); final Credentials superuser = - (Credentials) helper.get("superuserCredentials"); + (Credentials) getSuperuserCredentials.invoke(helper); + return new ProxyRepository(new RepositoryFactory() { public Repository getRepository() throws RepositoryException { diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/DbClusterTestJCR3162.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/DbClusterTestJCR3162.java index 93d36aeab05..c80d8725bbb 100644 --- a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/DbClusterTestJCR3162.java +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/DbClusterTestJCR3162.java @@ -30,14 +30,13 @@ import javax.jcr.query.Query; import javax.jcr.query.RowIterator; -import junit.framework.Assert; - import org.apache.commons.io.FileUtils; import org.apache.jackrabbit.JcrConstants; import org.apache.jackrabbit.commons.JcrUtils; import org.apache.jackrabbit.core.RepositoryImpl; import org.apache.jackrabbit.core.config.RepositoryConfig; import org.apache.jackrabbit.test.JUnitTest; +import org.junit.Assert; /** * Test for JCR3162 diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DBDataStoreTest.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DBDataStoreTest.java index 8152d197afa..d1b2c835249 100644 --- a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DBDataStoreTest.java +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DBDataStoreTest.java @@ -74,7 +74,9 @@ public void testGetRecord() throws Exception { try { assertNotNull(stream); for (int j = 0; j < data.length; j++) { - assertEquals((data[j]) & 0xff, stream.read()); + int b = stream.read(); + assertTrue("early EOF at position " + j + " of stream #" + i, b >= 0); + assertEquals("data should be equal on read of stream #" + i + " at position " + j, (data[j]) & 0xff, b); } assertEquals(-1, stream.read()); } finally { @@ -103,7 +105,7 @@ public void testDbInputStreamReset() throws Exception { // test integrity of replayed bytes byte[] replayedBytes = new byte[data.length]; int length = in.read(replayedBytes); - assertEquals(length, data.length); + assertEquals(data.length, length); for (int i = 0; i < data.length; i++) { log.append(i + " data: " + data[i] + " replayed: " + replayedBytes[i] + "\n"); @@ -175,7 +177,9 @@ public void testConcurrentRead() throws Exception { // verify the contents of all the streams, reading them in parallel for (int i = 0; i < data.length; i++) { for (int j = 0; j < streams.length; j++) { - assertEquals((data[i]) & 0xff, streams[j].read()); + int b = streams[j].read(); + assertTrue("early EOF at position " + i + " of stream #" + j, b >= 0); + assertEquals((data[i]) & 0xff, b); } } diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/RepositoryFactoryImplTest.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/RepositoryFactoryImplTest.java index 3d87ecd573e..ebc88392746 100644 --- a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/RepositoryFactoryImplTest.java +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/RepositoryFactoryImplTest.java @@ -27,6 +27,7 @@ import javax.naming.Context; import javax.jcr.RepositoryFactory; + import org.apache.jackrabbit.api.JackrabbitRepository; import org.apache.jackrabbit.commons.JcrUtils; import org.apache.jackrabbit.commons.JndiRepositoryFactory; @@ -135,12 +136,22 @@ public void testJNDI() throws Exception { parameters.put(Context.INITIAL_CONTEXT_FACTORY, DummyInitialContextFactory.class.getName()); parameters.put(Context.PROVIDER_URL, "localhost"); InitialContext context = new InitialContext(new Hashtable(parameters)); - RegistryHelper.registerRepository(context, name, - REPO_CONF.getAbsolutePath(), REPO_HOME.getAbsolutePath(), false); + try { + RegistryHelper.registerRepository(context, name, + REPO_CONF.getAbsolutePath(), REPO_HOME.getAbsolutePath(), false); + } catch (RepositoryException expected) {} try { parameters.put(JndiRepositoryFactory.JNDI_NAME, name); - repo = JcrUtils.getRepository(parameters); - checkRepository(repo); + try { + repo = JcrUtils.getRepository(parameters); + } catch (RepositoryException e) { + if (JndiRepositoryFactory.JNDI_ENABLED) { + fail("JNDI repository missing: " + e.getMessage()); + } + } + if (repo != null) { + checkRepository(repo); + } } finally { RegistryHelper.unregisterRepository(context, name); } diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/ComparableArrayTest.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/ComparableArrayTest.java index 49507d6b796..368bad8fadd 100644 --- a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/ComparableArrayTest.java +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/ComparableArrayTest.java @@ -16,7 +16,7 @@ */ package org.apache.jackrabbit.core.query.lucene; -import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.assertEquals; import javax.jcr.RepositoryException; diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SQL2IndexingAggregateTest.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SQL2IndexingAggregateTest.java index ab00e7ec8c2..1445442b3ea 100644 --- a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SQL2IndexingAggregateTest.java +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SQL2IndexingAggregateTest.java @@ -28,7 +28,7 @@ import javax.jcr.Node; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.input.NullInputStream; import org.apache.jackrabbit.JcrConstants; import org.apache.jackrabbit.commons.JcrUtils; diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedLoginTest.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedLoginTest.java index 78d8194e3ea..2e54684e526 100644 --- a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedLoginTest.java +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedLoginTest.java @@ -16,6 +16,23 @@ */ package org.apache.jackrabbit.core.security.authentication.token; +import java.lang.Thread.UncaughtExceptionHandler; +import java.security.Principal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +import javax.jcr.LoginException; +import javax.jcr.Node; +import javax.jcr.Repository; +import javax.jcr.RepositoryException; +import javax.jcr.Session; +import javax.jcr.SimpleCredentials; + import org.apache.jackrabbit.api.JackrabbitSession; import org.apache.jackrabbit.api.security.authentication.token.TokenCredentials; import org.apache.jackrabbit.api.security.principal.ItemBasedPrincipal; @@ -26,18 +43,6 @@ import org.apache.jackrabbit.test.NotExecutableException; import org.apache.jackrabbit.test.RepositoryStub; -import javax.jcr.LoginException; -import javax.jcr.Node; -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.SimpleCredentials; -import java.security.Principal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Set; - /** * TokenBasedLoginTest... */ @@ -230,120 +235,69 @@ public void testLogin() throws RepositoryException { * Tests concurrent login on the Repository including token creation. * Test copied and slightly adjusted from org.apache.jackrabbit.core.ConcurrentLoginTest */ - public void testConcurrentLogin() throws RepositoryException, NotExecutableException { - final Exception[] exception = new Exception[1]; - List testRunner = new ArrayList(); - for (int i = 0; i < 10; i++) { - testRunner.add(new Thread(new Runnable() { - public void run() { - for (int i = 0; i < 100; i++) { - try { - SimpleCredentials sc = new SimpleCredentials(testuser.getID(), testuser.getID().toCharArray()); - sc.setAttribute(TokenBasedAuthentication.TOKEN_ATTRIBUTE, ""); - - Session s = getHelper().getRepository().login(sc); - try { - Set tcs = ((SessionImpl) s).getSubject().getPublicCredentials(TokenCredentials.class); - assertFalse(tcs.isEmpty()); - } finally { - s.logout(); - } - } catch (Exception e) { - exception[0] = e; - break; - } + public void testConcurrentLogin() throws Throwable { + assertParallelExecutionSucceeds(10, new JcrRunnable() { + public void run() throws RepositoryException { + for (int i = 0; i < 100; i++) { + SimpleCredentials sc = new SimpleCredentials(testuser.getID(), testuser.getID().toCharArray()); + sc.setAttribute(TokenBasedAuthentication.TOKEN_ATTRIBUTE, ""); + + Session s = getHelper().getRepository().login(sc); + try { + Set tcs = ((SessionImpl) s).getSubject().getPublicCredentials(TokenCredentials.class); + assertFalse(tcs.isEmpty()); + } finally { + s.logout(); } } - })); - } - - // start threads - for (Object aTestRunner : testRunner) { - ((Thread) aTestRunner).start(); - } - - // join threads - for (Object aTestRunner : testRunner) { - try { - ((Thread) aTestRunner).join(); - } catch (InterruptedException e) { - fail(e.toString()); } - } + }); - if (exception[0] != null) { - fail(exception[0].toString()); - } } /** * Tests concurrent login of 3 different users on the Repository including * token creation. * Test copied and slightly adjusted from org.apache.jackrabbit.core.ConcurrentLoginTest + * @throws InterruptedException */ - public void testConcurrentLoginOfDifferentUsers() throws RepositoryException, NotExecutableException { - final Exception[] exception = new Exception[1]; - List testRunner = new ArrayList(); - for (int i = 0; i < 10; i++) { - testRunner.add(new Thread(new Runnable() { - public void run() { - for (int i = 0; i < 100; i++) { - try { - SimpleCredentials c; - double rand = 3 * Math.random(); - int index = (int) Math.floor(rand); - switch (index) { - case 0: - c = new SimpleCredentials(testuser.getID(), testuser.getID().toCharArray()); - break; - case 1: - c = new SimpleCredentials(getHelper().getProperty(RepositoryStub.PROP_PREFIX + "." + RepositoryStub.PROP_SUPERUSER_NAME), getHelper().getProperty(RepositoryStub.PROP_PREFIX + "." + RepositoryStub.PROP_SUPERUSER_PWD).toCharArray()); - break; - default: - c = new SimpleCredentials(getHelper().getProperty(RepositoryStub.PROP_PREFIX + "." + RepositoryStub.PROP_READONLY_NAME), getHelper().getProperty(RepositoryStub.PROP_PREFIX + "." + RepositoryStub.PROP_READONLY_PWD).toCharArray()); - break; - } - c.setAttribute(TokenBasedAuthentication.TOKEN_ATTRIBUTE, ""); - Session s = getHelper().getRepository().login(c); - try { - Set tcs = ((SessionImpl) s).getSubject().getPublicCredentials(TokenCredentials.class); - assertFalse(tcs.isEmpty()); - } finally { - s.logout(); - } - } catch (Exception e) { - exception[0] = e; + public void testConcurrentLoginOfDifferentUsers() throws InterruptedException { + assertParallelExecutionSucceeds(10, new JcrRunnable() { + public void run() throws RepositoryException { + for (int i = 0; i < 100; i++) { + SimpleCredentials c; + double rand = 3 * Math.random(); + int index = (int) Math.floor(rand); + switch (index) { + case 0: + c = new SimpleCredentials(testuser.getID(), testuser.getID().toCharArray()); + break; + case 1: + c = new SimpleCredentials(getHelper().getProperty(RepositoryStub.PROP_PREFIX + "." + RepositoryStub.PROP_SUPERUSER_NAME), getHelper().getProperty(RepositoryStub.PROP_PREFIX + "." + RepositoryStub.PROP_SUPERUSER_PWD).toCharArray()); break; - } + default: + c = new SimpleCredentials(getHelper().getProperty(RepositoryStub.PROP_PREFIX + "." + RepositoryStub.PROP_READONLY_NAME), getHelper().getProperty(RepositoryStub.PROP_PREFIX + "." + RepositoryStub.PROP_READONLY_PWD).toCharArray()); + break; + } + c.setAttribute(TokenBasedAuthentication.TOKEN_ATTRIBUTE, ""); + Session s = getHelper().getRepository().login(c); + try { + Set tcs = ((SessionImpl) s).getSubject().getPublicCredentials(TokenCredentials.class); + assertFalse(tcs.isEmpty()); + } finally { + s.logout(); } } - })); - } - - // start threads - for (Object aTestRunner : testRunner) { - ((Thread) aTestRunner).start(); - } - - // join threads - for (Object aTestRunner : testRunner) { - try { - ((Thread) aTestRunner).join(); - } catch (InterruptedException e) { - fail(e.toString()); } - } - - if (exception[0] != null) { - fail(exception[0].toString()); - } + }); } /** * Tests concurrent login on the Repository including token creation. * Test copied and slightly adjusted from org.apache.jackrabbit.core.ConcurrentLoginTest + * @throws InterruptedException */ - public void testConcurrentLoginDifferentWorkspaces() throws RepositoryException, NotExecutableException { + public void testConcurrentLoginDifferentWorkspaces() throws RepositoryException, NotExecutableException, InterruptedException { final String testID = testuser.getID(); // check if test is executable @@ -367,53 +321,86 @@ public void testConcurrentLoginDifferentWorkspaces() throws RepositoryException, } } - final Exception[] exception = new Exception[1]; + assertParallelExecutionSucceeds(10, new JcrRunnable() { + public void run() throws RepositoryException { + for (int i = 0; i < 100; i++) { + double rand = wspNames.size() * Math.random(); + int index = (int) Math.floor(rand); + String wspName = wspNames.get(index); + + SimpleCredentials sc = new SimpleCredentials(testID, testID.toCharArray()); + sc.setAttribute(TokenBasedAuthentication.TOKEN_ATTRIBUTE, ""); + + Session s = getHelper().getRepository().login(sc, wspName); + try { + Set tcs = ((SessionImpl) s).getSubject().getPublicCredentials(TokenCredentials.class); + assertFalse(tcs.isEmpty()); + } finally { + s.logout(); + } + } + } + }); + } + + static class UncheckedRepositoryException extends RuntimeException { + private static final long serialVersionUID = 1L; + + public UncheckedRepositoryException(RepositoryException e) { + super(e); + } + } + + /** + * Similar to {@link Runnable} but allows to throw {@link RepositoryException} in its {@link #run()} method. + */ + static interface JcrRunnable { + public void run() throws RepositoryException; + } + + private static void assertParallelExecutionSucceeds(int numThreads, JcrRunnable runnable) throws InterruptedException { List testRunner = new ArrayList(); - for (int i = 0; i < 10; i++) { + for (int i = 0; i < numThreads; i++) { testRunner.add(new Thread(new Runnable() { public void run() { - for (int i = 0; i < 100; i++) { - try { - double rand = wspNames.size() * Math.random(); - int index = (int) Math.floor(rand); - String wspName = wspNames.get(index); - - SimpleCredentials sc = new SimpleCredentials(testID, testID.toCharArray()); - sc.setAttribute(TokenBasedAuthentication.TOKEN_ATTRIBUTE, ""); - - Session s = getHelper().getRepository().login(sc, wspName); - try { - Set tcs = ((SessionImpl) s).getSubject().getPublicCredentials(TokenCredentials.class); - assertFalse(tcs.isEmpty()); - } finally { - s.logout(); - } - - } catch (Exception e) { - exception[0] = e; - break; - } + try { + runnable.run(); + } catch (RepositoryException e) { + throw new UncheckedRepositoryException(e); } } })); } + assertThreadExecutionSucceeds(testRunner); + } + /** + * Executes all given threads and waits for them to finish. Exception in any of the thread will make the calling thread die with an exception as well + * @param testRunner the threads to execute + * @throws InterruptedException + */ + private static void assertThreadExecutionSucceeds(Collection testRunner) throws InterruptedException { + Map threadExceptions = new ConcurrentHashMap<>(); // start threads - for (Object aTestRunner : testRunner) { - ((Thread) aTestRunner).start(); + for (Thread aTestRunner : testRunner) { + aTestRunner.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { + public void uncaughtException(Thread t, Throwable e) { + threadExceptions.put(t.getName() + " (id " + t.getId() +")", e); + } + } ); + aTestRunner.start(); } // join threads - for (Object aTestRunner : testRunner) { - try { - ((Thread) aTestRunner).join(); - } catch (InterruptedException e) { - fail(e.toString()); - } + for (Thread aTestRunner : testRunner) { + aTestRunner.join(); } - if (exception[0] != null) { - fail(exception[0].toString()); + // only rethrow one exception (put the other ones as suppressed) + IllegalStateException mainException = threadExceptions.entrySet().stream().findFirst().map(e -> new IllegalStateException("Thread " + e.getKey() + " failed", e.getValue())).orElse(null); + if (mainException != null) { + threadExceptions.entrySet().stream().skip(1).forEach(e -> mainException.addSuppressed(new IllegalStateException("Thread " + e.getKey() + " failed", e.getValue()))); + throw mainException; } } } \ No newline at end of file diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/NodeCreationTest.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/NodeCreationTest.java index 8773eb67e05..ee78544e2b6 100644 --- a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/NodeCreationTest.java +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/NodeCreationTest.java @@ -16,7 +16,7 @@ */ package org.apache.jackrabbit.core.security.user; -import org.apache.commons.collections.map.ListOrderedMap; +import org.apache.commons.collections4.map.ListOrderedMap; import org.apache.jackrabbit.api.security.user.AbstractUserTest; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.api.security.user.AuthorizableExistsException; diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/ModifyNonVersionableCheckedOutTest.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/ModifyNonVersionableCheckedOutTest.java new file mode 100755 index 00000000000..3f32e144cfd --- /dev/null +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/ModifyNonVersionableCheckedOutTest.java @@ -0,0 +1,87 @@ +/* + * 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. + */ +package org.apache.jackrabbit.core.version; + +import javax.jcr.Node; + +import org.apache.jackrabbit.test.AbstractJCRTest; + +public class ModifyNonVersionableCheckedOutTest extends AbstractJCRTest { + + public void testNonVersionableCheckedOut() throws Exception { + Node node = testRootNode.addNode(nodeName1, "nt:unstructured"); + superuser.save(); + + assertTrue(node.isCheckedOut()); + + node.setProperty("jcr:isCheckedOut", false); + superuser.save(); + + assertTrue(node.getPath() + " does not have mix:versionable and thus should be reported as checked out", + node.isCheckedOut()); + } + + public void testModifyNonVersionableNodeWithCheckedOutProperty() throws Exception { + Node node = testRootNode.addNode(nodeName1, "nt:unstructured"); + superuser.save(); + + assertTrue(node.isCheckedOut()); + + node.setProperty("jcr:isCheckedOut", false); + superuser.save(); + + node.setProperty("test", true); + superuser.save(); + + assertTrue(node.getProperty("test").getBoolean()); + + node.setProperty("test", false); + superuser.save(); + + assertFalse(node.getProperty("test").getBoolean()); + + node.getProperty("test").remove(); + superuser.save(); + assertFalse(node.hasProperty("test")); + + node.addNode(nodeName2, "nt:unstructured"); + superuser.save(); + + assertTrue(node.hasNode(nodeName2)); + + node.getNode(nodeName2).remove(); + superuser.save(); + + assertFalse(node.hasNode(nodeName2)); + } + + public void testAddRemoveMixinVersionable() throws Exception { + Node node = testRootNode.addNode(nodeName1, "nt:unstructured"); + node.addMixin(mixVersionable); + superuser.save(); + node.checkin(); + superuser.save(); + assertFalse(node.isCheckedOut()); + node.checkout(); + superuser.save(); + assertTrue(node.isCheckedOut()); + node.removeMixin(mixVersionable); + superuser.save(); + assertTrue(node.isCheckedOut()); + assertFalse(node.hasProperty(jcrIsCheckedOut)); + } +} diff --git a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/TestAll.java b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/TestAll.java index f3f68009ea0..60fed324a2e 100644 --- a/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/TestAll.java +++ b/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/TestAll.java @@ -39,6 +39,7 @@ public static Test suite() { suite.addTestSuite(RestoreTest.class); suite.addTestSuite(RestoreNodeWithSNSTest.class); suite.addTestSuite(VersionIteratorImplTest.class); + suite.addTestSuite(ModifyNonVersionableCheckedOutTest.class); return suite; } } diff --git a/jackrabbit-data/pom.xml b/jackrabbit-data/pom.xml index ea94ec3feed..2dc8d48acea 100644 --- a/jackrabbit-data/pom.xml +++ b/jackrabbit-data/pom.xml @@ -20,7 +20,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-data diff --git a/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java b/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java index be80f83e3cb..fff2cb8d8cd 100644 --- a/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java +++ b/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java @@ -930,6 +930,7 @@ protected synchronized MessageDigest getDigest() throws DataStoreException { * @deprecated * @return the maximum number of connections. */ + @Deprecated public int getMaxConnections() { return -1; } @@ -938,9 +939,10 @@ public int getMaxConnections() { * Set the maximum number of concurrent connections in the pool. * At least 3 connections are required if the garbage collection process is used. * - *@deprecated + * @deprecated * @param maxConnections the new value */ + @Deprecated public void setMaxConnections(int maxConnections) { // no effect } diff --git a/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DbInputStream.java b/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DbInputStream.java index 3bc2f0c50b4..99a482c5760 100644 --- a/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DbInputStream.java +++ b/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DbInputStream.java @@ -18,6 +18,7 @@ import java.io.EOFException; import java.io.IOException; +import java.io.InputStream; import java.sql.ResultSet; import org.apache.commons.io.input.AutoCloseInputStream; @@ -40,6 +41,7 @@ public class DbInputStream extends AutoCloseInputStream { protected boolean endOfStream; protected ResultSet rs; + private InputStream initialStream; /** * Create a database input stream for the given identifier. @@ -52,6 +54,7 @@ protected DbInputStream(DbDataStore store, DataIdentifier identifier) { super(null); this.store = store; this.identifier = identifier; + this.initialStream = super.in; } /** @@ -63,13 +66,11 @@ protected void openStream() throws IOException { if (endOfStream) { throw new EOFException(); } - if (in == null) { + if (in == initialStream) { try { in = store.openStream(this, identifier); } catch (DataStoreException e) { - IOException e2 = new IOException(e.getMessage()); - e2.initCause(e); - throw e2; + throw new IOException(e.getMessage(), e); } } } @@ -121,9 +122,9 @@ public int read(byte[] b, int off, int len) throws IOException { * When the stream is consumed, the database objects held by the instance are closed. */ public void close() throws IOException { - if (in != null) { + if (in != initialStream) { in.close(); - in = null; + in = initialStream; // some additional database objects // may need to be closed if (rs != null) { diff --git a/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java b/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java index fd7c7bedd31..b5409086712 100644 --- a/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java +++ b/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java @@ -26,6 +26,7 @@ * * @deprecated this class should no longer be used */ +@Deprecated public abstract class RandomAccessOutputStream extends OutputStream { /** diff --git a/jackrabbit-it-osgi/pom.xml b/jackrabbit-it-osgi/pom.xml index d7be5bf9289..db8ff449df2 100644 --- a/jackrabbit-it-osgi/pom.xml +++ b/jackrabbit-it-osgi/pom.xml @@ -23,7 +23,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml diff --git a/jackrabbit-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java b/jackrabbit-it-osgi/src/test/java/org/apache/jackrabbit/osgi/OSGiIT.java similarity index 99% rename from jackrabbit-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java rename to jackrabbit-it-osgi/src/test/java/org/apache/jackrabbit/osgi/OSGiIT.java index 8adac99ae47..fb8b0f803b2 100644 --- a/jackrabbit-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java +++ b/jackrabbit-it-osgi/src/test/java/org/apache/jackrabbit/osgi/OSGiIT.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.jackrabbit.oak.osgi; +package org.apache.jackrabbit.osgi; import static org.junit.Assert.assertEquals; import static org.ops4j.pax.exam.CoreOptions.bundle; @@ -66,8 +66,8 @@ public Option[] configuration() throws IOException, URISyntaxException { mavenBundle("org.apache.felix", "org.apache.felix.fileinstall", "3.2.6"), mavenBundle("org.slf4j", "slf4j-api", "1.7.36"), mavenBundle("commons-logging", "commons-logging", "1.2"), - mavenBundle("ch.qos.logback", "logback-core", "1.2.11"), - mavenBundle("ch.qos.logback", "logback-classic", "1.2.11"), + mavenBundle("ch.qos.logback", "logback-core", "1.2.13"), + mavenBundle("ch.qos.logback", "logback-classic", "1.2.13"), frameworkProperty("repository.home").value("target"), systemProperties( systemProperty("logback.configurationFile") diff --git a/jackrabbit-jca/pom.xml b/jackrabbit-jca/pom.xml index a22d43d9f90..1366162bf85 100644 --- a/jackrabbit-jca/pom.xml +++ b/jackrabbit-jca/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-jca @@ -130,6 +130,12 @@ org.apache.derby derby + test + + + org.apache.derby + derbytools + test diff --git a/jackrabbit-jcr-client/pom.xml b/jackrabbit-jcr-client/pom.xml index a35b8e7da49..e84ce8ce709 100644 --- a/jackrabbit-jcr-client/pom.xml +++ b/jackrabbit-jcr-client/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-jcr-client @@ -69,7 +69,6 @@ **/*Test.java target - once ${test.opts} diff --git a/jackrabbit-jcr-commons/pom.xml b/jackrabbit-jcr-commons/pom.xml index d61162c7b11..b249bb00f91 100644 --- a/jackrabbit-jcr-commons/pom.xml +++ b/jackrabbit-jcr-commons/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-jcr-commons @@ -88,12 +88,6 @@ junit test - - cglib - cglib - 3.3.0 - test - com.googlecode.json-simple json-simple @@ -106,6 +100,11 @@ 0.11.4.1 test + + org.mockito + mockito-core + test + diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/JcrConstants.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/JcrConstants.java index 3b15c90d876..6a4332eb9f8 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/JcrConstants.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/JcrConstants.java @@ -19,203 +19,214 @@ import javax.jcr.Session; /** - * This Interface defines some of the item names that are defined in the - * jcr spec 1.0, using the default prefixes 'jcr', 'nt' and 'mix'. Please note - * that those prefixes can by redefined by an application using the + * This interface defines some of the item names that are defined in the JCR Specification 1.0 in the qualified form, + * using the default prefixes {@code jcr}, {@code nt} and {@code mix}. + *

+ * Please note that those prefixes can by redefined by an application using the * {@link Session#setNamespacePrefix(String, String)} method. As a result, the * constants may not refer to the respective items. + *

+ * On the other hand, the constants in {@link javax.jcr.nodetype.NodeType}, + * {@link javax.jcr.Node}, {@link javax.jcr.Property} and {@link javax.jcr.Workspace} + * are more complete (covering JCR 2.0 + * as well) and also define names using expanded form, which is immune to session local + * remappings, so it is recommended to use those constants instead whenever possible. */ public interface JcrConstants { /** - * jcr:autoCreated + * Use {@link javax.jcr.Property#JCR_AUTOCREATED} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_AUTOCREATED = "jcr:autoCreated"; /** - * jcr:baseVersion + * Use {@link javax.jcr.Property#JCR_BASE_VERSION} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_BASEVERSION = "jcr:baseVersion"; - /** - * jcr:child - */ + public static final String JCR_CHILD = "jcr:child"; /** - * jcr:childNodeDefinition + * Use {@link javax.jcr.Node#JCR_CHILD_NODE_DEFINITION} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_CHILDNODEDEFINITION = "jcr:childNodeDefinition"; /** - * jcr:content + * Use {@link javax.jcr.Node#JCR_CONTENT} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_CONTENT = "jcr:content"; /** - * jcr:created + * Use {@link javax.jcr.Property#JCR_CREATED} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_CREATED = "jcr:created"; /** - * jcr:data + * Use {@link javax.jcr.Property#JCR_DATA} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_DATA = "jcr:data"; /** - * jcr:defaultPrimaryType + * Use {@link javax.jcr.Property#JCR_DEFAULT_PRIMARY_TYPE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_DEFAULTPRIMARYTYPE = "jcr:defaultPrimaryType"; /** - * jcr:defaultValues + * Use {@link javax.jcr.Property#JCR_DEFAULT_VALUES} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_DEFAULTVALUES = "jcr:defaultValues"; /** - * jcr:encoding + * Use {@link javax.jcr.Property#JCR_ENCODING} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_ENCODING = "jcr:encoding"; /** - * jcr:frozenMixinTypes + * Use {@link javax.jcr.Property#JCR_FROZEN_MIXIN_TYPES} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_FROZENMIXINTYPES = "jcr:frozenMixinTypes"; /** - * jcr:frozenNode + * Use {@link javax.jcr.Node#JCR_FROZEN_NODE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_FROZENNODE = "jcr:frozenNode"; /** - * jcr:frozenPrimaryType + * Use {@link javax.jcr.Property#JCR_FROZEN_PRIMARY_TYPE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_FROZENPRIMARYTYPE = "jcr:frozenPrimaryType"; /** - * jcr:frozenUuid + * Use {@link javax.jcr.Property#JCR_FROZEN_UUID} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_FROZENUUID = "jcr:frozenUuid"; /** - * jcr:hasOrderableChildNodes + * Use {@link javax.jcr.Property#JCR_HAS_ORDERABLE_CHILD_NODES} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_HASORDERABLECHILDNODES = "jcr:hasOrderableChildNodes"; /** - * jcr:isCheckedOut + * Use {@link javax.jcr.Property#JCR_IS_CHECKED_OUT} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_ISCHECKEDOUT = "jcr:isCheckedOut"; /** - * jcr:isMixin + * Use {@link javax.jcr.Property#JCR_IS_MIXIN} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_ISMIXIN = "jcr:isMixin"; /** - * jcr:language + * Use {@link javax.jcr.Property#JCR_LANGUAGE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_LANGUAGE = "jcr:language"; /** - * jcr:lastModified + * Use {@link javax.jcr.Property#JCR_LAST_MODIFIED} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_LASTMODIFIED = "jcr:lastModified"; /** - * jcr:lockIsDeep + * Use {@link javax.jcr.Property#JCR_LOCK_IS_DEEP} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_LOCKISDEEP = "jcr:lockIsDeep"; /** - * jcr:lockOwner + * Use {@link javax.jcr.Property#JCR_LOCK_OWNER} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_LOCKOWNER = "jcr:lockOwner"; /** - * jcr:mandatory + * Use {@link javax.jcr.Property#JCR_MANDATORY} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_MANDATORY = "jcr:mandatory"; /** - * jcr:mergeFailed + * Use {@link javax.jcr.Property#JCR_MERGE_FAILED} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_MERGEFAILED = "jcr:mergeFailed"; /** - * jcr:mimeType + * Use {@link javax.jcr.Property#JCR_MIMETYPE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_MIMETYPE = "jcr:mimeType"; /** - * jcr:mixinTypes + * Use {@link javax.jcr.Property#JCR_MIXIN_TYPES} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_MIXINTYPES = "jcr:mixinTypes"; /** - * jcr:multiple + * Use {@link javax.jcr.Property#JCR_MULTIPLE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_MULTIPLE = "jcr:multiple"; /** - * jcr:name + * Use {@link javax.jcr.Property#JCR_NAME} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_NAME = "jcr:name"; /** - * jcr:nodeTypeName + * Use {@link javax.jcr.Property#JCR_NODE_TYPE_NAME} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_NODETYPENAME = "jcr:nodeTypeName"; /** - * jcr:onParentVersion + * Use {@link javax.jcr.Property#JCR_ON_PARENT_VERSION} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_ONPARENTVERSION = "jcr:onParentVersion"; /** - * jcr:predecessors + * Use {@link javax.jcr.Property#JCR_PREDECESSORS} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_PREDECESSORS = "jcr:predecessors"; /** - * jcr:primaryItemName + * Use {@link javax.jcr.Property#JCR_PRIMARY_ITEM_NAME} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_PRIMARYITEMNAME = "jcr:primaryItemName"; /** - * jcr:primaryType + * Use {@link javax.jcr.Property#JCR_PRIMARY_TYPE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_PRIMARYTYPE = "jcr:primaryType"; /** - * jcr:propertyDefinition + * Use {@link javax.jcr.Node#JCR_PROPERTY_DEFINITION} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_PROPERTYDEFINITION = "jcr:propertyDefinition"; /** - * jcr:protected + * Use {@link javax.jcr.Property#JCR_PROTECTED} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_PROTECTED = "jcr:protected"; /** - * jcr:requiredPrimaryTypes + * Use {@link javax.jcr.Property#JCR_REQUIRED_PRIMARY_TYPES} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_REQUIREDPRIMARYTYPES = "jcr:requiredPrimaryTypes"; /** - * jcr:requiredType + * Use {@link javax.jcr.Property#JCR_REQUIRED_TYPE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_REQUIREDTYPE = "jcr:requiredType"; /** - * jcr:rootVersion + * Use {@link javax.jcr.Node#JCR_ROOT_VERSION} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_ROOTVERSION = "jcr:rootVersion"; /** * jcr:sameNameSiblings + * Use {@link javax.jcr.Property#JCR_SAME_NAME_SIBLINGS} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_SAMENAMESIBLINGS = "jcr:sameNameSiblings"; /** - * jcr:statement + * Use {@link javax.jcr.Property#JCR_STATEMENT} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_STATEMENT = "jcr:statement"; /** - * jcr:successors + * Use {@link javax.jcr.Property#JCR_SUCCESSORS} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_SUCCESSORS = "jcr:successors"; /** - * jcr:supertypes + * Use {@link javax.jcr.Property#JCR_SUPERTYPES} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_SUPERTYPES = "jcr:supertypes"; /** - * jcr:system + * Use {@link javax.jcr.Workspace#NAME_SYSTEM_NODE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_SYSTEM = "jcr:system"; /** - * jcr:uuid + * Use {@link javax.jcr.Property#JCR_TITLE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). + */ + public static final String JCR_TITLE = "jcr:title"; + /** + * Use {@link javax.jcr.Property#JCR_UUID} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_UUID = "jcr:uuid"; /** - * jcr:valueConstraints + * Use {@link javax.jcr.Property#JCR_VALUE_CONSTRAINTS} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_VALUECONSTRAINTS = "jcr:valueConstraints"; /** - * jcr:versionHistory + * Use {@link javax.jcr.Property#JCR_VERSION_HISTORY} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_VERSIONHISTORY = "jcr:versionHistory"; /** - * jcr:versionLabels + * Use {@link javax.jcr.Node#JCR_VERSION_LABELS} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_VERSIONLABELS = "jcr:versionLabels"; /** - * jcr:versionStorage + * Use {@link javax.jcr.Workspace#NAME_VERSION_STORAGE_NODE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_VERSIONSTORAGE = "jcr:versionStorage"; /** - * jcr:versionableUuid + * Use {@link javax.jcr.Property#JCR_VERSIONABLE_UUID} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String JCR_VERSIONABLEUUID = "jcr:versionableUuid"; @@ -229,75 +240,103 @@ public interface JcrConstants { public static final String JCR_SCORE = "jcr:score"; /** - * mix:lockable + * Use {@link javax.jcr.nodetype.NodeType#MIX_CREATED} whenever expanded JCR names are supported (e.g. in JCR API method parameters). + */ + public static final String MIX_CREATED = "mix:created"; + /** + * Use {@link javax.jcr.nodetype.NodeType#MIX_LANGUAGE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). + */ + public static final String MIX_LANGUAGE = "mix:language"; + /** + * Use {@link javax.jcr.nodetype.NodeType#MIX_LAST_MODIFIED} whenever expanded JCR names are supported (e.g. in JCR API method parameters). + */ + public static final String MIX_LAST_MODIFIED = "mix:lastModified"; + /** + * Use {@link javax.jcr.nodetype.NodeType#MIX_LIFECYCLE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). + */ + public static final String MIX_LIFECYCLE = "mix:lifecycle"; + /** + * Use {@link javax.jcr.nodetype.NodeType#MIX_LOCKABLE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String MIX_LOCKABLE = "mix:lockable"; /** - * mix:referenceable + * Use {@link javax.jcr.nodetype.NodeType#MIX_MIMETYPE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). + */ + public static final String MIX_MIMETYPE = "mix:mimetype"; + /** + * Use {@link javax.jcr.nodetype.NodeType#MIX_REFERENCEABLE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String MIX_REFERENCEABLE = "mix:referenceable"; /** - * mix:versionable + * Use {@link javax.jcr.nodetype.NodeType#MIX_SIMPLE_VERSIONABLE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). + */ + public static final String MIX_SIMPLE_VERSIONABLE = "mix:simpleVersionable"; + /** + * Use {@link javax.jcr.nodetype.NodeType#MIX_VERSIONABLE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String MIX_VERSIONABLE = "mix:versionable"; /** - * mix:shareable + * Use {@link javax.jcr.nodetype.NodeType#MIX_SHAREABLE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String MIX_SHAREABLE = "mix:shareable"; /** - * nt:base + * Use {@link javax.jcr.nodetype.NodeType#MIX_TITLE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). + */ + public static final String MIX_TITLE = "mix:title"; + /** + * Use {@link javax.jcr.nodetype.NodeType#NT_BASE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_BASE = "nt:base"; /** - * nt:childNodeDefinition + * Use {@link javax.jcr.nodetype.NodeType#NT_CHILD_NODE_DEFINITION} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_CHILDNODEDEFINITION = "nt:childNodeDefinition"; /** - * nt:file + * Use {@link javax.jcr.nodetype.NodeType#NT_FILE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_FILE = "nt:file"; /** - * nt:folder + * Use {@link javax.jcr.nodetype.NodeType#NT_FOLDER} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_FOLDER = "nt:folder"; /** - * nt:frozenNode + * Use {@link javax.jcr.nodetype.NodeType#NT_FROZEN_NODE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_FROZENNODE = "nt:frozenNode"; /** - * nt:hierarchyNode + * Use {@link javax.jcr.nodetype.NodeType#NT_HIERARCHY_NODE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_HIERARCHYNODE = "nt:hierarchyNode"; /** - * nt:linkedFile + * Use {@link javax.jcr.nodetype.NodeType#NT_LINKED_FILE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_LINKEDFILE = "nt:linkedFile"; /** - * nt:nodeType + * Use {@link javax.jcr.nodetype.NodeType#NT_NODE_TYPE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_NODETYPE = "nt:nodeType"; /** - * nt:propertyDefinition + * Use {@link javax.jcr.nodetype.NodeType#NT_PROPERTY_DEFINITION} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_PROPERTYDEFINITION = "nt:propertyDefinition"; /** - * nt:query + * Use {@link javax.jcr.nodetype.NodeType#NT_QUERY} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_QUERY = "nt:query"; /** - * nt:resource + * Use {@link javax.jcr.nodetype.NodeType#NT_RESOURCE} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_RESOURCE = "nt:resource"; /** - * nt:unstructured + * Use {@link javax.jcr.nodetype.NodeType#NT_UNSTRUCTURED} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_UNSTRUCTURED = "nt:unstructured"; /** - * nt:version + * Use {@link javax.jcr.nodetype.NodeType#NT_VERSION} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_VERSION = "nt:version"; /** - * nt:versionHistory + * Use {@link javax.jcr.nodetype.NodeType#NT_VERSION_HISTORY} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_VERSIONHISTORY = "nt:versionHistory"; /** @@ -305,7 +344,7 @@ public interface JcrConstants { */ public static final String NT_VERSIONLABELS = "nt:versionLabels"; /** - * nt:versionedChild + * Use {@link javax.jcr.nodetype.NodeType#NT_VERSIONED_CHILD} whenever expanded JCR names are supported (e.g. in JCR API method parameters). */ public static final String NT_VERSIONEDCHILD = "nt:versionedChild"; } diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/JndiRepositoryFactory.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/JndiRepositoryFactory.java index 92274df6f3f..83eca3032f7 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/JndiRepositoryFactory.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/JndiRepositoryFactory.java @@ -56,6 +56,11 @@ @SuppressWarnings({ "rawtypes", "unchecked" }) public class JndiRepositoryFactory implements RepositoryFactory { + /** + * Disabled by default, see JCR-5135 + */ + public static final boolean JNDI_ENABLED = Boolean.getBoolean("jackrabbit.jndi.enabled"); + /** * The JNDI name parameter name. */ @@ -64,29 +69,32 @@ public class JndiRepositoryFactory implements RepositoryFactory { public Repository getRepository(Map parameters) throws RepositoryException { - if (parameters == null) { - return null; // no default JNDI repository - } else { - Hashtable environment = new Hashtable(parameters); - if (environment.containsKey(JNDI_NAME)) { - String name = environment.remove(JNDI_NAME).toString(); - return getRepository(name, environment); - } else if (environment.containsKey(JcrUtils.REPOSITORY_URI)) { - Object parameter = environment.remove(JcrUtils.REPOSITORY_URI); - try { - URI uri = new URI(parameter.toString().trim()); - if ("jndi".equalsIgnoreCase(uri.getScheme())) { - return getRepository(uri, environment); - } else { - return null; // not a jndi: URI + if (JNDI_ENABLED) { + if (parameters == null) { + return null; // no default JNDI repository + } else { + Hashtable environment = new Hashtable(parameters); + if (environment.containsKey(JNDI_NAME)) { + String name = environment.remove(JNDI_NAME).toString(); + return getRepository(name, environment); + } else if (environment.containsKey(JcrUtils.REPOSITORY_URI)) { + Object parameter = environment.remove(JcrUtils.REPOSITORY_URI); + try { + URI uri = new URI(parameter.toString().trim()); + if ("jndi".equalsIgnoreCase(uri.getScheme())) { + return getRepository(uri, environment); + } else { + return null; // not a jndi: URI + } + } catch (URISyntaxException e) { + return null; // not a valid URI } - } catch (URISyntaxException e) { - return null; // not a valid URI + } else { + return null; // unknown parameters } - } else { - return null; // unknown parameters } } + return null; } private Repository getRepository(URI uri, Hashtable environment) diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/FilterIterator.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/FilterIterator.java index 8b18b423ae9..417b0e44d76 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/FilterIterator.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/FilterIterator.java @@ -26,6 +26,7 @@ * @param * @deprecated use {@link org.apache.jackrabbit.commons.iterator.FilterIterator} */ +@Deprecated public class FilterIterator extends org.apache.jackrabbit.commons.iterator.FilterIterator { /** diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/SizedIterator.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/SizedIterator.java index da083efcd24..364f1701973 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/SizedIterator.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/SizedIterator.java @@ -23,5 +23,6 @@ * @param the type of elements of this iterator * @deprecated use {@link org.apache.jackrabbit.commons.iterator.SizedIterator} */ +@Deprecated public interface SizedIterator extends org.apache.jackrabbit.commons.iterator.SizedIterator { } diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/package-info.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/package-info.java index 42b3b486607..7eb2a8d1414 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/package-info.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/package-info.java @@ -14,5 +14,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@org.osgi.annotation.versioning.Version("2.4.0") +@org.osgi.annotation.versioning.Version("2.5.0") package org.apache.jackrabbit.commons; diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/JNDIRepository.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/JNDIRepository.java index c8eff32952b..ffd94138f6c 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/JNDIRepository.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/JNDIRepository.java @@ -24,9 +24,13 @@ * does not need to exist when this class is instantiated. The JNDI entry * can also be replaced with another repository during the lifetime of an * instance of this class. + *

+ * This class is deprecated and will be removed in future releases. * * @since 1.4 + * @deprecated use {@link ProxyRepository} instead */ +@Deprecated(forRemoval = true) public class JNDIRepository extends ProxyRepository { /** @@ -38,5 +42,4 @@ public class JNDIRepository extends ProxyRepository { public JNDIRepository(Context context, String name) { super(new JNDIRepositoryFactory(context, name)); } - } diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/JNDIRepositoryFactory.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/JNDIRepositoryFactory.java index 15646532644..c211c44444f 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/JNDIRepositoryFactory.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/JNDIRepositoryFactory.java @@ -21,11 +21,17 @@ import javax.naming.Context; import javax.naming.NamingException; +import static org.apache.jackrabbit.commons.JndiRepositoryFactory.JNDI_ENABLED; + /** * Factory that looks up a repository from JNDI. + *

+ * This class is deprecated and will be removed in future releases. * * @since 1.4 + * @deprecated use {@link org.apache.jackrabbit.commons.JndiRepositoryFactory} instead */ +@Deprecated(forRemoval = true) public class JNDIRepositoryFactory implements RepositoryFactory { /** @@ -56,25 +62,28 @@ public JNDIRepositoryFactory(Context context, String name) { * @throws RepositoryException if the repository can not be found */ public Repository getRepository() throws RepositoryException { - try { - Object repository = context.lookup(name); - if (repository instanceof Repository) { - return (Repository) repository; - } else if (repository == null) { - throw new RepositoryException( - "Repository not found: The JNDI entry " - + name + " is null"); - } else { + if (JNDI_ENABLED) { + try { + Object repository = context.lookup(name); + if (repository instanceof Repository) { + return (Repository) repository; + } else if (repository == null) { + throw new RepositoryException( + "Repository not found: The JNDI entry " + + name + " is null"); + } else { + throw new RepositoryException( + "Invalid repository: The JNDI entry " + + name + " is an instance of " + + repository.getClass().getName()); + } + } catch (NamingException e) { throw new RepositoryException( - "Invalid repository: The JNDI entry " - + name + " is an instance of " - + repository.getClass().getName()); + "Repository not found: The JNDI entry " + name + + " could not be looked up", e); } - } catch (NamingException e) { - throw new RepositoryException( - "Repository not found: The JNDI entry " + name - + " could not be looked up", e); } + return null; } } diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/package-info.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/package-info.java index 26f32fe40f9..3dae34a6ab9 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/package-info.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/package-info.java @@ -14,5 +14,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@org.osgi.annotation.versioning.Version("2.2") +@org.osgi.annotation.versioning.Version("2.3") package org.apache.jackrabbit; diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java index 0b860bc904f..b6afc77c1da 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.BitSet; import java.util.Properties; +import java.util.Set; /** * This Class provides some text related utilities @@ -41,6 +42,8 @@ private Text() { */ public static final char[] hexTable = "0123456789abcdef".toCharArray(); + private static final Set INVALID_JCR_LOCAL_NAME_CHARS = Set.of( '/', ':', '[', ']', '*', '|'); + /** * Calculate an MD5 hash of the string given. * @@ -466,6 +469,10 @@ public static String unescape(String string) { * char ::= nonspace | ' ' * nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', '|' or any whitespace character *) * + *

+ * Note that just using this method does not necessarily return a string which is a + * valid local name. + * You still have to take care of invalid XML characters. * * @param name the name to escape * @return the escaped name @@ -567,6 +574,31 @@ public static String unescapeIllegalJcrChars(String name) { return buffer.toString(); } + /** + * Checks if the given name is a valid JCR local name. + *

+ * Note that the return value of {@link #escapeIllegalJcrChars(String)} is not necessarily a valid local name. + * You still have to take care of invalid XML characters. + * + * @param localName the string value to check + * @return true if the name is valid, false otherwise. + * @see JCR 2.0 Spec, §3.2.2 Local Names + * @see #escapeIllegalJcrChars(String) + * @since 2.6.0 (Apache Jackrabbit 2.24.0) + */ + public static boolean isValidJcrLocalName(String localName) { + if (localName == null || localName.isEmpty()) { + return false; + } + // self or parent are invalid + if (localName.equals(".") || localName.equals("..")) { + return false; + } + return localName.chars().noneMatch(c -> + INVALID_JCR_LOCAL_NAME_CHARS.contains((char) c) || !XMLChar.isValid(c) + ); + } + /** * Returns the name part of the path. If the given path is already a name * (i.e. contains no slashes) it is returned. diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java index d19e90cb32d..d071cd9828c 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/XMLChar.java @@ -5,9 +5,9 @@ * 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. @@ -68,10 +68,10 @@ public class XMLChar { /** Pubid character mask. */ public static final int MASK_PUBID = 0x10; - - /** + + /** * Content character mask. Special characters are those that can - * be considered the start of markup, such as '<' and '&'. + * be considered the start of markup, such as '<' and '&'. * The various newline characters are considered special as well. * All other valid XML characters can be considered content. *

@@ -90,10 +90,10 @@ public class XMLChar { // static { - + // Initializing the Character Flag Array // Code generated by: XMLCharGenerator. - + CHARS[9] = 35; CHARS[10] = 19; CHARS[13] = 19; @@ -897,21 +897,23 @@ public static boolean isPubid(int c) { * @return true if name is a valid Name */ public static boolean isValidName(String name) { - if (name.length() == 0) + final int length = name.length(); + if (length == 0) { return false; + } char ch = name.charAt(0); - if( isNameStart(ch) == false) - return false; - for (int i = 1; i < name.length(); i++ ) { - ch = name.charAt(i); - if( isName( ch ) == false ){ - return false; - } + if (!isNameStart(ch)) { + return false; + } + for (int i = 1; i < length; ++i) { + ch = name.charAt(i); + if (!isName(ch)) { + return false; + } } return true; } // isValidName(String):boolean - - + /* * from the namespace rec * [4] NCName ::= (Letter | '_') (NCNameChar)* @@ -924,16 +926,19 @@ public static boolean isValidName(String name) { * @return true if name is a valid NCName */ public static boolean isValidNCName(String ncName) { - if (ncName.length() == 0) + final int length = ncName.length(); + if (length == 0) { return false; + } char ch = ncName.charAt(0); - if( isNCNameStart(ch) == false) - return false; - for (int i = 1; i < ncName.length(); i++ ) { - ch = ncName.charAt(i); - if( isNCName( ch ) == false ){ - return false; - } + if (!isNCNameStart(ch)) { + return false; + } + for (int i = 1; i < length; ++i) { + ch = ncName.charAt(i); + if (!isNCName(ch)) { + return false; + } } return true; } // isValidNCName(String):boolean @@ -946,16 +951,18 @@ public static boolean isValidNCName(String ncName) { * in the XML 1.0 Recommendation * * @param nmtoken string to check - * @return true if nmtoken is a valid Nmtoken + * @return true if nmtoken is a valid Nmtoken */ public static boolean isValidNmtoken(String nmtoken) { - if (nmtoken.length() == 0) + final int length = nmtoken.length(); + if (length == 0) { return false; - for (int i = 0; i < nmtoken.length(); i++ ) { - char ch = nmtoken.charAt(i); - if( ! isName( ch ) ){ - return false; - } + } + for (int i = 0; i < length; ++i) { + char ch = nmtoken.charAt(i); + if (!isName(ch)) { + return false; + } } return true; } // isValidName(String):boolean diff --git a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/package-info.java b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/package-info.java index ebb06936161..ccfc068b292 100644 --- a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/package-info.java +++ b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/package-info.java @@ -14,5 +14,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@org.osgi.annotation.versioning.Version("2.5.0") +@org.osgi.annotation.versioning.Version("2.6.0") package org.apache.jackrabbit.util; diff --git a/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/AbstractRepositoryTest.java b/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/AbstractRepositoryTest.java index 5aecae67828..30e0eacde3c 100644 --- a/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/AbstractRepositoryTest.java +++ b/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/AbstractRepositoryTest.java @@ -16,15 +16,20 @@ */ package org.apache.jackrabbit.commons; +import junit.framework.TestCase; + import javax.jcr.Credentials; import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.SimpleCredentials; +import org.mockito.Mockito; +import org.mockito.internal.verification.Times; + /** * Test cases for the {@link AbstractRepositoryTest} class. */ -public class AbstractRepositoryTest extends MockCase { +public class AbstractRepositoryTest extends TestCase { /** * Tests the {@link AbstractRepository#login()} method. @@ -32,13 +37,10 @@ public class AbstractRepositoryTest extends MockCase { * @throws RepositoryException if an error occurs */ public void testLogin() throws RepositoryException { - Repository repository = (Repository) record(AbstractRepository.class); + Repository repository = Mockito.spy(AbstractRepository.class); repository.login(null, null); - - replay(); repository.login(); - - verify(); + Mockito.verify(repository, new Times(2)).login(null, null); } /** @@ -48,14 +50,10 @@ public void testLogin() throws RepositoryException { */ public void testLoginWithCredentials() throws RepositoryException { Credentials credentials = new SimpleCredentials("", "".toCharArray()); - - Repository repository = (Repository) record(AbstractRepository.class); + Repository repository = Mockito.spy(AbstractRepository.class); repository.login(credentials, null); - - replay(); repository.login(credentials); - - verify(); + Mockito.verify(repository, new Times(2)).login(credentials, null); } /** @@ -65,13 +63,10 @@ public void testLoginWithCredentials() throws RepositoryException { * @throws RepositoryException if an error occurs */ public void testLoginWithNullCredentials() throws RepositoryException { - Repository repository = (Repository) record(AbstractRepository.class); + Repository repository = Mockito.spy(AbstractRepository.class); repository.login(null, null); - - replay(); repository.login((Credentials) null); - - verify(); + Mockito.verify(repository, new Times(2)).login(null, null); } /** @@ -80,13 +75,10 @@ public void testLoginWithNullCredentials() throws RepositoryException { * @throws RepositoryException if an error occurs */ public void testLoginWithWorkspace() throws RepositoryException { - Repository repository = (Repository) record(AbstractRepository.class); + Repository repository = Mockito.spy(AbstractRepository.class); repository.login(null, "workspace"); - - replay(); repository.login("workspace"); - - verify(); + Mockito.verify(repository, new Times(2)).login(null, "workspace"); } /** @@ -96,12 +88,9 @@ public void testLoginWithWorkspace() throws RepositoryException { * @throws RepositoryException if an error occurs */ public void testLoginWithNullWorkspace() throws RepositoryException { - Repository repository = (Repository) record(AbstractRepository.class); + Repository repository = Mockito.spy(AbstractRepository.class); repository.login(null, null); - - replay(); repository.login((String) null); - - verify(); + Mockito.verify(repository, new Times(2)).login(null, null); } } diff --git a/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/JcrUtilsTest.java b/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/JcrUtilsTest.java index 007bef3d112..e44224ee333 100644 --- a/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/JcrUtilsTest.java +++ b/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/JcrUtilsTest.java @@ -16,6 +16,8 @@ */ package org.apache.jackrabbit.commons; +import junit.framework.TestCase; + import java.util.Arrays; import java.util.HashMap; import java.util.Hashtable; @@ -26,10 +28,12 @@ import javax.jcr.RepositoryException; import javax.naming.InitialContext; -public class JcrUtilsTest extends MockCase { +import org.mockito.Mockito; + +public class JcrUtilsTest extends TestCase { public void testGetRepository() throws Exception { - Object repository = record(AbstractRepository.class); + Object repository = Mockito.spy(AbstractRepository.class); Hashtable environment = new Hashtable(); environment.put( @@ -47,20 +51,52 @@ public void testGetRepository() throws Exception { "java.naming.factory.initial", "org.osjava.sj.memory.MemoryContextFactory"); parameters.put("org.osjava.sj.jndi.shared", "true"); - assertTrue(repository == JcrUtils.getRepository(parameters)); + + // JDNI ist disabled by default + if (JndiRepositoryFactory.JNDI_ENABLED) { + assertTrue(repository == JcrUtils.getRepository(parameters)); + } else { + try { + JcrUtils.getRepository(parameters); + fail("Repository lookup should fail and throw an exception"); + } catch (RepositoryException expected) {} + } // Test lookup with URI query parameters - assertTrue(repository == JcrUtils.getRepository( - "jndi://x" - + "?org.apache.jackrabbit.repository.jndi.name=repository" - + "&org.osjava.sj.jndi.shared=true" - + "&java.naming.factory.initial" - + "=org.osjava.sj.memory.MemoryContextFactory")); + // JDNI ist disabled by default + if (JndiRepositoryFactory.JNDI_ENABLED) { + assertTrue(repository == JcrUtils.getRepository( + "jndi://x" + + "?org.apache.jackrabbit.repository.jndi.name=repository" + + "&org.osjava.sj.jndi.shared=true" + + "&java.naming.factory.initial" + + "=org.osjava.sj.memory.MemoryContextFactory")); + } else { + try { + JcrUtils.getRepository( + "jndi://x" + + "?org.apache.jackrabbit.repository.jndi.name=repository" + + "&org.osjava.sj.jndi.shared=true" + + "&java.naming.factory.initial" + + "=org.osjava.sj.memory.MemoryContextFactory"); + fail("Repository lookup should fail and throw an exception"); + } catch (RepositoryException expected) {} + } // Test lookup with the custom JNDI URI format (JCR-2771) - assertTrue(repository == JcrUtils.getRepository( - "jndi://org.osjava.sj.memory.MemoryContextFactory/repository" - + "?org.osjava.sj.jndi.shared=true")); + // JDNI ist disabled by default + if (JndiRepositoryFactory.JNDI_ENABLED) { + assertTrue(repository == JcrUtils.getRepository( + "jndi://org.osjava.sj.memory.MemoryContextFactory/repository" + + "?org.osjava.sj.jndi.shared=true")); + } else { + try { + JcrUtils.getRepository( + "jndi://org.osjava.sj.memory.MemoryContextFactory/repository" + + "?org.osjava.sj.jndi.shared=true"); + fail("Repository lookup should fail and throw an exception"); + } catch (RepositoryException expected) {} + } try { JcrUtils.getRepository( diff --git a/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/MockCase.java b/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/MockCase.java deleted file mode 100644 index c73967f0a26..00000000000 --- a/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/commons/MockCase.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.commons; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.LinkedList; - -import junit.framework.TestCase; - -import net.sf.cglib.proxy.Enhancer; -import net.sf.cglib.proxy.MethodInterceptor; -import net.sf.cglib.proxy.MethodProxy; - -/** - * Simple {@link TestCase} base class for mock-testing the abstract - * JCR implementation classes in this package. - */ -public class MockCase extends TestCase implements MethodInterceptor { - - /** - * Mock test state. Set to true when the mock methods - * are being recorded, and to false when the methods are - * being played back. - */ - private boolean recording; - - /** - * The recorded mock call sequence. List of {@link MethodCall} objects. - */ - private LinkedList calls; - - /** - * The abstract base class being tested. - */ - private Class base; - - /** - * Creates a mocked proxy object for the given abstract base class and - * starts recording calls to the object. - * - * @param base the abstract base class being tested - * @return mocked proxy object - */ - protected Object record(Class base) { - this.recording = true; - this.calls = new LinkedList(); - this.base = base; - return Enhancer.create(base, base.getInterfaces(), this); - } - - /** - * Switches the test state to replaying and verifying the recorded - * call sequence. - */ - protected void replay() { - recording = false; - } - - /** - * Verifies that all recorded method calls were executed during - * the verification phase. - */ - protected void verify() { - assertTrue(calls.isEmpty()); - } - - //---------------------------------------------------< MethodInterceptor > - - /** - * Intercepts a method call to the mocked proxy object. Passes the - * call through if the abstract base class being tested implements the - * method, and records or verifies the method call otherwise. - * - * @param object the object on which the method is being called - * @param method the method being called - * @param args method arguments - * @param proxy proxy for re-invoking the called method - * @return method return value - * @throws Throwable if an error occurs - */ - public Object intercept( - Object object, Method method, Object[] args, MethodProxy proxy) - throws Throwable { - try { - base.getDeclaredMethod(method.getName(), method.getParameterTypes()); - return proxy.invokeSuper(object, args); - } catch (NoSuchMethodException e) { - if (recording) { - calls.addLast(new MethodCall(method, args)); - } else { - assertFalse(calls.isEmpty()); - MethodCall call = (MethodCall) calls.removeFirst(); - call.assertCall(method, args); - } - return null; - } - } - - //----------------------------------------------------------< MethodCall > - - /** - * Record of a method call. - */ - private static class MethodCall { - - /** - * The method that was called. - */ - private final Method method; - - /** - * The arguments that were passed to the method. - */ - private final Object[] args; - - /** - * Creates a new method call record. - * - * @param method the method that was called - * @param args the arguments that were passed to the method - */ - public MethodCall(Method method, Object[] args) { - this.method = method; - this.args = args; - } - - /** - * Verifies that the given method is the same as was recorded. - * - * @param method the method that was called - * @param args the arguments that were passed to the method - */ - public void assertCall(Method method, Object[] args) { - assertEquals(this.method, method); - assertTrue(Arrays.equals(this.args, args)); - } - - } - -} diff --git a/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java b/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java index 1375aff26ff..6d034c3834c 100644 --- a/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java +++ b/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java @@ -202,4 +202,14 @@ public void testEscapeXML() { public void testEscapeHTML() { assertEquals("&<>'"", Text.encodeIllegalHTMLCharacters("&<>'\"")); } + + public void testIsValidJcrLocalName() { + assertTrue(Text.isValidJcrLocalName("valid%Name..\n\r test.\"'")); + assertFalse(Text.isValidJcrLocalName("invalid|name")); + assertFalse(Text.isValidJcrLocalName("some:name")); + // containing non XML characters (unicode control character) + assertFalse(Text.isValidJcrLocalName("\u000FinvalidName")); + assertFalse(Text.isValidJcrLocalName("..")); + assertFalse(Text.isValidJcrLocalName(".")); + } } diff --git a/jackrabbit-jcr-rmi/HEADER.txt b/jackrabbit-jcr-rmi/HEADER.txt deleted file mode 100644 index ae6f28c4a1c..00000000000 --- a/jackrabbit-jcr-rmi/HEADER.txt +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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. - */ diff --git a/jackrabbit-jcr-rmi/README.txt b/jackrabbit-jcr-rmi/README.txt deleted file mode 100644 index 837df5bb00d..00000000000 --- a/jackrabbit-jcr-rmi/README.txt +++ /dev/null @@ -1,12 +0,0 @@ -=================================================== -Apache Jackrabbit JCR-RMI -=================================================== - -JCR-RMI is a transparent Remote Method Invocation (RMI) layer for JCR. -The layer makes it possible to remotely access JCR content repositories. - -Note that due to changes in the way the RMI client is built, versions since -2.16 will not be able to connect to older versions of the server. If -compatibility with older servers is needed, just use the client from a -recent 2.14 release. - diff --git a/jackrabbit-jcr-rmi/checkstyle.xml b/jackrabbit-jcr-rmi/checkstyle.xml deleted file mode 100644 index 33678aa8981..00000000000 --- a/jackrabbit-jcr-rmi/checkstyle.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jackrabbit-jcr-rmi/pom.xml b/jackrabbit-jcr-rmi/pom.xml deleted file mode 100644 index a21f7c55145..00000000000 --- a/jackrabbit-jcr-rmi/pom.xml +++ /dev/null @@ -1,579 +0,0 @@ - - - - - - 4.0.0 - - org.apache.jackrabbit - jackrabbit-parent - 2.21.16-SNAPSHOT - ../jackrabbit-parent/pom.xml - - - - - - jackrabbit-jcr-rmi - bundle - - Jackrabbit JCR-RMI - - JCR-RMI is a transparent Remote Method Invocation (RMI) layer for the - Content Repository for Java Technology API (JCR). The layer makes it - possible to remotely access JCR content repositories. - - - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - jcr,jackrabbit - http://jackrabbit.apache.org/ - - - javax.transaction.xa;resolution:=optional,* - - - - jackrabbit-jcr-commons;inline=org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter* - - - - - - org.apache.rat - apache-rat-plugin - - - src/main/javadoc/**/*.uxf - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.maven.plugins - - - maven-antrun-plugin - - [3,) - - run - - - - - - - - - - - - - - - - - integrationTesting - - - - maven-surefire-plugin - - ${test.opts} - true - - - jackrabbit.test.integration - true - - - known.issues - -org.apache.jackrabbit.test.api.ShareableNodeTest -org.apache.jackrabbit.test.api.SetValueValueFormatExceptionTest#testNodeNotReferenceable - -org.apache.jackrabbit.test.api.NameTest#testExpandedNameValue -org.apache.jackrabbit.test.api.NameTest#testExpandedNameValueProperty - -org.apache.jackrabbit.test.api.NodeRemoveMixinTest#testNotAssigned -org.apache.jackrabbit.test.api.ValueFactoryTest#testValueFormatException - -org.apache.jackrabbit.test.api.GetWeakReferencesTest#testMultiValues -org.apache.jackrabbit.test.api.GetWeakReferencesTest#testSingleValue - -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testEmptyNodeDefinitionTemplate -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testEmptyNodeTypeTemplate -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testEmptyPropertyDefinitionTemplate -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testInvalidJCRNames -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testNewNodeTypeTemplate -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testNodeDefinitionTemplate -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testNonEmptyNodeTypeTemplate -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testPropertyDefinitionTemplate -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testRegisterNodeType -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testRegisterNodeTypes -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testResidualNames -org.apache.jackrabbit.test.api.nodetype.NodeTypeCreationTest#testSetDefaultValues - -org.apache.jackrabbit.test.api.observation.GetUserDataTest#testSave -org.apache.jackrabbit.test.api.observation.GetUserDataTest#testVersioning -org.apache.jackrabbit.test.api.observation.GetUserDataTest#testWorkspaceOperation -org.apache.jackrabbit.test.api.observation.NodeReorderTest#testNodeReorderMove - -org.apache.jackrabbit.test.api.PathTest#testResolvedIdentifierBasedPropertyValue - -org.apache.jackrabbit.test.api.query.CreateQueryTest#testUnknownQueryLanguage -org.apache.jackrabbit.test.api.query.DerefQueryLevel1Test#testDerefMultiPropWithNodeStar -org.apache.jackrabbit.test.api.query.DerefQueryLevel1Test#testDerefMultiPropWithNodeTest -org.apache.jackrabbit.test.api.query.DerefQueryLevel1Test#testDerefSinglePropWithNodeStar -org.apache.jackrabbit.test.api.query.DerefQueryLevel1Test#testDerefSinglePropWithNodeTest -org.apache.jackrabbit.test.api.query.ElementTest#testElementTest -org.apache.jackrabbit.test.api.query.ElementTest#testElementTestAnyNode -org.apache.jackrabbit.test.api.query.ElementTest#testElementTestAnyNodeNtBase -org.apache.jackrabbit.test.api.query.ElementTest#testElementTestAnyNodeSomeNT -org.apache.jackrabbit.test.api.query.ElementTest#testElementTestNameTest -org.apache.jackrabbit.test.api.query.ElementTest#testElementTestNameTestNtBase -org.apache.jackrabbit.test.api.query.ElementTest#testElementTestNameTestSomeNT -org.apache.jackrabbit.test.api.query.ElementTest#testElementTestNameTestSomeNTWithSNS -org.apache.jackrabbit.test.api.query.GetLanguageTest#testGetLanguage -org.apache.jackrabbit.test.api.query.GetLanguageTest#testJCRQOM -org.apache.jackrabbit.test.api.query.GetLanguageTest#testJCRSQL2 -org.apache.jackrabbit.test.api.query.GetLanguageTest#testSQL -org.apache.jackrabbit.test.api.query.GetPersistentQueryPathLevel1Test#testGetStoredQueryPath -org.apache.jackrabbit.test.api.query.GetPersistentQueryPathTest#testGetPersistentQueryPath -org.apache.jackrabbit.test.api.query.GetPropertyNamesTest#testGetPropertyNames -org.apache.jackrabbit.test.api.query.GetStatementTest#testGetStatement -org.apache.jackrabbit.test.api.query.GetSupportedQueryLanguagesTest#testGetSupportedQueryLanguages -org.apache.jackrabbit.test.api.query.OrderByDateTest#testDateOrder -org.apache.jackrabbit.test.api.query.OrderByDateTest#testDateOrderMillis -org.apache.jackrabbit.test.api.query.OrderByDateTest#testDateOrderNegativeTimeZone -org.apache.jackrabbit.test.api.query.OrderByDateTest#testDateOrderPositiveTimeZone -org.apache.jackrabbit.test.api.query.OrderByDecimalTest#testDecimal -org.apache.jackrabbit.test.api.query.OrderByDoubleTest#testDoubleOrder1 -org.apache.jackrabbit.test.api.query.OrderByDoubleTest#testDoubleOrder2 -org.apache.jackrabbit.test.api.query.OrderByLengthTest#testLength -org.apache.jackrabbit.test.api.query.OrderByLocalNameTest#testLocalName -org.apache.jackrabbit.test.api.query.OrderByLongTest#testIntegerOrder -org.apache.jackrabbit.test.api.query.OrderByLowerCaseTest#testLowerCase -org.apache.jackrabbit.test.api.query.OrderByMultiTypeTest#testMultipleOrder -org.apache.jackrabbit.test.api.query.OrderByNameTest#testName -org.apache.jackrabbit.test.api.query.OrderByStringTest#testStringOrder -org.apache.jackrabbit.test.api.query.OrderByUpperCaseTest#testLowerCase -org.apache.jackrabbit.test.api.query.OrderByURITest#testURI -org.apache.jackrabbit.test.api.query.PredicatesTest#testAnd -org.apache.jackrabbit.test.api.query.PredicatesTest#testCombinedAnd -org.apache.jackrabbit.test.api.query.PredicatesTest#testCombinedOr -org.apache.jackrabbit.test.api.query.PredicatesTest#testEquality -org.apache.jackrabbit.test.api.query.PredicatesTest#testOr -org.apache.jackrabbit.test.api.query.qom.AndConstraintTest#testAnd -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testBindVariableNames -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testBoolean -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testDate -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testDecimal -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testDouble -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testIllegalArgumentException -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testLong -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testName -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testPath -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testReference -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testString -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testURI -org.apache.jackrabbit.test.api.query.qom.BindVariableValueTest#testWeakReference -org.apache.jackrabbit.test.api.query.qom.ChildNodeJoinConditionTest#testInnerJoin -org.apache.jackrabbit.test.api.query.qom.ChildNodeJoinConditionTest#testLeftOuterJoin -org.apache.jackrabbit.test.api.query.qom.ChildNodeJoinConditionTest#testRightOuterJoin -org.apache.jackrabbit.test.api.query.qom.ChildNodeTest#testChildNode -org.apache.jackrabbit.test.api.query.qom.ChildNodeTest#testChildNodes -org.apache.jackrabbit.test.api.query.qom.ChildNodeTest#testChildNodesDoNotMatchSelector -org.apache.jackrabbit.test.api.query.qom.ChildNodeTest#testNotASelectorName -org.apache.jackrabbit.test.api.query.qom.ChildNodeTest#testPathDoesNotExist -org.apache.jackrabbit.test.api.query.qom.ChildNodeTest#testRelativePath -org.apache.jackrabbit.test.api.query.qom.ChildNodeTest#testSyntacticallyInvalidPath -org.apache.jackrabbit.test.api.query.qom.ColumnTest#testColumnNames -org.apache.jackrabbit.test.api.query.qom.ColumnTest#testExpandColumnsForNodeType -org.apache.jackrabbit.test.api.query.qom.ColumnTest#testMultiColumn -org.apache.jackrabbit.test.api.query.qom.DescendantNodeJoinConditionTest#testInnerJoin -org.apache.jackrabbit.test.api.query.qom.DescendantNodeJoinConditionTest#testLeftOuterJoin -org.apache.jackrabbit.test.api.query.qom.DescendantNodeJoinConditionTest#testRightOuterJoin -org.apache.jackrabbit.test.api.query.qom.DescendantNodeTest#testDescendantNode -org.apache.jackrabbit.test.api.query.qom.DescendantNodeTest#testDescendantNodes -org.apache.jackrabbit.test.api.query.qom.DescendantNodeTest#testDescendantNodesDoNotMatchSelector -org.apache.jackrabbit.test.api.query.qom.DescendantNodeTest#testNotASelectorName -org.apache.jackrabbit.test.api.query.qom.DescendantNodeTest#testPathDoesNotExist -org.apache.jackrabbit.test.api.query.qom.DescendantNodeTest#testRelativePath -org.apache.jackrabbit.test.api.query.qom.DescendantNodeTest#testSyntacticallyInvalidPath -org.apache.jackrabbit.test.api.query.qom.EquiJoinConditionTest#testInnerJoin1 -org.apache.jackrabbit.test.api.query.qom.EquiJoinConditionTest#testInnerJoin2 -org.apache.jackrabbit.test.api.query.qom.EquiJoinConditionTest#testLeftOuterJoin1 -org.apache.jackrabbit.test.api.query.qom.EquiJoinConditionTest#testLeftOuterJoin2 -org.apache.jackrabbit.test.api.query.qom.EquiJoinConditionTest#testRightOuterJoin1 -org.apache.jackrabbit.test.api.query.qom.EquiJoinConditionTest#testRightOuterJoin2 -org.apache.jackrabbit.test.api.query.qom.FullTextSearchScoreTest#testConstraint -org.apache.jackrabbit.test.api.query.qom.FullTextSearchScoreTest#testOrdering -org.apache.jackrabbit.test.api.query.qom.GetQueryTest#testGetQuery -org.apache.jackrabbit.test.api.query.qom.GetQueryTest#testInvalidQueryException -org.apache.jackrabbit.test.api.query.qom.LengthTest#testBinaryLength -org.apache.jackrabbit.test.api.query.qom.LengthTest#testBooleanLength -org.apache.jackrabbit.test.api.query.qom.LengthTest#testDateLength -org.apache.jackrabbit.test.api.query.qom.LengthTest#testDecimalLength -org.apache.jackrabbit.test.api.query.qom.LengthTest#testDoubleLength -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLengthBinaryLiteral -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLengthBooleanLiteral -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLengthDateLiteral -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLengthDecimalLiteral -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLengthDoubleLiteral -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLengthNameLiteral -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLengthPathLiteral -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLengthReferenceLiteral -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLengthStringLiteral -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLengthURILiteral -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLengthWeakReferenceLiteral -org.apache.jackrabbit.test.api.query.qom.LengthTest#testLongLength -org.apache.jackrabbit.test.api.query.qom.LengthTest#testNameLength -org.apache.jackrabbit.test.api.query.qom.LengthTest#testPathLength -org.apache.jackrabbit.test.api.query.qom.LengthTest#testReferenceLength -org.apache.jackrabbit.test.api.query.qom.LengthTest#testStringLength -org.apache.jackrabbit.test.api.query.qom.LengthTest#testURILength -org.apache.jackrabbit.test.api.query.qom.LengthTest#testWeakReferenceLength -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testBinaryLiteral -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testBooleanLiteral -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testDateLiteral -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testDecimalLiteral -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testDoubleLiteral -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testEqualTo -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testGreaterThan -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testGreaterThanOrEqualTo -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testLessThan -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testLessThanOrEqualTo -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testLike -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testLongLiteral -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testNameLiteral -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testNotEqualTo -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testPathLiteral -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testReferenceLiteral -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testStringLiteral -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testStringLiteralInvalidName -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testURILiteral -org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testWeakReferenceLiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testBinaryLiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testBooleanLiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testDateLiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testDecimalLiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testDoubleLiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testEqualTo -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testLongLiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testNameLiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testNotEqualTo -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testPathLiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testReferenceLiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testStringLiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testStringLiteralInvalidName -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testURILiteral -org.apache.jackrabbit.test.api.query.qom.NodeNameTest#testWeakReferenceLiteral -org.apache.jackrabbit.test.api.query.qom.NotConstraintTest#testNot -org.apache.jackrabbit.test.api.query.qom.OrConstraintTest#testOr -org.apache.jackrabbit.test.api.query.qom.OrderingTest#testMultipleSelectors -org.apache.jackrabbit.test.api.query.qom.PropertyExistenceTest#testPropertyExistence -org.apache.jackrabbit.test.api.query.qom.PropertyValueTest#testPropertyExistence -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testAnd -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testBindVariableValue -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testChildNode -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testChildNodeJoinCondition -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testChildNodeWithSelector -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testColumn -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testColumnAllProperties -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testColumnWithColumnName -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testColumnWithSelector -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testComparison -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testCreateQuery -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testCreateQueryFromSource -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testCreateQueryFromSourceWithConstraint -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testCreateQueryFromSourceWithConstraintAndOrdering -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testCreateQueryFromSourceWithConstraintOrderingAndColumn -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testCreateQueryWithConstraint -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testCreateQueryWithConstraintAndOrdering -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testCreateQueryWithConstraintOrderingAndColumn -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testDescendantNode -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testDescendantNodeJoinCondition -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testDescendantNodeWithSelector -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testEquiJoinCondition -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testFullTextSearch -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testFullTextSearchAllProperties -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testFullTextSearchScore -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testFullTextSearchScoreWithSelector -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testFullTextSearchWithBindVariableValue -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testJoin -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testLength -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testLiteral -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testLowerCase -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testNodeLocalName -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testNodeLocalNameWithSelector -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testNodeName -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testNodeNameWithSelector -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testNot -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testOr -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testOrderingAscending -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testOrderingDescending -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testPropertyExistence -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testPropertyExistenceWithSelector -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testPropertyValue -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testPropertyValueWithSelector -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testSameNode -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testSameNodeJoinCondition -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testSameNodeJoinConditionWithPath -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testSameNodeWithSelector -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testSelector -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testSelectorWithName -org.apache.jackrabbit.test.api.query.qom.QueryObjectModelFactoryTest#testUpperCase -org.apache.jackrabbit.test.api.query.qom.RowTest#testGetNode -org.apache.jackrabbit.test.api.query.qom.RowTest#testGetNodeWithSelector -org.apache.jackrabbit.test.api.query.qom.RowTest#testGetPath -org.apache.jackrabbit.test.api.query.qom.RowTest#testGetPathWithSelector -org.apache.jackrabbit.test.api.query.qom.RowTest#testGetScore -org.apache.jackrabbit.test.api.query.qom.RowTest#testGetScoreWithSelector -org.apache.jackrabbit.test.api.query.qom.RowTest#testGetValue -org.apache.jackrabbit.test.api.query.qom.RowTest#testGetValues -org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testInnerJoin -org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testInnerJoinWithPath -org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testLeftOuterJoin -org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testLeftOuterJoinWithPath -org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testRightOuterJoin -org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testRightOuterJoinWithPath -org.apache.jackrabbit.test.api.query.qom.SameNodeTest#testChildNodesDoNotMatchSelector -org.apache.jackrabbit.test.api.query.qom.SameNodeTest#testNotASelectorName -org.apache.jackrabbit.test.api.query.qom.SameNodeTest#testPathDoesNotExist -org.apache.jackrabbit.test.api.query.qom.SameNodeTest#testRelativePath -org.apache.jackrabbit.test.api.query.qom.SameNodeTest#testSameNode -org.apache.jackrabbit.test.api.query.qom.SameNodeTest#testSyntacticallyInvalidPath -org.apache.jackrabbit.test.api.query.qom.SelectorTest#testDuplicateNodeType -org.apache.jackrabbit.test.api.query.qom.SelectorTest#testSelector -org.apache.jackrabbit.test.api.query.qom.SelectorTest#testSyntacticallyInvalidName -org.apache.jackrabbit.test.api.query.qom.SelectorTest#testUnknownNodeType -org.apache.jackrabbit.test.api.query.qom.UpperLowerCaseTest#testLength -org.apache.jackrabbit.test.api.query.qom.UpperLowerCaseTest#testLowerCaseTwice -org.apache.jackrabbit.test.api.query.qom.UpperLowerCaseTest#testLowerUpperCase -org.apache.jackrabbit.test.api.query.qom.UpperLowerCaseTest#testNodeLocalName -org.apache.jackrabbit.test.api.query.qom.UpperLowerCaseTest#testNodeName -org.apache.jackrabbit.test.api.query.qom.UpperLowerCaseTest#testPropertyValue -org.apache.jackrabbit.test.api.query.qom.UpperLowerCaseTest#testUpperCaseTwice -org.apache.jackrabbit.test.api.query.qom.UpperLowerCaseTest#testUpperLowerCase -org.apache.jackrabbit.test.api.query.QueryResultNodeIteratorTest#testGetPosition -org.apache.jackrabbit.test.api.query.QueryResultNodeIteratorTest#testGetPositionEmptyIterator -org.apache.jackrabbit.test.api.query.QueryResultNodeIteratorTest#testGetSize -org.apache.jackrabbit.test.api.query.QueryResultNodeIteratorTest#testNoSuchElementException -org.apache.jackrabbit.test.api.query.QueryResultNodeIteratorTest#testSkip -org.apache.jackrabbit.test.api.query.SetLimitTest#testSetLimit -org.apache.jackrabbit.test.api.query.SetOffsetTest#testSetOffset -org.apache.jackrabbit.test.api.query.SimpleSelectionTest#testSingleProperty -org.apache.jackrabbit.test.api.query.SQLJcrPathTest#testJcrPath -org.apache.jackrabbit.test.api.query.SQLJoinTest#testJoin -org.apache.jackrabbit.test.api.query.SQLJoinTest#testJoinFilterPrimaryType -org.apache.jackrabbit.test.api.query.SQLJoinTest#testJoinNtBase -org.apache.jackrabbit.test.api.query.SQLJoinTest#testJoinSNS -org.apache.jackrabbit.test.api.query.SQLOrderByTest#testOrderByAscending -org.apache.jackrabbit.test.api.query.SQLOrderByTest#testOrderByDefault -org.apache.jackrabbit.test.api.query.SQLOrderByTest#testOrderByDescending -org.apache.jackrabbit.test.api.query.SQLPathTest#testChildAxisLeaf -org.apache.jackrabbit.test.api.query.SQLPathTest#testChildAxisRoot -org.apache.jackrabbit.test.api.query.SQLPathTest#testChildAxisTestRoot -org.apache.jackrabbit.test.api.query.SQLPathTest#testDescendantLeaf -org.apache.jackrabbit.test.api.query.SQLPathTest#testDescendantSelfTestRoot -org.apache.jackrabbit.test.api.query.SQLPathTest#testDescendantTestRoot -org.apache.jackrabbit.test.api.query.SQLQueryLevel2Test#testFullTextSearch -org.apache.jackrabbit.test.api.query.SQLQueryLevel2Test#testMultiValueSearch -org.apache.jackrabbit.test.api.query.SQLQueryLevel2Test#testPathColumn -org.apache.jackrabbit.test.api.query.SQLQueryLevel2Test#testRange -org.apache.jackrabbit.test.api.query.SQLQueryLevel2Test#testScoreColumn -org.apache.jackrabbit.test.api.query.TextNodeTest#testTextNodeTest -org.apache.jackrabbit.test.api.query.TextNodeTest#testTextNodeTestContains -org.apache.jackrabbit.test.api.query.TextNodeTest#testTextNodeTestMultiNodes -org.apache.jackrabbit.test.api.query.TextNodeTest#testTextNodeTestWithPosition -org.apache.jackrabbit.test.api.query.XPathDocOrderTest#testDocOrderFirstFunction -org.apache.jackrabbit.test.api.query.XPathDocOrderTest#testDocOrderLastFunction -org.apache.jackrabbit.test.api.query.XPathDocOrderTest#testDocOrderPositionFunction -org.apache.jackrabbit.test.api.query.XPathDocOrderTest#testDocOrderPositionIndex -org.apache.jackrabbit.test.api.query.XPathJcrPathTest#testJcrPath -org.apache.jackrabbit.test.api.query.XPathOrderByTest#testOrderBy -org.apache.jackrabbit.test.api.query.XPathOrderByTest#testOrderByAscending -org.apache.jackrabbit.test.api.query.XPathOrderByTest#testOrderByDescending -org.apache.jackrabbit.test.api.query.XPathPosIndexTest#testDocOrderIndexedNotation -org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testFullTextSearch -org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testMultiValueSearch -org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testPathColumn -org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testRange -org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testScoreColumn - -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testSetIllegalPolicy -org.apache.jackrabbit.test.api.security.RSessionAccessControlPolicyTest#testSetInvalidPolicy - -org.apache.jackrabbit.test.api.SerializationTest#testLockExceptionSessionWithHandler -org.apache.jackrabbit.test.api.SerializationTest#testLockExceptionWorkspaceWithHandler -org.apache.jackrabbit.test.api.SerializationTest#testVersioningExceptionFileChildSessionContentHandler -org.apache.jackrabbit.test.api.SerializationTest#testVersioningExceptionFileChildWorkspaceContentHandler -org.apache.jackrabbit.test.api.SerializationTest#testVersioningExceptionFileParentSessionContentHandler -org.apache.jackrabbit.test.api.SerializationTest#testVersioningExceptionFileParentWorkspaceContentHandler - -org.apache.jackrabbit.test.api.SessionTest#testHasCapability - -org.apache.jackrabbit.test.api.version.CopyTest#testCopy -org.apache.jackrabbit.test.api.version.VersionHistoryTest#testGetAllFrozenNodes - -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testSetPolicy -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testSetAllPolicies -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testGetPolicyAfterSet -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testResetPolicy -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testSetPolicyIsTransient -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testGetPolicyAfterSave -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testNodeIsModifiedAfterSecondSetPolicy -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testNodeIsModifiedAfterSetPolicy -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testRemovePolicy -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testRemovePolicyIsTransient -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testNodeIsModifiedAfterRemovePolicy -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testSetPolicyOnNewNode -org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testRemoveTransientlyAddedPolicy -org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntry -org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAggregatePrivilege -org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAggregatedPrivilegesSeparately -org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddPrivilegesPresentInEntries -org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryAndSetPolicy -org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryIsTransient -org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryInvalidPrincipal -org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryEmptyPrivilegeArray -org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryInvalidPrivilege -org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveAddedAccessControlEntry -org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveAccessControlEntryAndSetPolicy -org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveAccessControlEntryIsTransient -org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveIllegalAccessControlEntry -org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryTwice -org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryAgain -org.apache.jackrabbit.test.api.security.AccessControlListTest#testExtendPrivileges -org.apache.jackrabbit.test.api.security.RSessionAccessControlPolicyTest#testSetPolicy - -org.apache.jackrabbit.test.api.observation.EventJournalTest - - - - derby.system.durability - test - - - derby.storage.fileSyncTransactionLog - true - - - derby.stream.error.file - target/derby.log - - - - - - - - - - - - - - - org.osgi - org.osgi.annotation - provided - - - - javax.jcr - jcr - - - org.slf4j - slf4j-api - - - - org.apache.jackrabbit - jackrabbit-jcr-commons - ${project.version} - provided - - - - - org.apache.jackrabbit - oak-jackrabbit-api - ${oak-jackrabbit-api.version.implemented} - provided - - - - - junit - junit - test - - - org.apache.jackrabbit - jackrabbit-core - ${project.version} - test - - - org.apache.jackrabbit - jackrabbit-jcr-tests - ${project.version} - test - - - ch.qos.logback - logback-classic - test - - - org.apache.derby - derby - test - - - - diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/BrokenRemoteRepository.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/BrokenRemoteRepository.java deleted file mode 100644 index 9201f1a7ba8..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/BrokenRemoteRepository.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.Credentials; -import javax.jcr.Value; - -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.remote.RemoteSession; - -/** - * Dummy remote repository instance that throws a {@link RemoteException} - * whenever any method is invoked. Used as a sentinel object by the - * {@link SafeClientRepository} class. - */ -public class BrokenRemoteRepository implements RemoteRepository { - - /** - * The remote exception thrown by methods of this instance. - */ - private final RemoteException exception; - - /** - * Creates a remote repository whose methods throw the given - * exception. - * - * @param exception remote exception - */ - public BrokenRemoteRepository(RemoteException exception) { - this.exception = exception; - } - - /** - * Creates a remote repository whose methods trow a remote - * exception with the given message. - * - * @param message exception message - */ - public BrokenRemoteRepository(String message) { - this(new RemoteException(message)); - } - - /** - * Creates a remote repository whose methods throw a remote exception. - */ - public BrokenRemoteRepository() { - this(new RemoteException()); - } - - //----------------------------------------------------< RemoteRepository > - - /** - * Throws a {@link RemoteException}. - * - * @param key ignored - * @return nothing - * @throws RemoteException always thrown - */ - public String getDescriptor(String key) throws RemoteException { - throw exception; - } - - /** - * Throws a {@link RemoteException}. - * - * @return nothing - * @throws RemoteException always thrown - */ - public String[] getDescriptorKeys() throws RemoteException { - throw exception; - } - - /** - * Throws a {@link RemoteException}. - * - * @return nothing - * @throws RemoteException always thrown - */ - public RemoteSession login() throws RemoteException { - throw exception; - } - - /** - * Throws a {@link RemoteException}. - * - * @param workspace ignored - * @return nothing - * @throws RemoteException always thrown - */ - public RemoteSession login(String workspace) throws RemoteException { - throw exception; - } - - /** - * Throws a {@link RemoteException}. - * - * @param credentials ignored - * @return nothing - * @throws RemoteException always thrown - */ - public RemoteSession login(Credentials credentials) throws RemoteException { - throw exception; - } - - /** - * Throws a {@link RemoteException}. - * - * @param workspace ignored - * @param credentials ignored - * @return nothing - * @throws RemoteException always thrown - */ - public RemoteSession login(Credentials credentials, String workspace) - throws RemoteException { - throw exception; - } - - /** - * Throws a {@link RemoteException}. - * - * @param key ignored - * @return nothing - * @throws RemoteException always thrown - */ - public Value getDescriptorValue(String key) throws RemoteException { - throw exception; - } - - /** - * Throws a {@link RemoteException}. - * - * @param key ignored - * @return nothing - * @throws RemoteException always thrown - */ - public Value[] getDescriptorValues(String key) throws RemoteException { - throw exception; - } - - /** - * Throws a {@link RemoteException}. - * - * @param key ignored - * @return nothing - * @throws RemoteException always thrown - */ - public boolean isSingleValueDescriptor(String key) throws RemoteException { - throw exception; - } - - /** - * Throws a {@link RemoteException}. - * - * @param key ignored - * @return nothing - * @throws RemoteException always thrown - */ - public boolean isStandardDescriptor(String key) throws RemoteException { - throw exception; - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java deleted file mode 100644 index 14959c91ead..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.security.Principal; -import java.util.Iterator; - -import javax.jcr.Item; -import javax.jcr.NamespaceRegistry; -import javax.jcr.Node; -import javax.jcr.NodeIterator; -import javax.jcr.Property; -import javax.jcr.PropertyIterator; -import javax.jcr.Repository; -import javax.jcr.Session; -import javax.jcr.Workspace; -import javax.jcr.lock.Lock; -import javax.jcr.lock.LockManager; -import javax.jcr.nodetype.ItemDefinition; -import javax.jcr.nodetype.NodeDefinition; -import javax.jcr.nodetype.NodeType; -import javax.jcr.nodetype.NodeTypeIterator; -import javax.jcr.nodetype.NodeTypeManager; -import javax.jcr.nodetype.PropertyDefinition; -import javax.jcr.observation.ObservationManager; -import javax.jcr.query.Query; -import javax.jcr.query.QueryManager; -import javax.jcr.query.QueryResult; -import javax.jcr.query.Row; -import javax.jcr.query.RowIterator; -import javax.jcr.security.AccessControlEntry; -import javax.jcr.security.AccessControlManager; -import javax.jcr.security.AccessControlPolicy; -import javax.jcr.security.AccessControlPolicyIterator; -import javax.jcr.security.Privilege; -import javax.jcr.version.Version; -import javax.jcr.version.VersionHistory; -import javax.jcr.version.VersionIterator; -import javax.jcr.version.VersionManager; - -import org.apache.jackrabbit.rmi.client.iterator.ClientNodeIterator; -import org.apache.jackrabbit.rmi.client.iterator.ClientNodeTypeIterator; -import org.apache.jackrabbit.rmi.client.iterator.ClientPropertyIterator; -import org.apache.jackrabbit.rmi.client.iterator.ClientRowIterator; -import org.apache.jackrabbit.rmi.client.iterator.ClientVersionIterator; -import org.apache.jackrabbit.rmi.client.principal.ClientGroup; -import org.apache.jackrabbit.rmi.client.principal.ClientPrincipal; -import org.apache.jackrabbit.rmi.client.principal.ClientPrincipalIterator; -import org.apache.jackrabbit.rmi.client.security.ClientAccessControlEntry; -import org.apache.jackrabbit.rmi.client.security.ClientAccessControlList; -import org.apache.jackrabbit.rmi.client.security.ClientAccessControlManager; -import org.apache.jackrabbit.rmi.client.security.ClientAccessControlPolicy; -import org.apache.jackrabbit.rmi.client.security.ClientAccessControlPolicyIterator; -import org.apache.jackrabbit.rmi.client.security.ClientPrivilege; -import org.apache.jackrabbit.rmi.remote.RemoteItem; -import org.apache.jackrabbit.rmi.remote.RemoteItemDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteLock; -import org.apache.jackrabbit.rmi.remote.RemoteLockManager; -import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry; -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; -import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager; -import org.apache.jackrabbit.rmi.remote.RemoteObservationManager; -import org.apache.jackrabbit.rmi.remote.RemoteProperty; -import org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteQuery; -import org.apache.jackrabbit.rmi.remote.RemoteQueryManager; -import org.apache.jackrabbit.rmi.remote.RemoteQueryResult; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.remote.RemoteRow; -import org.apache.jackrabbit.rmi.remote.RemoteSession; -import org.apache.jackrabbit.rmi.remote.RemoteVersion; -import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory; -import org.apache.jackrabbit.rmi.remote.RemoteVersionManager; -import org.apache.jackrabbit.rmi.remote.RemoteWorkspace; -import org.apache.jackrabbit.rmi.remote.RemoteXASession; -import org.apache.jackrabbit.rmi.remote.principal.RemoteGroup; -import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlList; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy; -import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege; - -/** - * Default implementation of the - * {@link org.apache.jackrabbit.rmi.client.LocalAdapterFactory LocalAdapterFactory} - * interface. This factory uses the client adapters defined in this - * package as the default adapter implementations. Subclasses can - * easily override or extend the default adapters by implementing the - * corresponding factory methods. - */ -public class ClientAdapterFactory implements LocalAdapterFactory { - - /** - * Creates and returns a {@link ClientRepository ClientRepository} - * instance. - * - * {@inheritDoc} - */ - public Repository getRepository(RemoteRepository remote) { - return new ClientRepository(remote, this); - } - - /** - * Creates and returns a {@link ClientSession ClientSession} instance. - * In case the remote session is transaction enabled, the returned session - * will be transaction enabled too through the {@link ClientXASession}. - * - * {@inheritDoc} - */ - public Session getSession(Repository repository, RemoteSession remote) { - if (remote instanceof RemoteXASession) { - return new ClientXASession( - repository, (RemoteXASession) remote, this); - } else { - return new ClientSession(repository, remote, this); - } - } - - /** - * Creates and returns a {@link ClientWorkspace ClientWorkspace} instance. - * - * {@inheritDoc} - */ - public Workspace getWorkspace(Session session, RemoteWorkspace remote) { - return new ClientWorkspace(session, remote, this); - } - - /** - * Creates and returns a - * {@link ClientObservationManager ClientObservationManager} instance. - * - * {@inheritDoc} - */ - public ObservationManager getObservationManager(Workspace workspace, - RemoteObservationManager remote) { - return new ClientObservationManager(workspace, remote); - } - - /** - * Creates and returns a - * {@link ClientNamespaceRegistry ClientClientNamespaceRegistry} instance. - * - * {@inheritDoc} - */ - public NamespaceRegistry getNamespaceRegistry( - RemoteNamespaceRegistry remote) { - return new ClientNamespaceRegistry(remote, this); - } - - /** - * Creates and returns a - * {@link ClientNodeTypeManager ClienNodeTypeManager} instance. - * - * {@inheritDoc} - */ - public NodeTypeManager getNodeTypeManager(RemoteNodeTypeManager remote) { - return new ClientNodeTypeManager(remote, this); - } - - /** - * Creates and returns a {@link ClientItem ClientItem} instance. - * - * {@inheritDoc} - */ - public Item getItem(Session session, RemoteItem remote) { - return new ClientItem(session, remote, this); - } - - /** - * Creates and returns a {@link ClientProperty ClientProperty} instance. - * - * {@inheritDoc} - */ - public Property getProperty(Session session, RemoteProperty remote) { - return new ClientProperty(session, remote, this); - } - - /** - * Creates and returns a {@link ClientNode ClientNode} instance. - * - * {@inheritDoc} - */ - public Node getNode(Session session, RemoteNode remote) { - return new ClientNode(session, remote, this); - } - - /** - * Creates and returns a {@link ClientVersion ClientVersion} instance. - * - * {@inheritDoc} - */ - public Version getVersion(Session session, RemoteVersion remote) { - return new ClientVersion(session, remote, this); - } - - /** - * Creates and returns a {@link ClientVersionHistory ClientVersionHistory} - * instance. - * - * {@inheritDoc} - */ - public VersionHistory getVersionHistory(Session session, RemoteVersionHistory remote) { - return new ClientVersionHistory(session, remote, this); - } - - /** - * Creates and returns a {@link ClientNodeType ClientNodeType} instance. - * - * {@inheritDoc} - */ - public NodeType getNodeType(RemoteNodeType remote) { - return new ClientNodeType(remote, this); - } - - /** - * Creates and returns a {@link ClientItemDefinition ClientItemDefinition} instance. - * - * {@inheritDoc} - */ - public ItemDefinition getItemDef(RemoteItemDefinition remote) { - return new ClientItemDefinition(remote, this); - } - - /** - * Creates and returns a {@link ClientNodeDefinition ClientNodeDefinition} instance. - * - * {@inheritDoc} - */ - public NodeDefinition getNodeDef(RemoteNodeDefinition remote) { - return new ClientNodeDefinition(remote, this); - } - - /** - * Creates and returns a {@link ClientPropertyDefinition ClientPropertyDefinition} - * instance. - * - * {@inheritDoc} - */ - public PropertyDefinition getPropertyDef(RemotePropertyDefinition remote) { - return new ClientPropertyDefinition(remote, this); - } - - /** - * Creates and returns a {@link ClientLock ClientLock} instance. - * - * {@inheritDoc} - */ - public Lock getLock(Session session, RemoteLock remote) { - return new ClientLock(session, remote, this); - } - - /** - * Creates and returns a {@link ClientQueryManager ClientQueryManager} instance. - * - * {@inheritDoc} - */ - public QueryManager getQueryManager( - Session session, RemoteQueryManager remote) { - return new ClientQueryManager(session, remote, this); - } - - /** - * Creates and returns a {@link ClientQuery ClientQuery} instance. - * - * {@inheritDoc} - */ - public Query getQuery(Session session, RemoteQuery remote) { - return new ClientQuery(session, remote, this); - } - - /** - * Creates and returns a {@link ClientQueryResult ClientQueryResult} instance. - * - * {@inheritDoc} - */ - public QueryResult getQueryResult( - Session session, RemoteQueryResult remote) { - return new ClientQueryResult(session, remote, this); - } - - /** - * Creates and returns a {@link ClientRow ClientRow} instance. - * - * {@inheritDoc} - */ - public Row getRow(Session session, RemoteRow remote) { - return new ClientRow(session, remote, this); - } - - /** - * Creates and returns a {@link ClientNodeIterator} instance. - * {@inheritDoc} - */ - public NodeIterator getNodeIterator( - Session session, RemoteIterator remote) { - return new ClientNodeIterator(remote, session, this); - } - - /** - * Creates and returns a {@link ClientPropertyIterator} instance. - * {@inheritDoc} - */ - public PropertyIterator getPropertyIterator( - Session session, RemoteIterator remote) { - return new ClientPropertyIterator(remote, session, this); - } - - /** - * Creates and returns a {@link ClientVersionIterator} instance. - * {@inheritDoc} - */ - public VersionIterator getVersionIterator( - Session session, RemoteIterator remote) { - return new ClientVersionIterator(remote, session, this); - } - - /** - * Creates and returns a {@link ClientNodeTypeIterator} instance. - * {@inheritDoc} - */ - public NodeTypeIterator getNodeTypeIterator(RemoteIterator remote) { - return new ClientNodeTypeIterator(remote, this); - } - - /** - * Creates and returns a {@link ClientRowIterator} instance. - * {@inheritDoc} - */ - public RowIterator getRowIterator(Session session, RemoteIterator remote) { - return new ClientRowIterator(session, remote, this); - } - - public LockManager getLockManager( - Session session, RemoteLockManager remote) { - return new ClientLockManager(session, remote, this); - } - - public VersionManager getVersionManager( - Session session, RemoteVersionManager remote) { - return new ClientVersionManager(session, remote, this); - } - - /** - * {@inheritDoc} - */ - public AccessControlManager getAccessControlManager( - RemoteAccessControlManager remote) { - return new ClientAccessControlManager(remote, this); - } - - /** - * {@inheritDoc} - */ - public AccessControlPolicy getAccessControlPolicy( - RemoteAccessControlPolicy remote) { - if (remote instanceof RemoteAccessControlList) { - return new ClientAccessControlList( - (RemoteAccessControlList) remote, this); - } - return new ClientAccessControlPolicy(remote, this); - } - - /** - * {@inheritDoc} - */ - public AccessControlPolicy[] getAccessControlPolicy( - RemoteAccessControlPolicy[] remote) { - final AccessControlPolicy[] local = new AccessControlPolicy[remote.length]; - for (int i = 0; i < local.length; i++) { - local[i] = getAccessControlPolicy(remote[i]); - } - return local; - } - - /** - * {@inheritDoc} - */ - public AccessControlPolicyIterator getAccessControlPolicyIterator( - RemoteIterator remote) { - return new ClientAccessControlPolicyIterator(remote, this); - } - - /** - * {@inheritDoc} - */ - public AccessControlEntry getAccessControlEntry( - RemoteAccessControlEntry remote) { - return new ClientAccessControlEntry(remote, this); - } - - /** - * {@inheritDoc} - */ - public AccessControlEntry[] getAccessControlEntry( - RemoteAccessControlEntry[] remote) { - final AccessControlEntry[] local = new AccessControlEntry[remote.length]; - for (int i = 0; i < local.length; i++) { - local[i] = getAccessControlEntry(remote[i]); - } - return local; - } - - /** - * {@inheritDoc} - */ - public Principal getPrincipal(RemotePrincipal remote) { - if (remote instanceof RemoteGroup) { - return new ClientGroup(remote, this); - } - return new ClientPrincipal(remote); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public Iterator getPrincipalIterator(RemoteIterator remote) { - return new ClientPrincipalIterator(remote, this); - } - - /** - * {@inheritDoc} - */ - public Privilege getPrivilege(RemotePrivilege remote) { - return new ClientPrivilege(remote, this); - } - - /** - * {@inheritDoc} - */ - public Privilege[] getPrivilege(RemotePrivilege[] remote) { - final Privilege[] local = new Privilege[remote.length]; - for (int i = 0; i < local.length; i++) { - local[i] = getPrivilege(remote[i]); - } - return local; - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientItem.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientItem.java deleted file mode 100644 index cb5bbe5fcbe..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientItem.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.Item; -import javax.jcr.ItemVisitor; -import javax.jcr.Node; -import javax.jcr.Property; -import javax.jcr.RepositoryException; -import javax.jcr.Session; - -import org.apache.jackrabbit.rmi.remote.RemoteItem; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteItem RemoteItem} - * interface. This class makes a remote item locally available using - * the JCR {@link javax.jcr.Item Item} interface. Used mainly as the - * base class for the - * {@link org.apache.jackrabbit.rmi.client.ClientProperty ClientProperty} - * and - * {@link org.apache.jackrabbit.rmi.client.ClientNode ClientNode} adapters. - * - * @see javax.jcr.Item - * @see org.apache.jackrabbit.rmi.remote.RemoteItem - */ -public class ClientItem extends ClientObject implements Item { - - /** Current session. */ - private Session session; - - /** The adapted remote item. */ - private RemoteItem remote; - - /** - * Creates a local adapter for the given remote item. - * - * @param session current session - * @param remote remote item - * @param factory local adapter factory - */ - public ClientItem(Session session, RemoteItem remote, - LocalAdapterFactory factory) { - super(factory); - this.session = session; - this.remote = remote; - } - - /** - * Returns the current session without contacting the remote item. - * - * {@inheritDoc} - */ - public Session getSession() { - return session; - } - - /** {@inheritDoc} */ - public String getPath() throws RepositoryException { - try { - return remote.getPath(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getName() throws RepositoryException { - try { - return remote.getName(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Item getAncestor(int level) throws RepositoryException { - try { - return getItem(getSession(), remote.getAncestor(level)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Node getParent() throws RepositoryException { - try { - return getNode(getSession(), remote.getParent()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public int getDepth() throws RepositoryException { - try { - return remote.getDepth(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** - * Returns false by default without contacting the remote item. - * This method should be overridden by {@link Node Node} subclasses. - * - * {@inheritDoc} - * - * @return false - */ - public boolean isNode() { - return false; - } - - /** {@inheritDoc} */ - public boolean isNew() { - try { - return remote.isNew(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isModified() { - try { - return remote.isModified(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** - * Checks whether this instance represents the same repository item as - * the given other instance. A simple heuristic is used to first check - * some generic conditions (null values, instance equality, type equality), - * after which the item paths are compared to determine sameness. - * A RuntimeException is thrown if the item paths cannot be retrieved. - * - * {@inheritDoc} - * - * @see Item#getPath() - */ - public boolean isSame(Item item) throws RepositoryException { - if (item == null) { - return false; - } else if (equals(item)) { - return true; - } else if (isNode() == item.isNode()) { - return getPath().equals(item.getPath()); - } else { - return false; - } - } - - /** - * Accepts the visitor to visit this item. {@link Node Node} and - * {@link Property Property} subclasses should override this method - * to call the appropriate {@link ItemVisitor ItemVisitor} methods, - * as the default implementation does nothing. - * - * {@inheritDoc} - */ - public void accept(ItemVisitor visitor) throws RepositoryException { - } - - /** {@inheritDoc} */ - public void save() throws RepositoryException { - try { - remote.save(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void refresh(boolean keepChanges) throws RepositoryException { - try { - remote.refresh(keepChanges); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void remove() throws RepositoryException { - try { - remote.remove(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientItemDefinition.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientItemDefinition.java deleted file mode 100644 index c758f227198..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientItemDefinition.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.nodetype.ItemDefinition; -import javax.jcr.nodetype.NodeType; - -import org.apache.jackrabbit.rmi.remote.RemoteItemDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteItemDefinition RemoteItemDefinition} - * interface. This class makes a remote item definition locally available using - * the JCR {@link javax.jcr.nodetype.ItemDefinition ItemDef} interface. Used mainly - * as the base class for the - * {@link org.apache.jackrabbit.rmi.client.ClientPropertyDefinition ClientPropertyDefinition} - * and - * {@link org.apache.jackrabbit.rmi.client.ClientNodeDefinition ClientNodeDefinition} adapters. - * - * @see javax.jcr.nodetype.ItemDefinition - * @see org.apache.jackrabbit.rmi.remote.RemoteItemDefinition - */ -public class ClientItemDefinition extends ClientObject implements ItemDefinition { - - /** The adapted remote item definition. */ - private RemoteItemDefinition remote; - - /** - * Creates a local adapter for the given remote item definition. - * - * @param remote remote item definition - * @param factory local adapter factory - */ - public ClientItemDefinition(RemoteItemDefinition remote, LocalAdapterFactory factory) { - super(factory); - this.remote = remote; - } - - /** {@inheritDoc} */ - public NodeType getDeclaringNodeType() { - try { - RemoteNodeType nt = remote.getDeclaringNodeType(); - if (nt == null) { - return null; - } else { - return getFactory().getNodeType(nt); - } - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String getName() { - try { - return remote.getName(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isAutoCreated() { - try { - return remote.isAutoCreated(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isMandatory() { - try { - return remote.isMandatory(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public int getOnParentVersion() { - try { - return remote.getOnParentVersion(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isProtected() { - try { - return remote.isProtected(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientLock.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientLock.java deleted file mode 100644 index c4abc32c272..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientLock.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.Node; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.lock.Lock; - -import org.apache.jackrabbit.rmi.remote.RemoteLock; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteLock RemoteLock} - * interface. This class makes a remote lock locally available using - * the JCR {@link javax.jcr.lock.Lock Lock} interface. - * - * @see javax.jcr.lock.Lock - * @see org.apache.jackrabbit.rmi.remote.RemoteLock - */ -public class ClientLock extends ClientObject implements Lock { - - /** Current session. */ - private Session session; - - /** The adapted remote lock. */ - private RemoteLock remote; - - /** - * Creates a local adapter for the given remote lock. - * - * @param session current session - * @param remote remote lock - * @param factory local adapter factory - */ - public ClientLock(Session session, RemoteLock remote, LocalAdapterFactory factory) { - super(factory); - this.session = session; - this.remote = remote; - } - - /** {@inheritDoc} */ - public Node getNode() { - try { - return getNode(session, remote.getNode()); - } catch (RemoteException e) { - throw new RemoteRuntimeException(e); - } catch (RepositoryException e) { - throw new RuntimeException(e); - } - } - - /** {@inheritDoc} */ - public String getLockOwner() { - try { - return remote.getLockOwner(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isDeep() { - try { - return remote.isDeep(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String getLockToken() { - try { - return remote.getLockToken(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isLive() throws RepositoryException { - try { - return remote.isLive(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public void refresh() throws RepositoryException { - try { - remote.refresh(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isSessionScoped() { - try { - return remote.isSessionScoped(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public long getSecondsRemaining() throws RepositoryException { - try { - return remote.getSecondsRemaining(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isLockOwningSession() { - try { - return remote.isLockOwningSession(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientLockManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientLockManager.java deleted file mode 100644 index a8dd98135c7..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientLockManager.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.lock.Lock; -import javax.jcr.lock.LockManager; - -import org.apache.jackrabbit.rmi.remote.RemoteLockManager; - -public class ClientLockManager extends ClientObject implements LockManager { - - /** The current session. */ - private Session session; - - private RemoteLockManager remote; - - public ClientLockManager( - Session session, RemoteLockManager remote, - LocalAdapterFactory factory) { - super(factory); - this.session = session; - this.remote = remote; - } - - public String[] getLockTokens() throws RepositoryException { - try { - return remote.getLockTokens(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public void addLockToken(String lockToken) throws RepositoryException { - try { - remote.addLockToken(lockToken); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public void removeLockToken(String lockToken) throws RepositoryException { - try { - remote.removeLockToken(lockToken); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public Lock getLock(String absPath) throws RepositoryException { - try { - return getFactory().getLock(session, remote.getLock(absPath)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public boolean holdsLock(String absPath) throws RepositoryException { - try { - return remote.holdsLock(absPath); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public boolean isLocked(String absPath) throws RepositoryException { - try { - return remote.isLocked(absPath); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public Lock lock( - String absPath, boolean isDeep, boolean isSessionScoped, - long timeoutHint, String ownerInfo) throws RepositoryException { - try { - return getFactory().getLock(session, remote.lock( - absPath, isDeep, isSessionScoped, timeoutHint, ownerInfo)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public void unlock(String absPath) throws RepositoryException { - try { - remote.unlock(absPath); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNamespaceRegistry.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNamespaceRegistry.java deleted file mode 100644 index 9d6b21eaa2f..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNamespaceRegistry.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.NamespaceRegistry; -import javax.jcr.RepositoryException; - -import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry RemoteNamespaceRegistry} - * interface. This class makes a remote namespace registry locally available - * using the JCR {@link javax.jcr.NamespaceRegistry NamespaceRegistry} - * interface. - * - * @see javax.jcr.NamespaceRegistry - * @see org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry - */ -public class ClientNamespaceRegistry extends ClientObject implements - NamespaceRegistry { - - /** The adapted remote namespace registry. */ - private RemoteNamespaceRegistry remote; - - /** - * Creates a local adapter for the given remote namespace registry. - * - * @param remote remote namespace registry - * @param factory local adapter factory - */ - public ClientNamespaceRegistry( - RemoteNamespaceRegistry remote, LocalAdapterFactory factory) { - super(factory); - this.remote = remote; - } - - /** {@inheritDoc} */ - public void registerNamespace(String prefix, String uri) - throws RepositoryException { - try { - remote.registerNamespace(prefix, uri); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void unregisterNamespace(String prefix) throws RepositoryException { - try { - remote.unregisterNamespace(prefix); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getPrefixes() throws RepositoryException { - try { - return remote.getPrefixes(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getURIs() throws RepositoryException { - try { - return remote.getURIs(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getURI(String prefix) throws RepositoryException { - try { - return remote.getURI(prefix); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getPrefix(String uri) throws RepositoryException { - try { - return remote.getPrefix(uri); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java deleted file mode 100644 index 09f2f2b1049..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java +++ /dev/null @@ -1,798 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.io.InputStream; -import java.math.BigDecimal; -import java.rmi.RemoteException; -import java.util.Calendar; - -import javax.jcr.Binary; -import javax.jcr.Item; -import javax.jcr.ItemVisitor; -import javax.jcr.Node; -import javax.jcr.NodeIterator; -import javax.jcr.Property; -import javax.jcr.PropertyIterator; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.Value; -import javax.jcr.lock.Lock; -import javax.jcr.nodetype.NodeDefinition; -import javax.jcr.nodetype.NodeType; -import javax.jcr.version.Version; -import javax.jcr.version.VersionHistory; - -import org.apache.jackrabbit.rmi.remote.RemoteLock; -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteProperty; -import org.apache.jackrabbit.rmi.value.SerialValueFactory; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteNode RemoteNode} - * interface. This class makes a remote node locally available using - * the JCR {@link javax.jcr.Node Node} interface. - * - * @see javax.jcr.Node - * @see org.apache.jackrabbit.rmi.remote.RemoteNode - */ -public class ClientNode extends ClientItem implements Node { - - /** The adapted remote node. */ - private RemoteNode remote; - - /** - * Creates a local adapter for the given remote node. - * - * @param session current session - * @param remote remote node - * @param factory local adapter factory - */ - public ClientNode( - Session session, RemoteNode remote, LocalAdapterFactory factory) { - super(session, remote, factory); - this.remote = remote; - } - - /** - * Returns true without contacting the remote node. - * - * {@inheritDoc} - */ - public boolean isNode() { - return true; - } - - /** - * Calls the {@link ItemVisitor#visit(Node) ItemVisitor.visit(Node)} - * method of the given visitor. Does not contact the remote node, but - * the visitor may invoke other methods that do contact the remote node. - * - * {@inheritDoc} - */ - public void accept(ItemVisitor visitor) throws RepositoryException { - visitor.visit(this); - } - - /** {@inheritDoc} */ - public Node addNode(String path) throws RepositoryException { - try { - return getNode(getSession(), remote.addNode(path)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Node addNode(String path, String type) throws RepositoryException { - try { - RemoteNode node = remote.addNode(path, type); - return getNode(getSession(), node); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void orderBefore(String src, String dst) throws RepositoryException { - try { - remote.orderBefore(src, dst); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, Value value) - throws RepositoryException { - try { - if (value == null) { - remote.setProperty(name, value); - return null; - } else { - RemoteProperty property = remote.setProperty( - name, SerialValueFactory.makeSerialValue(value)); - return getFactory().getProperty(getSession(), property); - } - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, Value[] values) - throws RepositoryException { - try { - if (values == null) { - remote.setProperty(name, values); - return null; - } else { - Value[] serials = SerialValueFactory.makeSerialValueArray(values); - RemoteProperty property = remote.setProperty(name, serials); - return getFactory().getProperty(getSession(), property); - } - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, String[] strings) - throws RepositoryException { - try { - if (strings == null) { - remote.setProperty(name, (Value[]) null); - return null; - } else { - Value[] serials = SerialValueFactory.makeSerialValueArray(strings); - RemoteProperty property = remote.setProperty(name, serials); - return getFactory().getProperty(getSession(), property); - } - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, String value) - throws RepositoryException { - if (value == null) { - return setProperty(name, (Value) null); - } else { - return setProperty(name, getSession().getValueFactory().createValue(value)); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, InputStream value) - throws RepositoryException { - if (value == null) { - return setProperty(name, (Value) null); - } else { - return setProperty(name, getSession().getValueFactory().createValue(value)); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, boolean value) - throws RepositoryException { - return setProperty(name, getSession().getValueFactory().createValue(value)); - } - - /** {@inheritDoc} */ - public Property setProperty(String name, double value) - throws RepositoryException { - return setProperty(name, getSession().getValueFactory().createValue(value)); - } - - /** {@inheritDoc} */ - public Property setProperty(String name, long value) - throws RepositoryException { - return setProperty(name, getSession().getValueFactory().createValue(value)); - } - - /** {@inheritDoc} */ - public Property setProperty(String name, Calendar value) - throws RepositoryException { - if (value == null) { - return setProperty(name, (Value) null); - } else { - return setProperty(name, getSession().getValueFactory().createValue(value)); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, Node value) - throws RepositoryException { - if (value == null) { - return setProperty(name, (Value) null); - } else { - return setProperty(name, getSession().getValueFactory().createValue(value)); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, Binary value) - throws RepositoryException { - if (value == null) { - return setProperty(name, (Value) null); - } else { - return setProperty( - name, getSession().getValueFactory().createValue(value)); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, BigDecimal value) - throws RepositoryException { - if (value == null) { - return setProperty(name, (Value) null); - } else { - return setProperty( - name, getSession().getValueFactory().createValue(value)); - } - } - - /** {@inheritDoc} */ - public Node getNode(String path) throws RepositoryException { - try { - return getNode(getSession(), remote.getNode(path)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeIterator getNodes() throws RepositoryException { - try { - return getFactory().getNodeIterator(getSession(), remote.getNodes()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeIterator getNodes(String pattern) throws RepositoryException { - try { - return getFactory().getNodeIterator(getSession(), remote.getNodes(pattern)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeIterator getNodes(String[] globs) throws RepositoryException { - try { - return getFactory().getNodeIterator(getSession(), remote.getNodes(globs)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Property getProperty(String path) throws RepositoryException { - try { - RemoteProperty property = remote.getProperty(path); - return getFactory().getProperty(getSession(), property); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public PropertyIterator getProperties() throws RepositoryException { - try { - return getFactory().getPropertyIterator(getSession(), remote.getProperties()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public PropertyIterator getProperties(String pattern) - throws RepositoryException { - try { - return getFactory().getPropertyIterator(getSession(), remote.getProperties(pattern)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public PropertyIterator getProperties(String[] globs) - throws RepositoryException { - try { - return getFactory().getPropertyIterator(getSession(), remote.getProperties(globs)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Item getPrimaryItem() throws RepositoryException { - try { - return getItem(getSession(), remote.getPrimaryItem()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getIdentifier() throws RepositoryException { - try { - return remote.getIdentifier(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getUUID() throws RepositoryException { - try { - return remote.getUUID(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public PropertyIterator getReferences() throws RepositoryException { - try { - return getFactory().getPropertyIterator(getSession(), remote.getReferences()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public PropertyIterator getReferences(String name) - throws RepositoryException { - try { - return getFactory().getPropertyIterator(getSession(), remote.getReferences(name)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasNode(String path) throws RepositoryException { - try { - return remote.hasNode(path); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasProperty(String path) throws RepositoryException { - try { - return remote.hasProperty(path); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasNodes() throws RepositoryException { - try { - return remote.hasNodes(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasProperties() throws RepositoryException { - try { - return remote.hasProperties(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeType getPrimaryNodeType() throws RepositoryException { - try { - return getFactory().getNodeType(remote.getPrimaryNodeType()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeType[] getMixinNodeTypes() throws RepositoryException { - try { - return getNodeTypeArray(remote.getMixinNodeTypes()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isNodeType(String type) throws RepositoryException { - try { - return remote.isNodeType(type); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void addMixin(String name) throws RepositoryException { - try { - remote.addMixin(name); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeMixin(String name) throws RepositoryException { - try { - remote.removeMixin(name); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean canAddMixin(String name) throws RepositoryException { - try { - return remote.canAddMixin(name); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeDefinition getDefinition() throws RepositoryException { - try { - return getFactory().getNodeDef(remote.getDefinition()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Version checkin() throws RepositoryException { - try { - return getFactory().getVersion(getSession(), remote.checkin()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void checkout() throws RepositoryException { - try { - remote.checkout(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void update(String workspace) throws RepositoryException { - try { - remote.update(workspace); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeIterator merge(String workspace, boolean bestEffort) - throws RepositoryException { - try { - return getFactory().getNodeIterator(getSession(), remote.merge(workspace, bestEffort)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void cancelMerge(Version version) throws RepositoryException { - try { - remote.cancelMerge(version.getUUID()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void doneMerge(Version version) throws RepositoryException { - try { - remote.doneMerge(version.getUUID()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getCorrespondingNodePath(String workspace) - throws RepositoryException { - try { - return remote.getCorrespondingNodePath(workspace); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public int getIndex() throws RepositoryException { - try { - return remote.getIndex(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void restore(String version, boolean removeExisting) - throws RepositoryException { - try { - remote.restore(version, removeExisting); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void restore(Version version, boolean removeExisting) - throws RepositoryException { - try { - remote.restoreByUUID(version.getUUID(), removeExisting); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void restore(Version version, String path, boolean removeExisting) - throws RepositoryException { - try { - remote.restore(version.getUUID(), path, removeExisting); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void restoreByLabel(String label, boolean removeExisting) - throws RepositoryException { - try { - remote.restoreByLabel(label, removeExisting); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, String[] strings, int type) - throws RepositoryException { - try { - if (strings == null) { - remote.setProperty(name, (Value[]) null); - return null; - } else { - Value[] serials = SerialValueFactory.makeSerialValueArray(strings); - RemoteProperty property = remote.setProperty(name, serials, type); - return getFactory().getProperty(getSession(), property); - } - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, Value[] values, int type) - throws RepositoryException { - try { - if (values != null) { - values = SerialValueFactory.makeSerialValueArray(values); - } - RemoteProperty property = remote.setProperty(name, values, type); - if (property != null) { - return getFactory().getProperty(getSession(), property); - } else { - return null; - } - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, Value value, int type) - throws RepositoryException { - try { - if (value != null) { - value = SerialValueFactory.makeSerialValue(value); - } - RemoteProperty property = remote.setProperty(name, value, type); - if (property != null) { - return getFactory().getProperty(getSession(), property); - } else { - return null; - } - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Property setProperty(String name, String string, int type) - throws RepositoryException { - Value value = null; - if (string != null) { - value = getSession().getValueFactory().createValue(string); - } - return setProperty(name, value, type); - } - - /** {@inheritDoc} */ - public boolean isCheckedOut() throws RepositoryException { - try { - return remote.isCheckedOut(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public VersionHistory getVersionHistory() throws RepositoryException { - try { - return getFactory().getVersionHistory(getSession(), remote.getVersionHistory()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Version getBaseVersion() throws RepositoryException { - try { - return getFactory().getVersion(getSession(), remote.getBaseVersion()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Lock lock(boolean isDeep, boolean isSessionScoped) - throws RepositoryException { - try { - RemoteLock lock = remote.lock(isDeep, isSessionScoped); - return getFactory().getLock(getSession(), lock); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Lock getLock() throws RepositoryException { - try { - return getFactory().getLock(getSession(), remote.getLock()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void unlock() throws RepositoryException { - try { - remote.unlock(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean holdsLock() throws RepositoryException { - try { - return remote.holdsLock(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isLocked() throws RepositoryException { - try { - return remote.isLocked(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void followLifecycleTransition(String transition) - throws RepositoryException { - try { - remote.followLifecycleTransition(transition); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getAllowedLifecycleTransistions() - throws RepositoryException { - try { - return remote.getAllowedLifecycleTransistions(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeIterator getSharedSet() throws RepositoryException { - try { - return getFactory().getNodeIterator(getSession(), remote.getSharedSet()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public PropertyIterator getWeakReferences() throws RepositoryException { - try { - return getFactory().getPropertyIterator(getSession(), remote.getWeakReferences()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public PropertyIterator getWeakReferences(String name) - throws RepositoryException { - try { - return getFactory().getPropertyIterator(getSession(), remote.getWeakReferences(name)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeShare() throws RepositoryException { - try { - remote.removeShare(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeSharedSet() throws RepositoryException { - try { - remote.removeSharedSet(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void setPrimaryType(String nodeTypeName) - throws RepositoryException { - try { - remote.setPrimaryType(nodeTypeName); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNodeDefinition.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNodeDefinition.java deleted file mode 100644 index 1412f227a6d..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNodeDefinition.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.nodetype.NodeDefinition; -import javax.jcr.nodetype.NodeType; - -import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition RemoteNodeDefinition} - * interface. This class makes a remote node definition locally available using - * the JCR {@link javax.jcr.nodetype.NodeDefinition NodeDef} interface. - * - * @see javax.jcr.nodetype.NodeDefinition - * @see org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition - */ -public class ClientNodeDefinition extends ClientItemDefinition implements NodeDefinition { - - /** The adapted remote node definition. */ - private RemoteNodeDefinition remote; - - /** - * Creates a local adapter for the given remote node definition. - * - * @param remote remote node definition - * @param factory local adapter factory - */ - public ClientNodeDefinition(RemoteNodeDefinition remote, LocalAdapterFactory factory) { - super(remote, factory); - this.remote = remote; - } - - /** {@inheritDoc} */ - public NodeType[] getRequiredPrimaryTypes() { - try { - return getNodeTypeArray(remote.getRequiredPrimaryTypes()); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public NodeType getDefaultPrimaryType() { - try { - RemoteNodeType nt = remote.getDefaultPrimaryType(); - if (nt == null) { - return null; - } else { - return getFactory().getNodeType(nt); - } - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean allowsSameNameSiblings() { - try { - return remote.allowsSameNameSiblings(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String getDefaultPrimaryTypeName() { - try { - return remote.getDefaultPrimaryTypeName(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getRequiredPrimaryTypeNames() { - try { - return remote.getRequiredPrimaryTypeNames(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNodeType.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNodeType.java deleted file mode 100644 index 5f23c047c35..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNodeType.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.Value; -import javax.jcr.nodetype.NodeDefinition; -import javax.jcr.nodetype.NodeType; -import javax.jcr.nodetype.NodeTypeIterator; -import javax.jcr.nodetype.PropertyDefinition; - -import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; -import org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition; -import org.apache.jackrabbit.rmi.value.SerialValueFactory; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeType RemoteNodeType} - * interface. This class makes a remote node type locally available using - * the JCR {@link javax.jcr.nodetype.NodeType NodeType} interface. - * - * @see javax.jcr.nodetype.NodeType - * @see org.apache.jackrabbit.rmi.remote.RemoteNodeType - */ -public class ClientNodeType extends ClientObject implements NodeType { - - /** The adapted remote node type. */ - private RemoteNodeType remote; - - /** - * Creates a local adapter for the given remote node type. - * - * @param remote remote node type - * @param factory local adapter factory - */ - public ClientNodeType(RemoteNodeType remote, LocalAdapterFactory factory) { - super(factory); - this.remote = remote; - } - - /** - * Utility method for creating an array of local node definition - * adapters for an array of remote node definitions. The node - * definition adapters are created using the local adapter factory. - *

- * A null input is treated as an empty array. - * - * @param remotes remote node definitions - * @return local node definition array - */ - private NodeDefinition[] getNodeDefArray(RemoteNodeDefinition[] remotes) { - if (remotes != null) { - NodeDefinition[] defs = new NodeDefinition[remotes.length]; - for (int i = 0; i < remotes.length; i++) { - defs[i] = getFactory().getNodeDef(remotes[i]); - } - return defs; - } else { - return new NodeDefinition[0]; // for safety - } - } - - /** - * Utility method for creating an array of local property definition - * adapters for an array of remote property definitions. The property - * definition adapters are created using the local adapter factory. - *

- * A null input is treated as an empty array. - * - * @param remotes remote property definitions - * @return local property definition array - */ - protected PropertyDefinition[] getPropertyDefArray( - RemotePropertyDefinition[] remotes) { - if (remotes != null) { - PropertyDefinition[] defs = new PropertyDefinition[remotes.length]; - for (int i = 0; i < remotes.length; i++) { - defs[i] = getFactory().getPropertyDef(remotes[i]); - } - return defs; - } else { - return new PropertyDefinition[0]; // for safety - } - } - - /** {@inheritDoc} */ - public String getName() { - try { - return remote.getName(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isMixin() { - try { - return remote.isMixin(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasOrderableChildNodes() { - try { - return remote.hasOrderableChildNodes(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public NodeType[] getSupertypes() { - try { - return getNodeTypeArray(remote.getSupertypes()); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public NodeType[] getDeclaredSupertypes() { - try { - return getNodeTypeArray(remote.getDeclaredSupertypes()); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isNodeType(String type) { - try { - return remote.isNodeType(type); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public PropertyDefinition[] getPropertyDefinitions() { - try { - return getPropertyDefArray(remote.getPropertyDefs()); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public PropertyDefinition[] getDeclaredPropertyDefinitions() { - try { - return getPropertyDefArray(remote.getDeclaredPropertyDefs()); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public NodeDefinition[] getChildNodeDefinitions() { - try { - return getNodeDefArray(remote.getChildNodeDefs()); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public NodeDefinition[] getDeclaredChildNodeDefinitions() { - try { - return getNodeDefArray(remote.getDeclaredChildNodeDefs()); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean canSetProperty(String name, Value value) { - try { - return remote.canSetProperty( - name, SerialValueFactory.makeSerialValue(value)); - } catch (RepositoryException e) { - throw new RuntimeException("Unable to serialize value", e); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean canSetProperty(String name, Value[] values) { - try { - Value[] serials = SerialValueFactory.makeSerialValueArray(values); - return remote.canSetProperty(name, serials); - } catch (RepositoryException e) { - throw new RuntimeException("Unable to serialize values", e); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean canAddChildNode(String name) { - try { - return remote.canAddChildNode(name); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean canAddChildNode(String name, String type) { - try { - return remote.canAddChildNode(name, type); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean canRemoveItem(String name) { - try { - return remote.canRemoveItem(name); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String getPrimaryItemName() { - try { - return remote.getPrimaryItemName(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean canRemoveNode(String nodeName) { - try { - return remote.canRemoveNode(nodeName); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean canRemoveProperty(String propertyName) { - try { - return remote.canRemoveProperty(propertyName); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public NodeTypeIterator getDeclaredSubtypes() { - try { - return getFactory().getNodeTypeIterator(remote.getDeclaredSubtypes()); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public NodeTypeIterator getSubtypes() { - try { - return getFactory().getNodeTypeIterator(remote.getSubtypes()); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getDeclaredSupertypeNames() { - try { - return remote.getDeclaredSupertypeNames(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isAbstract() { - try { - return remote.isAbstract(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isQueryable() { - try { - return remote.isQueryable(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNodeTypeManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNodeTypeManager.java deleted file mode 100644 index c1d9e438c64..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNodeTypeManager.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.UnsupportedRepositoryOperationException; -import javax.jcr.nodetype.NodeDefinitionTemplate; -import javax.jcr.nodetype.NodeType; -import javax.jcr.nodetype.NodeTypeDefinition; -import javax.jcr.nodetype.NodeTypeIterator; -import javax.jcr.nodetype.NodeTypeManager; -import javax.jcr.nodetype.NodeTypeTemplate; -import javax.jcr.nodetype.PropertyDefinitionTemplate; - -import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager RemoteNodeTypeManager} - * interface. This class makes a remote node type manager locally available - * using the JCR {@link javax.jcr.nodetype.NodeTypeManager NodeTypeManager} - * interface. - * - * @see javax.jcr.nodetype.NodeTypeManager - * @see org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager - */ -public class ClientNodeTypeManager extends ClientObject - implements NodeTypeManager { - - /** The adapted remote node type manager. */ - private RemoteNodeTypeManager remote; - - /** - * Creates a local adapter for the given remote node type manager. - * - * @param remote remote node type manager - * @param factory local adapter factory - */ - public ClientNodeTypeManager( - RemoteNodeTypeManager remote, LocalAdapterFactory factory) { - super(factory); - this.remote = remote; - } - - /** {@inheritDoc} */ - public NodeType getNodeType(String name) throws RepositoryException { - try { - return getFactory().getNodeType(remote.getNodeType(name)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeTypeIterator getAllNodeTypes() throws RepositoryException { - try { - return getFactory().getNodeTypeIterator(remote.getAllNodeTypes()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeTypeIterator getPrimaryNodeTypes() throws RepositoryException { - try { - return getFactory().getNodeTypeIterator(remote.getPrimaryNodeTypes()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeTypeIterator getMixinNodeTypes() throws RepositoryException { - try { - return getFactory().getNodeTypeIterator(remote.getMixinNodeTypes()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public NodeDefinitionTemplate createNodeDefinitionTemplate() - throws RepositoryException { - throw new UnsupportedRepositoryOperationException("TODO: JCR-3206"); - } - - public NodeTypeTemplate createNodeTypeTemplate() - throws RepositoryException { - throw new UnsupportedRepositoryOperationException("TODO: JCR-3206"); - } - - public NodeTypeTemplate createNodeTypeTemplate(NodeTypeDefinition ntd) - throws RepositoryException { - throw new UnsupportedRepositoryOperationException("TODO: JCR-3206"); - } - - public PropertyDefinitionTemplate createPropertyDefinitionTemplate() - throws RepositoryException { - throw new UnsupportedRepositoryOperationException("TODO: JCR-3206"); - } - - public boolean hasNodeType(String name) throws RepositoryException { - try { - return remote.hasNodeType(name); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public NodeType registerNodeType( - NodeTypeDefinition ntd, boolean allowUpdate) - throws RepositoryException { - throw new UnsupportedRepositoryOperationException("TODO: JCR-3206"); - } - - public NodeTypeIterator registerNodeTypes( - NodeTypeDefinition[] ntds, boolean allowUpdate) - throws RepositoryException { - throw new UnsupportedRepositoryOperationException("TODO: JCR-3206"); - } - - public void unregisterNodeType(String name) throws RepositoryException { - unregisterNodeTypes(new String[] { name }); - } - - public void unregisterNodeTypes(String[] names) throws RepositoryException { - try { - remote.unregisterNodeTypes(names); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientObject.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientObject.java deleted file mode 100644 index fbb0634fbe3..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientObject.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import javax.jcr.Item; -import javax.jcr.Node; -import javax.jcr.Session; -import javax.jcr.nodetype.NodeType; - -import org.apache.jackrabbit.rmi.remote.RemoteItem; -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; -import org.apache.jackrabbit.rmi.remote.RemoteProperty; -import org.apache.jackrabbit.rmi.remote.RemoteVersion; -import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory; - -/** - * Base class for client adapter objects. The only purpose of - * this class is to centralize the handling of the - * local adapter factory used by the client adapters to - * instantiate new adapters. - */ -public class ClientObject { - - /** Local adapter factory. */ - private LocalAdapterFactory factory; - - /** - * Creates a basic client adapter that uses the given factory - * to create new adapters. - * - * @param factory local adapter factory - */ - protected ClientObject(LocalAdapterFactory factory) { - this.factory = factory; - } - - /** - * Returns the local adapter factory used to create new adapters. - * - * @return local adapter factory - */ - protected LocalAdapterFactory getFactory() { - return factory; - } - - /** - * Utility method to create a local adapter for a remote item. - * This method introspects the remote reference to determine - * whether to instantiate a {@link javax.jcr.Property}, - * a {@link Node Node}, or an {@link Item Item} adapter using - * the local adapter factory. - *

- * If the remote item is a {@link RemoteNode}, this method delegates - * to {@link #getNode(Session, RemoteNode)}. - * - * @param session current session - * @param remote remote item - * @return local property, node, or item adapter - */ - protected Item getItem(Session session, RemoteItem remote) { - if (remote instanceof RemoteProperty) { - return factory.getProperty(session, (RemoteProperty) remote); - } else if (remote instanceof RemoteNode) { - return getNode(session, (RemoteNode) remote); - } else { - return factory.getItem(session, remote); - } - } - - /** - * Utility method to create a local adapter for a remote node. - * This method introspects the remote reference to determine - * whether to instantiate a {@link Node Node}, - * a {@link javax.jcr.version.VersionHistory VersionHistory}, or a - * {@link javax.jcr.version.Version Version} adapter using - * the local adapter factory. - * - * @param session current session - * @param remote remote node - * @return local node, version, or version history adapter - */ - protected Node getNode(Session session, RemoteNode remote) { - if (remote instanceof RemoteVersion) { - return factory.getVersion(session, (RemoteVersion) remote); - } else if (remote instanceof RemoteVersionHistory) { - return factory.getVersionHistory(session, (RemoteVersionHistory) remote); - } else { - return factory.getNode(session, remote); - } - } - - /** - * Utility method for creating an array of local node type adapters - * for an array of remote node types. The node type adapters are created - * using the local adapter factory. - *

- * A null input is treated as an empty array. - * - * @param remotes remote node types - * @return local node type array - */ - protected NodeType[] getNodeTypeArray(RemoteNodeType[] remotes) { - if (remotes != null) { - NodeType[] types = new NodeType[remotes.length]; - for (int i = 0; i < remotes.length; i++) { - types[i] = factory.getNodeType(remotes[i]); - } - return types; - } else { - return new NodeType[0]; // for safety - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientObservationManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientObservationManager.java deleted file mode 100644 index d1b57006ae8..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientObservationManager.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.UnsupportedRepositoryOperationException; -import javax.jcr.Workspace; -import javax.jcr.observation.EventJournal; -import javax.jcr.observation.EventListener; -import javax.jcr.observation.EventListenerIterator; -import javax.jcr.observation.ObservationManager; - -import org.apache.jackrabbit.rmi.iterator.ArrayEventListenerIterator; -import org.apache.jackrabbit.rmi.observation.ClientEventPoll; -import org.apache.jackrabbit.rmi.remote.RemoteObservationManager; - -/** - * The ClientObservationManager class - *

- * This class uses an instance of the - * {@link org.apache.jackrabbit.rmi.observation.ClientEventPoll} class for the - * actual registration and event dispatching. - *

- * This class does not require the - * {@link org.apache.jackrabbit.rmi.client.LocalAdapterFactory} and consequently - * calls the base class constructor with a null factory. - *

- * See the {@link org.apache.jackrabbit.rmi.observation observation} - * package comment for a description on how event listener registration and - * notification is implemented. - * - * @see org.apache.jackrabbit.rmi.observation.ClientEventPoll - */ -public class ClientObservationManager extends ClientObject implements - ObservationManager { - - /** The remote observation manager */ - private final RemoteObservationManager remote; - - /** The Workspace to which this observation manager belongs. */ - private final Workspace workspace; - - /** The ClientEventPoll class internally used for event dispatching */ - private ClientEventPoll poller; - - /** - * Creates an instance of this class talking to the given remote observation - * manager. - * - * @param remote The {@link RemoteObservationManager} backing this - * client-side observation manager. - * @param workspace The Workspace instance to which this - * observation manager belongs. - */ - public ClientObservationManager(Workspace workspace, - RemoteObservationManager remote) { - super(null); - this.remote = remote; - this.workspace = workspace; - } - - /** {@inheritDoc} */ - public void addEventListener(EventListener listener, int eventTypes, - String absPath, boolean isDeep, String[] uuid, - String[] nodeTypeName, boolean noLocal) - throws RepositoryException { - try { - long listenerId = getClientEventPoll().addListener(listener); - remote.addEventListener(listenerId, eventTypes, absPath, - isDeep, uuid, nodeTypeName, noLocal); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeEventListener(EventListener listener) - throws RepositoryException { - try { - long id = getClientEventPoll().removeListener(listener); - remote.removeEventListener(id); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public EventListenerIterator getRegisteredEventListeners() { - EventListener[] listeners = (poller != null) - ? poller.getListeners() - : new EventListener[0]; - return new ArrayEventListenerIterator(listeners); - } - - public EventJournal getEventJournal() throws RepositoryException { - throw new UnsupportedRepositoryOperationException("TODO: JCR-3206"); - } - - public EventJournal getEventJournal( - int eventTypes, String absPath, boolean isDeep, - String[] uuid, String[] nodeTypeName) throws RepositoryException { - throw new UnsupportedRepositoryOperationException("TODO: JCR-3206"); - } - - public void setUserData(String userData) throws RepositoryException { - throw new UnsupportedRepositoryOperationException("TODO: JCR-3206"); - } - - //---------- internal ------------------------------------------------------ - - /** - * Returns the {@link ClientEventPoll} instance used by this (client-side) - * observation manager. This method creates the instance on the first call - * and starts the poller thread to wait for remote events. - * - * @return poller instance - */ - private synchronized ClientEventPoll getClientEventPoll() { - if (poller == null) { - poller = new ClientEventPoll(remote, workspace.getSession()); - poller.start(); - } - return poller; - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java deleted file mode 100644 index fd565456e8b..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java +++ /dev/null @@ -1,445 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.io.InputStream; -import java.math.BigDecimal; -import java.rmi.RemoteException; -import java.util.Calendar; - -import javax.jcr.Binary; -import javax.jcr.ItemNotFoundException; -import javax.jcr.ItemVisitor; -import javax.jcr.Node; -import javax.jcr.PathNotFoundException; -import javax.jcr.Property; -import javax.jcr.PropertyType; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.Value; -import javax.jcr.ValueFactory; -import javax.jcr.ValueFormatException; -import javax.jcr.nodetype.PropertyDefinition; - -import org.apache.jackrabbit.rmi.remote.RemoteProperty; -import org.apache.jackrabbit.rmi.value.SerialValueFactory; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteProperty RemoteProperty} - * interface. This class makes a remote property locally available using - * the JCR {@link javax.jcr.Property Property} interface. - * - * @see javax.jcr.Property - * @see org.apache.jackrabbit.rmi.remote.RemoteProperty - */ -public class ClientProperty extends ClientItem implements Property { - - /** The adapted remote property. */ - private RemoteProperty remote; - - /** - * Creates a local adapter for the given remote property. - * - * @param session current session - * @param remote remote property - * @param factory local adapter factory - */ - public ClientProperty( - Session session, RemoteProperty remote, - LocalAdapterFactory factory) { - super(session, remote, factory); - this.remote = remote; - } - - /** - * Calls the {@link ItemVisitor#visit(Property) ItemVisitor.visit(Property} - * method of the given visitor. Does not contact the remote property, but - * the visitor may invoke other methods that do contact the remote property. - * - * {@inheritDoc} - */ - public void accept(ItemVisitor visitor) throws RepositoryException { - visitor.visit(this); - } - - /** - * Returns the boolean value of this property. Implemented as - * getValue().getBoolean(). - * - * {@inheritDoc} - */ - public boolean getBoolean() throws RepositoryException { - return getValue().getBoolean(); - } - - /** - * Returns the date value of this property. Implemented as - * getValue().getDate(). - * - * {@inheritDoc} - */ - public Calendar getDate() throws RepositoryException { - return getValue().getDate(); - } - - /** - * Returns the double value of this property. Implemented as - * getValue().getDouble(). - * - * {@inheritDoc} - */ - public double getDouble() throws RepositoryException { - return getValue().getDouble(); - } - - /** - * Returns the long value of this property. Implemented as - * getValue().getLong(). - * - * {@inheritDoc} - */ - public long getLong() throws RepositoryException { - return getValue().getLong(); - } - - /** - * Returns the binary value of this property. Implemented as - * getValue().getBinary(). - * - * {@inheritDoc} - */ - public Binary getBinary() throws RepositoryException { - return getValue().getBinary(); - } - - /** - * Returns the decimal value of this property. Implemented as - * getValue().getDecimal(). - * - * {@inheritDoc} - */ - public BigDecimal getDecimal() throws RepositoryException { - return getValue().getDecimal(); - } - - /** - * Returns the binary value of this property. Implemented as - * getValue().getStream(). - * - * {@inheritDoc} - */ - @SuppressWarnings("deprecation") - public InputStream getStream() throws RepositoryException { - return getValue().getStream(); - } - - /** - * Returns the string value of this property. Implemented as - * getValue().getString(). - * - * {@inheritDoc} - */ - public String getString() throws RepositoryException { - return getValue().getString(); - } - - /** {@inheritDoc} */ - public Value getValue() throws RepositoryException { - try { - return remote.getValue(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Value[] getValues() throws RepositoryException { - try { - return remote.getValues(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** - * Sets the boolean value of this property. Implemented as - * setValue(new BooleanValue(value)). - * - * {@inheritDoc} - */ - public void setValue(boolean value) throws RepositoryException { - setValue(getSession().getValueFactory().createValue(value)); - } - - /** - * Sets the date value of this property. Implemented as - * setValue(new DateValue(value)). - * - * {@inheritDoc} - */ - public void setValue(Calendar value) throws RepositoryException { - if (value == null) { - setValue((Value) null); - } else { - setValue(getSession().getValueFactory().createValue(value)); - } - } - - /** - * Sets the double value of this property. Implemented as - * setValue(new DoubleValue(value)). - * - * {@inheritDoc} - */ - public void setValue(double value) throws RepositoryException { - setValue(getSession().getValueFactory().createValue(value)); - } - - /** - * Sets the binary value of this property. Implemented as - * setValue(new BinaryValue(value)). - * - * {@inheritDoc} - */ - public void setValue(InputStream value) throws RepositoryException { - if (value == null) { - setValue((Value) null); - } else { - ValueFactory factory = getSession().getValueFactory(); - Binary binary = factory.createBinary(value); - try { - setValue(factory.createValue(binary)); - } finally { - binary.dispose(); - } - } - } - - /** - * Sets the long value of this property. Implemented as - * setValue(new LongValue(value)). - * - * {@inheritDoc} - */ - public void setValue(long value) throws RepositoryException { - setValue(getSession().getValueFactory().createValue(value)); - } - - /** - * Sets the binary value of this property. - * - * {@inheritDoc} - */ - public void setValue(Binary value) throws RepositoryException { - setValue(getSession().getValueFactory().createValue(value)); - } - - /** - * Sets the decimal value of this property. - * - * {@inheritDoc} - */ - public void setValue(BigDecimal value) throws RepositoryException { - setValue(getSession().getValueFactory().createValue(value)); - } - - - /** - * Sets the reference value of this property. Implemented as - * setValue(new ReferenceValue(value)). - * - * {@inheritDoc} - */ - public void setValue(Node value) throws RepositoryException { - if (value == null) { - setValue((Value) null); - } else { - setValue(getSession().getValueFactory().createValue(value)); - } - } - - /** - * Sets the string value of this property. Implemented as - * setValue(new StringValue(value)). - * - * {@inheritDoc} - */ - public void setValue(String value) throws RepositoryException { - if (value == null) { - setValue((Value) null); - } else { - setValue(getSession().getValueFactory().createValue(value)); - } - } - - /** - * {@inheritDoc} - */ - public void setValue(String[] strings) throws RepositoryException { - try { - Value[] values = null; - if (strings != null) { - values = SerialValueFactory.makeSerialValueArray(strings); - } - remote.setValue(values); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void setValue(Value value) throws RepositoryException { - try { - if (value != null) { - value = SerialValueFactory.makeSerialValue(value); - } - remote.setValue(value); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void setValue(Value[] values) throws RepositoryException { - try { - if (values != null) { - values = SerialValueFactory.makeSerialValueArray(values); - } - remote.setValue(values); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** - * Returns the reference value of this property. Implemented by - * converting the reference value to an UUID string and using the - * current session to look up the referenced node. - * - * {@inheritDoc} - */ - public Node getNode() throws RepositoryException { - String value = getString(); - - switch (getType()) { - case PropertyType.REFERENCE: - case PropertyType.WEAKREFERENCE: - return getSession().getNodeByIdentifier(value); - - case PropertyType.PATH: - try { - if (value.startsWith("/")) { - return getSession().getNode(value); - } else { - return getParent().getNode(value); - } - } catch (PathNotFoundException e) { - throw new ItemNotFoundException(value); - } - - case PropertyType.NAME: - try { - return getParent().getNode(value); - } catch (PathNotFoundException e) { - throw new ItemNotFoundException(value); - } - - case PropertyType.STRING: - try { - // interpret as identifier - Value refValue = getSession().getValueFactory().createValue(value, PropertyType.REFERENCE); - return getSession().getNodeByIdentifier(refValue.getString()); - } catch (ItemNotFoundException e) { - throw e; - } catch (RepositoryException e) { - // try if STRING value can be interpreted as PATH value - Value pathValue = getSession().getValueFactory().createValue(value, PropertyType.PATH); - boolean absolute = value.startsWith("/"); - try { - return (absolute) ? getSession().getNode(pathValue.getString()) : getParent().getNode(pathValue.getString()); - } catch (PathNotFoundException e1) { - throw new ItemNotFoundException(pathValue.getString()); - } - } - - default: - throw new ValueFormatException("Property value cannot be converted to a PATH, REFERENCE or WEAKREFERENCE: " + value); - } - } - - /** {@inheritDoc} */ - public Property getProperty() throws RepositoryException { - if (getType() != PropertyType.PATH && getType() != PropertyType.NAME) { - throw new ValueFormatException("Not a path property"); - } else { - String value = getString(); - try { - if (value.startsWith("/")) { - return getSession().getProperty(value); - } else { - return getParent().getProperty(value); - } - } catch (PathNotFoundException e) { - throw new ItemNotFoundException(value); - } - } - } - - /** {@inheritDoc} */ - public long getLength() throws RepositoryException { - try { - return remote.getLength(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public long[] getLengths() throws RepositoryException { - try { - return remote.getLengths(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public PropertyDefinition getDefinition() throws RepositoryException { - try { - return getFactory().getPropertyDef(remote.getDefinition()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public int getType() throws RepositoryException { - try { - return remote.getType(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isMultiple() throws RepositoryException { - // TODO: Direct remote call for this? - return getDefinition().isMultiple(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientPropertyDefinition.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientPropertyDefinition.java deleted file mode 100644 index 15955b321f4..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientPropertyDefinition.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.Value; -import javax.jcr.nodetype.PropertyDefinition; - -import org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition RemotePropertyDefinition} - * interface. This class makes a remote property definition locally available - * using the JCR {@link javax.jcr.nodetype.PropertyDefinition PropertyDef} interface. - * - * @see javax.jcr.nodetype.PropertyDefinition - * @see org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition - */ -public class ClientPropertyDefinition extends ClientItemDefinition implements PropertyDefinition { - - /** The adapted remote property. */ - private RemotePropertyDefinition remote; - - /** - * Creates a local adapter for the given remote property definition. - * - * @param remote remote property definition - * @param factory local adapter factory - */ - public ClientPropertyDefinition( - RemotePropertyDefinition remote, LocalAdapterFactory factory) { - super(remote, factory); - this.remote = remote; - } - - /** {@inheritDoc} */ - public int getRequiredType() { - try { - return remote.getRequiredType(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getValueConstraints() { - try { - return remote.getValueConstraints(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public Value[] getDefaultValues() { - try { - return remote.getDefaultValues(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isMultiple() { - try { - return remote.isMultiple(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getAvailableQueryOperators() { - try { - return remote.getAvailableQueryOperators(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isFullTextSearchable() { - try { - return remote.isFullTextSearchable(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isQueryOrderable() { - try { - return remote.isQueryOrderable(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientQuery.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientQuery.java deleted file mode 100644 index 0de4fde8995..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientQuery.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.Node; -import javax.jcr.Value; -import javax.jcr.query.Query; -import javax.jcr.query.QueryResult; - -import org.apache.jackrabbit.rmi.remote.RemoteQuery; - -/** - * Local adapter for the JCR-RMI - * {@link RemoteQuery RemoteQuery} - * interface. This class makes a remote query locally available using - * the JCR {@link Query Query} interface. - * - * @see javax.jcr.query.Query Query - * @see org.apache.jackrabbit.rmi.remote.RemoteQuery - */ -public class ClientQuery extends ClientObject implements Query { - - /** The current session */ - private Session session; - - /** The adapted remote query manager. */ - private RemoteQuery remote; - - /** - * Creates a client adapter for the given query. - * - * @param session current session - * @param remote remote query - * @param factory adapter factory - */ - public ClientQuery( - Session session, RemoteQuery remote, LocalAdapterFactory factory) { - super(factory); - this.session = session; - this.remote = remote; - } - - /** {@inheritDoc} */ - public QueryResult execute() throws RepositoryException { - try { - return getFactory().getQueryResult(session, remote.execute()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getStatement() { - try { - return remote.getStatement(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String getLanguage() { - try { - return remote.getLanguage(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String getStoredQueryPath() throws RepositoryException { - try { - return remote.getStoredQueryPath(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Node storeAsNode(String absPath) throws RepositoryException { - try { - return getNode(session, remote.storeAsNode(absPath)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void bindValue(String varName, Value value) - throws RepositoryException { - try { - remote.bindValue(varName, value); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getBindVariableNames() throws RepositoryException { - try { - return remote.getBindVariableNames(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void setLimit(long limit) { - try { - remote.setLimit(limit); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public void setOffset(long offset) { - try { - remote.setOffset(offset); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientQueryManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientQueryManager.java deleted file mode 100644 index a6919992e78..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientQueryManager.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.Node; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.query.Query; -import javax.jcr.query.QueryManager; -import javax.jcr.query.qom.QueryObjectModelFactory; - -import org.apache.jackrabbit.rmi.remote.RemoteQuery; -import org.apache.jackrabbit.rmi.remote.RemoteQueryManager; - -/** - * Local adapter for the JCR-RMI {@link RemoteQueryManager RemoteQueryManager} - * interface. This class makes a remote query manager locally available using - * the JCR {@link QueryManager QueryManager} interface. - * - * @see javax.jcr.query.QueryManager QueryManager - * @see org.apache.jackrabbit.rmi.remote.RemoteQueryManager - */ -public class ClientQueryManager extends ClientObject implements QueryManager { - - /** The current session */ - private Session session; - - /** The adapted remote query manager. */ - private RemoteQueryManager remote; - - /** - * Creates a client adapter for the given remote query manager. - * - * @param session current session - * @param remote remote query manager - * @param factory adapter factory - */ - public ClientQueryManager( - Session session, RemoteQueryManager remote, - LocalAdapterFactory factory) { - super(factory); - this.session = session; - this.remote = remote; - } - - /** {@inheritDoc} */ - public Query createQuery(String statement, String language) - throws RepositoryException { - try { - RemoteQuery query = remote.createQuery(statement, language); - return getFactory().getQuery(session, query); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Query getQuery(Node node) throws RepositoryException { - try { - // TODO fix this remote node dereferencing hack - RemoteQuery query = remote.getQuery(node.getPath()); - return getFactory().getQuery(session, query); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getSupportedQueryLanguages() throws RepositoryException { - try { - return remote.getSupportedQueryLanguages(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - public QueryObjectModelFactory getQOMFactory() { - throw new RuntimeException("TODO: JCR-3206"); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientQueryResult.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientQueryResult.java deleted file mode 100644 index dd2ef4b1d5e..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientQueryResult.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.NodeIterator; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.query.QueryResult; -import javax.jcr.query.RowIterator; - -import org.apache.jackrabbit.rmi.remote.RemoteQueryResult; - -/** - * Local adapter for the JCR-RMI - * {@link RemoteQueryResult RemoteQueryResult} - * interface. This class makes a remote query result locally available using - * the JCR {@link QueryResult QueryResult} interface. - * - * @see javax.jcr.query.QueryResult QueryResult - * @see org.apache.jackrabbit.rmi.remote.RemoteQueryResult - */ -public class ClientQueryResult extends ClientObject implements QueryResult { - - /** The current session */ - private Session session; - - /** The adapted remote query result. */ - private RemoteQueryResult remote; - - /** - * Creates a client adapter for the given remote query result. - * - * @param session current session - * @param remote remote query result - * @param factory adapter factory - */ - public ClientQueryResult( - Session session, RemoteQueryResult remote, - LocalAdapterFactory factory) { - super(factory); - this.session = session; - this.remote = remote; - } - - /** {@inheritDoc} */ - public String[] getColumnNames() throws RepositoryException { - try { - return remote.getColumnNames(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RowIterator getRows() throws RepositoryException { - try { - return getFactory().getRowIterator(session, remote.getRows()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeIterator getNodes() throws RepositoryException { - try { - return getFactory().getNodeIterator(session, remote.getNodes()); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public String[] getSelectorNames() throws RepositoryException { - try { - return remote.getSelectorNames(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java deleted file mode 100644 index f292298dc88..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; -import java.util.HashSet; -import java.util.Set; - -import javax.jcr.Credentials; -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.Value; - -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.remote.RemoteSession; -import org.apache.jackrabbit.rmi.value.SerialValueFactory; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteRepository RemoteRepository} - * interface. This class makes a remote repository locally available using - * the JCR {@link javax.jcr.Repository Repository} interface. - * - * @see javax.jcr.Repository - * @see org.apache.jackrabbit.rmi.remote.RemoteRepository - */ -public class ClientRepository implements Repository { - - /** - * The set of standard descriptor keys defined in the - * {@link Repository} interface. - */ - private static final Set STANDARD_KEYS = new HashSet() {{ - add(Repository.IDENTIFIER_STABILITY); - add(Repository.LEVEL_1_SUPPORTED); - add(Repository.LEVEL_2_SUPPORTED); - add(Repository.OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_AUTOCREATED_DEFINITIONS_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_INHERITANCE); - add(Repository.NODE_TYPE_MANAGEMENT_MULTIPLE_BINARY_PROPERTIES_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_MULTIVALUED_PROPERTIES_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_ORDERABLE_CHILD_NODES_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_OVERRIDES_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_PRIMARY_ITEM_NAME_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_PROPERTY_TYPES); - add(Repository.NODE_TYPE_MANAGEMENT_RESIDUAL_DEFINITIONS_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_VALUE_CONSTRAINTS_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_UPDATE_IN_USE_SUPORTED); - add(Repository.OPTION_ACCESS_CONTROL_SUPPORTED); - add(Repository.OPTION_JOURNALED_OBSERVATION_SUPPORTED); - add(Repository.OPTION_LIFECYCLE_SUPPORTED); - add(Repository.OPTION_LOCKING_SUPPORTED); - add(Repository.OPTION_OBSERVATION_SUPPORTED); - add(Repository.OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED); - add(Repository.OPTION_QUERY_SQL_SUPPORTED); - add(Repository.OPTION_RETENTION_SUPPORTED); - add(Repository.OPTION_SHAREABLE_NODES_SUPPORTED); - add(Repository.OPTION_SIMPLE_VERSIONING_SUPPORTED); - add(Repository.OPTION_TRANSACTIONS_SUPPORTED); - add(Repository.OPTION_UNFILED_CONTENT_SUPPORTED); - add(Repository.OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED); - add(Repository.OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED); - add(Repository.OPTION_VERSIONING_SUPPORTED); - add(Repository.OPTION_WORKSPACE_MANAGEMENT_SUPPORTED); - add(Repository.OPTION_XML_EXPORT_SUPPORTED); - add(Repository.OPTION_XML_IMPORT_SUPPORTED); - add(Repository.OPTION_ACTIVITIES_SUPPORTED); - add(Repository.OPTION_BASELINES_SUPPORTED); - - add(Repository.QUERY_FULL_TEXT_SEARCH_SUPPORTED); - add(Repository.QUERY_JOINS); - add(Repository.QUERY_LANGUAGES); - add(Repository.QUERY_STORED_QUERIES_SUPPORTED); - add(Repository.QUERY_XPATH_DOC_ORDER); - add(Repository.QUERY_XPATH_POS_INDEX); - add(Repository.REP_NAME_DESC); - add(Repository.REP_VENDOR_DESC); - add(Repository.REP_VENDOR_URL_DESC); - add(Repository.SPEC_NAME_DESC); - add(Repository.SPEC_VERSION_DESC); - add(Repository.WRITE_SUPPORTED); - }}; - - /** The adapted remote repository. */ - private final RemoteRepository remote; - - /** Local adapter factory. */ - private final LocalAdapterFactory factory; - - /** - * Creates a client adapter for the given remote repository. - * - * @param remote remote repository - * @param factory local adapter factory - */ - public ClientRepository( - RemoteRepository remote, LocalAdapterFactory factory) { - this.remote = remote; - this.factory = factory; - } - - /** {@inheritDoc} */ - public String getDescriptor(String name) { - try { - return remote.getDescriptor(name); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public Value getDescriptorValue(String key) { - String descriptor = getDescriptor(key); - if (descriptor != null) { - return SerialValueFactory.getInstance().createValue(descriptor); - } else { - return null; - } - } - - /** {@inheritDoc} */ - public Value[] getDescriptorValues(String key) { - try { - return remote.getDescriptorValues(key); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getDescriptorKeys() { - try { - return remote.getDescriptorKeys(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isSingleValueDescriptor(String key) { - return getDescriptor(key) != null; - } - - /** {@inheritDoc} */ - public Session login(Credentials credentials, String workspace) - throws RepositoryException { - try { - RemoteSession session = remote.login(credentials, workspace); - return factory.getSession(this, session); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** - * Returns true if the given key identifies a standard descriptor. - * - * @param key descriptor key - * @return true if the key identifies a standard descriptor, - * false otherwise - */ - public boolean isStandardDescriptor(String key) { - return STANDARD_KEYS.contains(key); - } - - /** - * Calls {@link Repository#login(Credentials, String)} with - * null arguments. - * - * @return logged in session - * @throws RepositoryException if an error occurs - */ - public Session login() throws RepositoryException { - return login(null, null); - } - - /** - * Calls {@link Repository#login(Credentials, String)} with - * the given credentials and a null workspace name. - * - * @param credentials login credentials - * @return logged in session - * @throws RepositoryException if an error occurs - */ - public Session login(Credentials credentials) throws RepositoryException { - return login(credentials, null); - } - - /** - * Calls {@link Repository#login(Credentials, String)} with - * null credentials and the given workspace name. - * - * @param workspace workspace name - * @return logged in session - * @throws RepositoryException if an error occurs - */ - public Session login(String workspace) throws RepositoryException { - return login(null, workspace); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepositoryFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepositoryFactory.java deleted file mode 100644 index 9aa41e5fd2e..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepositoryFactory.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.net.MalformedURLException; -import java.rmi.Naming; -import java.rmi.NotBoundException; -import java.rmi.RemoteException; -import java.util.Hashtable; - -import javax.jcr.Repository; -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.RefAddr; -import javax.naming.Reference; -import javax.naming.spi.ObjectFactory; - -import org.apache.jackrabbit.rmi.remote.RemoteRepository; - -/** - * Object factory for JCR-RMI clients. This factory can be used either - * directly or as a JNDI object factory. - * - * @see ClientRepository - */ -public class ClientRepositoryFactory implements ObjectFactory { - - /** - * The JNDI parameter name for configuring the RMI URL of - * a remote repository. - */ - public static final String URL_PARAMETER = "url"; - - /** - * Local adapter factory. - */ - private LocalAdapterFactory factory; - - /** - * Creates a JCR-RMI client factory with the default adapter factory. - */ - public ClientRepositoryFactory() { - this(new ClientAdapterFactory()); - } - - /** - * Creates a JCR-RMI client factory with the given adapter factory. - * - * @param factory local adapter factory - */ - public ClientRepositoryFactory(LocalAdapterFactory factory) { - this.factory = factory; - } - - /** - * Returns a client wrapper for a remote content repository. The remote - * repository is looked up from the RMI registry using the given URL by - * the returned {@link SafeClientRepository} instance. - *

- * The current implementation of this method will not throw any of the - * declared exceptions (because of the {@link SafeClientRepository} being - * used), but the throws clauses are kept for backwards compatibility and - * potential future use. Clients should be prepared to handle exceptions - * from this method. - * - * @param url the RMI URL of the remote repository - * @return repository client - * @throws MalformedURLException if the given URL is malfored - * @throws NotBoundException if the given URL points to nothing - * @throws ClassCastException if the given URL points to something unknown - * @throws RemoteException if the remote repository can not be accessed - */ - public Repository getRepository(final String url) - throws MalformedURLException, NotBoundException, - ClassCastException, RemoteException { - return new SafeClientRepository(factory) { - - protected RemoteRepository getRemoteRepository() - throws RemoteException { - try { - return (RemoteRepository) Naming.lookup(url); - } catch (MalformedURLException e) { - throw new RemoteException("Malformed URL: " + url, e); - } catch (NotBoundException e) { - throw new RemoteException("No target found: " + url, e); - } catch (ClassCastException e) { - throw new RemoteException("Unknown target: " + url, e); - } - } - - }; - } - - /** - * JNDI factory method for creating JCR-RMI clients. Creates a lazy - * client repository instance that uses the reference parameter "url" - * as the RMI URL where the remote repository is looked up when accessed. - * - * @param object reference parameters - * @param name unused - * @param context unused - * @param environment unused - * @return repository client - */ - public Object getObjectInstance( - Object object, Name name, Context context, Hashtable environment) { - if (object instanceof Reference) { - Reference reference = (Reference) object; - RefAddr url = reference.get(URL_PARAMETER); - if (url != null && url.getContent() != null) { - try { - return getRepository(url.getContent().toString()); - } catch (Exception e) { - return null; - } - } - } - return null; - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientRow.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientRow.java deleted file mode 100644 index 253b3c451b0..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientRow.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.Node; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.Value; -import javax.jcr.query.Row; - -import org.apache.jackrabbit.rmi.remote.RemoteRow; - -/** - * Local adapter for the JCR-RMI {@link RemoteRow RemoteRow} - * interface. This class makes a remote query row locally available using - * the JCR {@link Row Row} interface. - * - * @see javax.jcr.query.Row Row - * @see org.apache.jackrabbit.rmi.remote.RemoteRow - */ -public class ClientRow extends ClientObject implements Row { - - /** Current session. */ - private Session session; - - /** The remote query row. */ - private RemoteRow remote; - - /** - * Creates a client adapter for the given remote query row. - * - * @param remote remote query row - */ - public ClientRow(Session session, RemoteRow remote, - LocalAdapterFactory factory) { - super(factory); - this.session = session; - this.remote = remote; - } - - /** {@inheritDoc} */ - public Value[] getValues() throws RepositoryException { - try { - return remote.getValues(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Value getValue(String s) throws RepositoryException { - try { - return remote.getValue(s); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Node getNode() throws RepositoryException { - try { - return getFactory().getNode(session, remote.getNode()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Node getNode(String selectorName) throws RepositoryException { - try { - return getFactory().getNode(session, remote.getNode(selectorName)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getPath() throws RepositoryException { - try { - return remote.getPath(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getPath(String selectorName) throws RepositoryException { - try { - return remote.getPath(selectorName); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public double getScore() throws RepositoryException { - try { - return remote.getScore(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public double getScore(String selectorName) throws RepositoryException { - try { - return remote.getScore(selectorName); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java deleted file mode 100644 index 909ad2a6545..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java +++ /dev/null @@ -1,587 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.rmi.RemoteException; -import java.security.AccessControlException; - -import javax.jcr.Credentials; -import javax.jcr.Item; -import javax.jcr.Node; -import javax.jcr.Property; -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.UnsupportedRepositoryOperationException; -import javax.jcr.ValueFactory; -import javax.jcr.Workspace; -import javax.jcr.retention.RetentionManager; -import javax.jcr.security.AccessControlManager; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.stream.StreamSource; - -import org.apache.jackrabbit.rmi.remote.RemoteSession; -import org.apache.jackrabbit.rmi.value.SerialValueFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteSession RemoteSession} - * interface. This class makes a remote session locally available using - * the JCR {@link javax.jcr.Session Session} interface. - * - * @see javax.jcr.Session - * @see org.apache.jackrabbit.rmi.remote.RemoteSession - */ -public class ClientSession extends ClientObject implements Session { - - /** - * Logger instance. - */ - private static final Logger log = - LoggerFactory.getLogger(ClientSession.class); - - /** The current repository. */ - private final Repository repository; - - /** - * Flag indicating whether the session is to be considered live of not. - * This flag is initially set to true and reset to - * false by the {@link #logout()} method. The {@link #isLive()} - * method first checks this flag before asking the remote session. - */ - private boolean live = true; - - /** The adapted remote session. */ - protected final RemoteSession remote; - - /** - * The adapted workspace of this session. This field is set on the first - * call to the {@link #getWorkspace()} method assuming, that a workspace - * instance is not changing during the lifetime of a session, that is, - * each call to the server-side Session.getWorkspace() allways - * returns the same object. - */ - private Workspace workspace; - - /** - * Creates a client adapter for the given remote session. - * - * @param repository current repository - * @param remote remote repository - * @param factory local adapter factory - */ - public ClientSession(Repository repository, RemoteSession remote, - LocalAdapterFactory factory) { - super(factory); - this.repository = repository; - this.remote = remote; - } - - /** - * Returns the current repository without contacting the remote session. - * - * {@inheritDoc} - */ - public Repository getRepository() { - return repository; - } - - /** {@inheritDoc} */ - public String getUserID() { - try { - return remote.getUserID(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public Object getAttribute(String name) { - try { - return remote.getAttribute(name); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getAttributeNames() { - try { - return remote.getAttributeNames(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public Workspace getWorkspace() { - if (workspace == null) { - try { - workspace = - getFactory().getWorkspace(this, remote.getWorkspace()); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - return workspace; - } - - /** {@inheritDoc} */ - public Session impersonate(Credentials credentials) - throws RepositoryException { - try { - RemoteSession session = remote.impersonate(credentials); - return getFactory().getSession(repository, session); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Node getRootNode() throws RepositoryException { - try { - return getNode(this, remote.getRootNode()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Node getNodeByIdentifier(String id) throws RepositoryException { - try { - return getNode(this, remote.getNodeByIdentifier(id)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Node getNodeByUUID(String uuid) throws RepositoryException { - try { - return getNode(this, remote.getNodeByUUID(uuid)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Item getItem(String path) throws RepositoryException { - try { - return getItem(this, remote.getItem(path)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Node getNode(String path) throws RepositoryException { - try { - return getNode(this, remote.getNode(path)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Property getProperty(String path) throws RepositoryException { - try { - return (Property) getItem(this, remote.getProperty(path)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean itemExists(String path) throws RepositoryException { - try { - return remote.itemExists(path); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean nodeExists(String path) throws RepositoryException { - try { - return remote.nodeExists(path); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public boolean propertyExists(String path) throws RepositoryException { - try { - return remote.propertyExists(path); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public void removeItem(String path) throws RepositoryException { - try { - remote.removeItem(path); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void move(String from, String to) throws RepositoryException { - try { - remote.move(from, to); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void save() throws RepositoryException { - try { - remote.save(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void refresh(boolean keepChanges) throws RepositoryException { - try { - remote.refresh(keepChanges); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasPendingChanges() throws RepositoryException { - try { - return remote.hasPendingChanges(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** - * Returns the {@link SerialValueFactory#getInstance()}. - * - * {@inheritDoc} - */ - public ValueFactory getValueFactory() { - return SerialValueFactory.getInstance(); - } - - /** {@inheritDoc} */ - public void checkPermission(String path, String actions) - throws AccessControlException, RepositoryException { - if (!hasPermission(path, actions)) { - throw new AccessControlException( - "No permission for " + actions + " on " + path); - } - } - - /** {@inheritDoc} */ - public boolean hasPermission(String path, String actions) - throws RepositoryException { - try { - return remote.hasPermission(path, actions); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public void importXML(String path, InputStream xml, int mode) - throws IOException, RepositoryException { - try { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - byte[] bytes = new byte[4096]; - for (int n = xml.read(bytes); n != -1; n = xml.read(bytes)) { - buffer.write(bytes, 0, n); - } - remote.importXML(path, buffer.toByteArray(), mode); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } finally { - // JCR-2903 - try { xml.close(); } catch (IOException ignore) {} - } - } - - /** {@inheritDoc} */ - public ContentHandler getImportContentHandler( - final String path, final int mode) throws RepositoryException { - getItem(path); // Check that the path exists - try { - final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - ContentHandler handler = - SerializingContentHandler.getSerializer(buffer); - return new DefaultContentHandler(handler) { - public void endDocument() throws SAXException { - super.endDocument(); - try { - remote.importXML(path, buffer.toByteArray(), mode); - } catch (Exception e) { - throw new SAXException("XML import failed", e); - } - } - }; - } catch (SAXException e) { - throw new RepositoryException("XML serialization failed", e); - } - } - - /** {@inheritDoc} */ - public void setNamespacePrefix(String prefix, String uri) - throws RepositoryException { - try { - remote.setNamespacePrefix(prefix, uri); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getNamespacePrefixes() throws RepositoryException { - try { - return remote.getNamespacePrefixes(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getNamespaceURI(String prefix) throws RepositoryException { - try { - return remote.getNamespaceURI(prefix); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getNamespacePrefix(String uri) throws RepositoryException { - try { - return remote.getNamespacePrefix(uri); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void logout() { - - // ignore if we are not alive any more. - if (!isLive()) { - return; - } - - try { - remote.logout(); - } catch (RemoteException ex) { - // JCRRMI-3: Just log a warning, the connection is dead anyway - log.warn("Remote logout failed", ex); - } finally { - // mark "dead" - live = false; - } - } - - /** {@inheritDoc} */ - public void addLockToken(String name) { - try { - remote.addLockToken(name); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getLockTokens() { - try { - return remote.getLockTokens(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public void removeLockToken(String name) { - try { - remote.removeLockToken(name); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** - * Exports the XML system view of the specified repository location - * to the given XML content handler. This method first requests the - * raw XML data from the remote session, and then uses an identity - * transformation to feed the data to the given XML content handler. - * Possible IO and transformer exceptions are thrown as SAXExceptions. - * - * {@inheritDoc} - */ - public void exportSystemView( - String path, ContentHandler handler, - boolean binaryAsLink, boolean noRecurse) - throws SAXException, RepositoryException { - try { - byte[] xml = remote.exportSystemView(path, binaryAsLink, noRecurse); - - Source source = new StreamSource(new ByteArrayInputStream(xml)); - Result result = new SAXResult(handler); - - TransformerFactory factory = TransformerFactory.newInstance(); - Transformer transformer = factory.newTransformer(); - transformer.transform(source, result); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } catch (IOException ex) { - throw new SAXException(ex); - } catch (TransformerConfigurationException ex) { - throw new SAXException(ex); - } catch (TransformerException ex) { - throw new SAXException(ex); - } - } - - /** - * Exports the XML system view of the specified repository location - * to the given output stream. This method first requests the - * raw XML data from the remote session, and then writes the data to - * the output stream. - * - * {@inheritDoc} - */ - public void exportSystemView( - String path, OutputStream output, - boolean binaryAsLink, boolean noRecurse) - throws IOException, RepositoryException { - try { - byte[] xml = remote.exportSystemView(path, binaryAsLink, noRecurse); - output.write(xml); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** - * Exports the XML document view of the specified repository location - * to the given XML content handler. This method first requests the - * raw XML data from the remote session, and then uses an identity - * transformation to feed the data to the given XML content handler. - * Possible IO and transformer exceptions are thrown as SAXExceptions. - * - * {@inheritDoc} - */ - public void exportDocumentView( - String path, ContentHandler handler, - boolean binaryAsLink, boolean noRecurse) - throws SAXException, RepositoryException { - try { - byte[] xml = remote.exportDocumentView(path, binaryAsLink, noRecurse); - - Source source = new StreamSource(new ByteArrayInputStream(xml)); - Result result = new SAXResult(handler); - - TransformerFactory factory = TransformerFactory.newInstance(); - Transformer transformer = factory.newTransformer(); - transformer.transform(source, result); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } catch (IOException ex) { - throw new SAXException(ex); - } catch (TransformerConfigurationException ex) { - throw new SAXException(ex); - } catch (TransformerException ex) { - throw new SAXException(ex); - } - } - - /** - * Exports the XML document view of the specified repository location - * to the given output stream. This method first requests the - * raw XML data from the remote session, and then writes the data to - * the output stream. - * - * {@inheritDoc} - */ - public void exportDocumentView( - String path, OutputStream output, - boolean binaryAsLink, boolean noRecurse) - throws IOException, RepositoryException { - try { - byte[] xml = remote.exportDocumentView(path, binaryAsLink, noRecurse); - output.write(xml); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** - * {@inheritDoc} - */ - public boolean isLive() { - try { - return live && remote.isLive(); - } catch (RemoteException e) { - log.warn("Failed to test remote session state", e); - return false; - } - } - - public AccessControlManager getAccessControlManager() - throws UnsupportedRepositoryOperationException, RepositoryException { - try { - return getFactory().getAccessControlManager( - remote.getAccessControlManager()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public RetentionManager getRetentionManager() - throws RepositoryException { - throw new UnsupportedRepositoryOperationException("TODO: JCR-3206"); - } - - public boolean hasCapability( - String methodName, Object target, Object[] arguments) - throws RepositoryException { - throw new UnsupportedRepositoryOperationException("TODO: JCR-3206"); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientVersion.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientVersion.java deleted file mode 100644 index edce561b40b..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientVersion.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; -import java.util.Calendar; - -import javax.jcr.Node; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.version.Version; -import javax.jcr.version.VersionHistory; - -import org.apache.jackrabbit.rmi.remote.RemoteVersion; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteVersion RemoteVersion} - * interface. This class makes a remote version locally available using - * the JCR {@link javax.jcr.version.Version Version} interface. - * - * @see javax.jcr.version.Version - * @see org.apache.jackrabbit.rmi.remote.RemoteVersion - */ -public class ClientVersion extends ClientNode implements Version { - - /** The adapted remote version. */ - private RemoteVersion remote; - - /** - * Creates a local adapter for the given remote version. - * - * @param session current session - * @param remote remote version - * @param factory local adapter factory - */ - public ClientVersion(Session session, RemoteVersion remote, - LocalAdapterFactory factory) { - super(session, remote, factory); - this.remote = remote; - } - - /** - * Utility method for creating a version array for an array - * of remote versions. The versions in the returned array - * are created using the local adapter factory. - *

- * A null input is treated as an empty array. - * - * @param remotes remote versions - * @return local version array - */ - private Version[] getVersionArray(RemoteVersion[] remotes) { - if (remotes != null) { - Version[] versions = new Version[remotes.length]; - for (int i = 0; i < remotes.length; i++) { - versions[i] = getFactory().getVersion(getSession(), remotes[i]); - } - return versions; - } else { - return new Version[0]; // for safety - } - } - - - /** {@inheritDoc} */ - public Calendar getCreated() throws RepositoryException { - try { - return remote.getCreated(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Version[] getSuccessors() throws RepositoryException { - try { - return getVersionArray(remote.getSuccessors()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Version[] getPredecessors() throws RepositoryException { - try { - return getVersionArray(remote.getPredecessors()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public VersionHistory getContainingHistory() throws RepositoryException { - try { - return getFactory().getVersionHistory(getSession(), remote.getContainingHistory()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Node getFrozenNode() throws RepositoryException { - try { - return getFactory().getNode(getSession(), remote.getFrozenNode()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Version getLinearPredecessor() throws RepositoryException { - try { - RemoteVersion linearPredecessor = remote.getLinearPredecessor(); - if (linearPredecessor == null) { - return null; - } else { - return getFactory().getVersion(getSession(), linearPredecessor); - } - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Version getLinearSuccessor() throws RepositoryException { - try { - RemoteVersion linearSuccessor = remote.getLinearSuccessor(); - if (linearSuccessor == null) { - return null; - } else { - return getFactory().getVersion(getSession(), linearSuccessor); - } - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientVersionHistory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientVersionHistory.java deleted file mode 100644 index 5d855cf5b9d..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientVersionHistory.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.NodeIterator; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.UnsupportedRepositoryOperationException; -import javax.jcr.version.Version; -import javax.jcr.version.VersionException; -import javax.jcr.version.VersionHistory; -import javax.jcr.version.VersionIterator; - -import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteVersionHistory RemoteVersionHistory} - * interface. This class makes a remote version history locally available using - * the JCR {@link javax.jcr.version.VersionHistory VersionHistory} interface. - * - * @see javax.jcr.version.VersionHistory - * @see org.apache.jackrabbit.rmi.remote.RemoteVersionHistory - */ -public class ClientVersionHistory extends ClientNode implements VersionHistory { - - /** The adapted remote version history. */ - private RemoteVersionHistory remote; - - /** - * Creates a local adapter for the given remote version history. - * - * @param session current session - * @param remote remote version history - * @param factory local adapter factory - */ - public ClientVersionHistory(Session session, RemoteVersionHistory remote, - LocalAdapterFactory factory) { - super(session, remote, factory); - this.remote = remote; - } - - /** {@inheritDoc} */ - public Version getRootVersion() throws RepositoryException { - try { - return getFactory().getVersion(getSession(), remote.getRootVersion()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public VersionIterator getAllVersions() throws RepositoryException { - try { - return getFactory().getVersionIterator( - getSession(), remote.getAllVersions()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Version getVersion(String versionName) throws VersionException, - RepositoryException { - try { - return getFactory().getVersion(getSession(), remote.getVersion(versionName)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Version getVersionByLabel(String label) throws RepositoryException { - try { - return getFactory().getVersion(getSession(), remote.getVersionByLabel(label)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void addVersionLabel(String versionName, String label, - boolean moveLabel) throws VersionException, RepositoryException { - try { - remote.addVersionLabel(versionName, label, moveLabel); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeVersionLabel(String label) - throws VersionException, RepositoryException { - try { - remote.removeVersionLabel(label); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasVersionLabel(String label) throws RepositoryException { - try { - return remote.hasVersionLabel(label); - } catch (RemoteException ex) { - // grok the exception and assume label is missing - return false; - } - } - - /** {@inheritDoc} */ - public boolean hasVersionLabel(Version version, String label) - throws VersionException, RepositoryException { - try { - String versionIdentifier = version.getIdentifier(); - return remote.hasVersionLabel(versionIdentifier, label); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getVersionLabels() throws RepositoryException { - try { - return remote.getVersionLabels(); - } catch (RemoteException ex) { - // grok the exception and return an empty array - return new String[0]; - } - } - - /** {@inheritDoc} */ - public String[] getVersionLabels(Version version) - throws VersionException, RepositoryException { - try { - String versionIdentifier = version.getIdentifier(); - return remote.getVersionLabels(versionIdentifier); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeVersion(String versionName) - throws UnsupportedRepositoryOperationException, VersionException, - RepositoryException { - try { - remote.removeVersion(versionName); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} - * @deprecated As of JCR 2.0, {@link #getVersionableIdentifier} should be - * used instead. - */ - public String getVersionableUUID() throws RepositoryException { - try { - return remote.getVersionableUUID(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeIterator getAllFrozenNodes() throws RepositoryException { - try { - return getFactory().getNodeIterator(getSession(), remote.getAllFrozenNodes()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeIterator getAllLinearFrozenNodes() throws RepositoryException { - try { - return getFactory().getNodeIterator(getSession(), remote.getAllLinearFrozenNodes()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public VersionIterator getAllLinearVersions() throws RepositoryException { - try { - return getFactory().getVersionIterator(getSession(), remote.getAllLinearVersions()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getVersionableIdentifier() throws RepositoryException { - try { - return remote.getVersionableIdentifier(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientVersionManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientVersionManager.java deleted file mode 100644 index 07f9dedbdf3..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientVersionManager.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.Node; -import javax.jcr.NodeIterator; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.version.Version; -import javax.jcr.version.VersionHistory; -import javax.jcr.version.VersionManager; - -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteVersionManager; - -public class ClientVersionManager extends ClientObject - implements VersionManager { - - /** The current session. */ - private Session session; - - private RemoteVersionManager remote; - - public ClientVersionManager( - Session session, RemoteVersionManager remote, - LocalAdapterFactory factory) { - super(factory); - this.session = session; - this.remote = remote; - } - - /** {@inheritDoc} */ - public void cancelMerge(String absPath, Version version) - throws RepositoryException { - try { - remote.cancelMerge(absPath, version.getIdentifier()); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public Version checkin(String absPath) throws RepositoryException { - try { - return getFactory().getVersion(session, remote.checkin(absPath)); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public void checkout(String absPath) throws RepositoryException { - try { - remote.checkout(absPath); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public Version checkpoint(String absPath) throws RepositoryException { - try { - return getFactory().getVersion(session, remote.checkpoint(absPath)); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public Node createActivity(String title) - throws RepositoryException { - try { - return getFactory().getNode(session, remote.createActivity(title)); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public Node createConfiguration(String absPath) - throws RepositoryException { - try { - return getFactory().getNode( - session, remote.createConfiguration(absPath)); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public void doneMerge(String absPath, Version version) - throws RepositoryException { - try { - remote.doneMerge(absPath, version.getIdentifier()); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public Node getActivity() throws RepositoryException { - try { - RemoteNode activity = remote.getActivity(); - if (activity == null) { - return null; - } else { - return getFactory().getNode(session, activity); - } - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public Version getBaseVersion(String absPath) throws RepositoryException { - try { - return getFactory().getVersion( - session, remote.getBaseVersion(absPath)); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public VersionHistory getVersionHistory(String absPath) - throws RepositoryException { - try { - return getFactory().getVersionHistory( - session, remote.getVersionHistory(absPath)); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public boolean isCheckedOut(String absPath) throws RepositoryException { - try { - return remote.isCheckedOut(absPath); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public NodeIterator merge(Node activityNode) throws RepositoryException { - try { - RemoteIterator iterator = remote.merge(activityNode.getIdentifier()); - return getFactory().getNodeIterator(session, iterator); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public NodeIterator merge( - String absPath, String srcWorkspace, boolean bestEffort) - throws RepositoryException { - try { - return getFactory().getNodeIterator( - session, remote.merge(absPath, srcWorkspace, bestEffort)); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public NodeIterator merge( - String absPath, String srcWorkspace, boolean bestEffort, - boolean isShallow) throws RepositoryException { - try { - return getFactory().getNodeIterator(session, remote.merge( - absPath, srcWorkspace, bestEffort, isShallow)); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public void removeActivity(Node activityNode) throws RepositoryException { - try { - remote.removeActivity(activityNode.getIdentifier()); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public void restore(Version[] versions, boolean removeExisting) - throws RepositoryException { - try { - String[] versionIdentifiers = new String[versions.length]; - for (int i = 0; i < versions.length; i++) { - versionIdentifiers[i] = versions[i].getIdentifier(); - } - remote.restore(versionIdentifiers, removeExisting); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public void restore(Version version, boolean removeExisting) - throws RepositoryException { - try { - remote.restore(version.getIdentifier(), removeExisting); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public void restore( - String absPath, String versionName, boolean removeExisting) - throws RepositoryException { - try { - remote.restore(absPath, versionName, removeExisting); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public void restore(String absPath, Version version, boolean removeExisting) - throws RepositoryException { - try { - remote.restoreVI(absPath, version.getIdentifier(), removeExisting); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public void restoreByLabel( - String absPath, String versionLabel, boolean removeExisting) - throws RepositoryException { - try { - remote.restoreByLabel(absPath, versionLabel, removeExisting); - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - - /** {@inheritDoc} */ - public Node setActivity(Node activity) throws RepositoryException { - try { - RemoteNode remoteActivity; - if (activity == null) { - remoteActivity = remote.setActivity(null); - } else { - remoteActivity = remote.setActivity(activity.getIdentifier()); - } - if (remoteActivity == null) { - return null; - } else { - return getFactory().getNode(session, remoteActivity); - } - } catch (RemoteException e) { - throw new RemoteRepositoryException(e); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java deleted file mode 100644 index 89f83f41f72..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.rmi.RemoteException; - -import javax.jcr.NamespaceRegistry; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.Workspace; -import javax.jcr.lock.LockManager; -import javax.jcr.nodetype.NodeTypeManager; -import javax.jcr.observation.ObservationManager; -import javax.jcr.query.QueryManager; -import javax.jcr.version.Version; -import javax.jcr.version.VersionManager; - -import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry; -import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager; -import org.apache.jackrabbit.rmi.remote.RemoteQueryManager; -import org.apache.jackrabbit.rmi.remote.RemoteWorkspace; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; - -/** - * Local adapter for the JCR-RMI {@link RemoteWorkspace RemoteWorkspace} - * interface. This class makes a remote workspace locally available using - * the JCR {@link Workspace Workspace} interface. - * - * @see javax.jcr.Workspace - * @see org.apache.jackrabbit.rmi.remote.RemoteWorkspace - */ -public class ClientWorkspace extends ClientObject implements Workspace { - - /** The current session. */ - private Session session; - - /** The adapted remote workspace. */ - private RemoteWorkspace remote; - - /** - * The adapted observation manager of this workspace. This field is set on - * the first call to the {@link #getObservationManager()()} method assuming, - * that the observation manager instance is not changing during the lifetime - * of a workspace instance, that is, each call to the server-side - * Workspace.getObservationManager() allways returns the same - * object. - */ - private ObservationManager observationManager; - - private LockManager lockManager; - - private VersionManager versionManager; - - /** - * Creates a client adapter for the given remote workspace. - * - * @param session current session - * @param remote remote workspace - * @param factory local adapter factory - */ - public ClientWorkspace( - Session session, RemoteWorkspace remote, - LocalAdapterFactory factory) { - super(factory); - this.session = session; - this.remote = remote; - } - - /** - * Returns the current session without contacting the remote workspace. - * - * {@inheritDoc} - */ - public Session getSession() { - return session; - } - - /** {@inheritDoc} */ - public String getName() { - try { - return remote.getName(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public void copy(String from, String to) throws RepositoryException { - try { - remote.copy(from, to); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void copy(String workspace, String from, String to) - throws RepositoryException { - try { - remote.copy(workspace, from, to); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void move(String from, String to) throws RepositoryException { - try { - remote.move(from, to); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public QueryManager getQueryManager() throws RepositoryException { - try { - RemoteQueryManager manager = remote.getQueryManager(); - return getFactory().getQueryManager(session, manager); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NamespaceRegistry getNamespaceRegistry() throws RepositoryException { - try { - RemoteNamespaceRegistry registry = remote.getNamespaceRegistry(); - return getFactory().getNamespaceRegistry(registry); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public NodeTypeManager getNodeTypeManager() throws RepositoryException { - try { - RemoteNodeTypeManager manager = remote.getNodeTypeManager(); - return getFactory().getNodeTypeManager(manager); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public ObservationManager getObservationManager() - throws RepositoryException { - if (observationManager == null) { - try { - observationManager = - getFactory(). - getObservationManager(this, remote.getObservationManager()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - return observationManager; - } - - /** {@inheritDoc} */ - public void clone( - String workspace, String src, String dst, boolean removeExisting) - throws RepositoryException { - try { - remote.clone(workspace, src, dst, removeExisting); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getAccessibleWorkspaceNames() throws RepositoryException { - try { - return remote.getAccessibleWorkspaceNames(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public ContentHandler getImportContentHandler( - final String path, final int mode) throws RepositoryException { - getSession().getItem(path); // Check that the path exists - try { - final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - return new DefaultContentHandler( - SerializingContentHandler.getSerializer(buffer)) { - public void endDocument() throws SAXException { - super.endDocument(); - try { - remote.importXML(path, buffer.toByteArray(), mode); - } catch (Exception e) { - throw new SAXException("XML import failed", e); - } - } - }; - } catch (SAXException e) { - throw new RepositoryException("XML serialization failed", e); - } - } - - /** {@inheritDoc} */ - public void importXML(String path, InputStream xml, int uuidBehaviour) - throws IOException, RepositoryException { - try { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - byte[] bytes = new byte[4096]; - for (int n = xml.read(bytes); n != -1; n = xml.read(bytes)) { - buffer.write(bytes, 0, n); - } - remote.importXML(path, buffer.toByteArray(), uuidBehaviour); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } finally { - // JCR-2903 - try { xml.close(); } catch (IOException ignore) {} - } - } - - /** {@inheritDoc} */ - public void restore(Version[] versions, boolean removeExisting) - throws RepositoryException { - getVersionManager().restore(versions, removeExisting); - } - - public void createWorkspace(String name) throws RepositoryException { - try { - remote.createWorkspace(name, null); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public void createWorkspace(String name, String srcWorkspace) - throws RepositoryException { - try { - remote.createWorkspace(name, srcWorkspace); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - public void deleteWorkspace(String name) throws RepositoryException { - try { - remote.deleteWorkspace(name); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public LockManager getLockManager() throws RepositoryException { - if (lockManager == null) { - try { - lockManager = getFactory().getLockManager( - session, remote.getLockManager()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - return lockManager; - } - - public VersionManager getVersionManager() throws RepositoryException { - if (versionManager == null) { - try { - versionManager = getFactory().getVersionManager( - session, remote.getVersionManager()); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - return versionManager; - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientXASession.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientXASession.java deleted file mode 100644 index 63a3bedb2b1..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientXASession.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.transaction.xa.XAException; -import javax.transaction.xa.XAResource; -import javax.transaction.xa.Xid; - -import javax.jcr.Repository; - -import org.apache.jackrabbit.rmi.remote.RemoteXASession; -import org.apache.jackrabbit.rmi.remote.SerializableXid; - -/** - * Local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteXASession RemoteXASession} - * interface. - * - * @since 1.4 - */ -public class ClientXASession extends ClientSession implements XAResource { - - /** - * The adapted remote transaction enabled session. - */ - private RemoteXASession remote; - - /** - * Creates a client adapter for the given remote session which is - * transaction enabled. - */ - public ClientXASession( - Repository repository, RemoteXASession remote, - LocalAdapterFactory factory) { - super(repository, remote, factory); - this.remote = remote; - } - - /** - * Returns true if the given object is a local - * adapter that refers to the same remote XA resource. - * - * @see http://blogs.sun.com/fkieviet/entry/j2ee_jca_resource_adapters_the - */ - public boolean isSameRM(XAResource xares) throws XAException { - return xares instanceof ClientXASession - && remote == ((ClientXASession) xares).remote; - } - - private XAException getXAException(RemoteException e) { - XAException exception = new XAException("Remote operation failed"); - exception.initCause(e); - return exception; - } - - public void commit(Xid xid, boolean onePhase) throws XAException { - try { - remote.commit(new SerializableXid(xid), onePhase); - } catch (RemoteException e) { - throw getXAException(e); - } - } - - public void end(Xid xid, int flags) throws XAException { - try { - remote.end(new SerializableXid(xid), flags); - } catch (RemoteException e) { - throw getXAException(e); - } - } - - public void forget(Xid xid) throws XAException { - try { - remote.forget(new SerializableXid(xid)); - } catch (RemoteException e) { - throw getXAException(e); - } - } - - public int getTransactionTimeout() throws XAException { - try { - return remote.getTransactionTimeout(); - } catch (RemoteException e) { - throw getXAException(e); - } - } - - public int prepare(Xid xid) throws XAException { - try { - return remote.prepare(new SerializableXid(xid)); - } catch (RemoteException e) { - throw getXAException(e); - } - } - - public Xid[] recover(int flag) throws XAException { - try { - return remote.recover(flag); - } catch (RemoteException e) { - throw getXAException(e); - } - } - - public void rollback(Xid xid) throws XAException { - try { - remote.rollback(new SerializableXid(xid)); - } catch (RemoteException e) { - throw getXAException(e); - } - } - - public boolean setTransactionTimeout(int seconds) throws XAException { - try { - return remote.setTransactionTimeout(seconds); - } catch (RemoteException e) { - throw getXAException(e); - } - } - - public void start(Xid xid, int flags) throws XAException { - try { - remote.start(new SerializableXid(xid), flags); - } catch (RemoteException e) { - throw getXAException(e); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/DefaultContentHandler.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/DefaultContentHandler.java deleted file mode 100644 index d6f3947b215..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/DefaultContentHandler.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Adapter class for exposing a {@link ContentHandler} instance as - * {@link DefaultHandler} object. - */ -class DefaultContentHandler extends DefaultHandler { - - /** - * The adapted content handler instance. - */ - private final ContentHandler handler; - - /** - * Creates a {@link DefaultHandler} adapter for the given content - * handler. - * - * @param handler content handler - */ - public DefaultContentHandler(ContentHandler handler) { - this.handler = handler; - } - - //------------------------------------------------------< ContentHandler > - - /** - * Delegated to {@link #handler}. - * - * @param ch passed through - * @param start passed through - * @param length passed through - * @throws SAXException if an error occurs - */ - public void characters(char[] ch, int start, int length) - throws SAXException { - handler.characters(ch, start, length); - } - - /** - * Delegated to {@link #handler}. - * - * @throws SAXException if an error occurs - */ - public void endDocument() throws SAXException { - handler.endDocument(); - } - - /** - * Delegated to {@link #handler}. - * - * @param namespaceURI passed through - * @param localName passed through - * @param qName passed through - * @throws SAXException if an error occurs - */ - public void endElement( - String namespaceURI, String localName, String qName) - throws SAXException { - handler.endElement(namespaceURI, localName, qName); - } - - /** - * Delegated to {@link #handler}. - * - * @param prefix passed through - * @throws SAXException if an error occurs - */ - public void endPrefixMapping(String prefix) throws SAXException { - handler.endPrefixMapping(prefix); - } - - /** - * Delegated to {@link #handler}. - * - * @param ch passed through - * @param start passed through - * @param length passed through - * @throws SAXException if an error occurs - */ - public void ignorableWhitespace(char[] ch, int start, int length) - throws SAXException { - handler.ignorableWhitespace(ch, start, length); - } - - /** - * Delegated to {@link #handler}. - * - * @param target passed through - * @param data passed through - * @throws SAXException if an error occurs - */ - public void processingInstruction(String target, String data) - throws SAXException { - handler.processingInstruction(target, data); - } - - /** - * Delegated to {@link #handler}. - * - * @param locator passed through - */ - public void setDocumentLocator(Locator locator) { - handler.setDocumentLocator(locator); - } - - /** - * Delegated to {@link #handler}. - * - * @param name passed through - * @throws SAXException if an error occurs - */ - public void skippedEntity(String name) throws SAXException { - handler.skippedEntity(name); - } - - /** - * Delegated to {@link #handler}. - * - * @throws SAXException if an error occurs - */ - public void startDocument() throws SAXException { - handler.startDocument(); - } - - /** - * Delegated to {@link #handler}. - * - * @param namespaceURI passed through - * @param localName passed through - * @param qName passed through - * @param atts passed through - * @throws SAXException if an error occurs - */ - public void startElement( - String namespaceURI, String localName, String qName, - Attributes atts) throws SAXException { - handler.startElement(namespaceURI, localName, qName, atts); - } - - /** - * Delegated to {@link #handler}. - * - * @param prefix passed through - * @param uri passed through - * @throws SAXException if an error occurs - */ - public void startPrefixMapping(String prefix, String uri) - throws SAXException { - handler.startPrefixMapping(prefix, uri); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java deleted file mode 100644 index a2f55edbb3d..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java +++ /dev/null @@ -1,445 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.security.Principal; -import java.util.Iterator; - -import javax.jcr.Item; -import javax.jcr.NamespaceRegistry; -import javax.jcr.Node; -import javax.jcr.NodeIterator; -import javax.jcr.Property; -import javax.jcr.PropertyIterator; -import javax.jcr.Repository; -import javax.jcr.Session; -import javax.jcr.Workspace; -import javax.jcr.lock.Lock; -import javax.jcr.lock.LockManager; -import javax.jcr.nodetype.ItemDefinition; -import javax.jcr.nodetype.NodeDefinition; -import javax.jcr.nodetype.NodeType; -import javax.jcr.nodetype.NodeTypeIterator; -import javax.jcr.nodetype.NodeTypeManager; -import javax.jcr.nodetype.PropertyDefinition; -import javax.jcr.observation.ObservationManager; -import javax.jcr.query.Query; -import javax.jcr.query.QueryManager; -import javax.jcr.query.QueryResult; -import javax.jcr.query.Row; -import javax.jcr.query.RowIterator; -import javax.jcr.security.AccessControlEntry; -import javax.jcr.security.AccessControlManager; -import javax.jcr.security.AccessControlPolicy; -import javax.jcr.security.AccessControlPolicyIterator; -import javax.jcr.security.Privilege; -import javax.jcr.version.Version; -import javax.jcr.version.VersionHistory; -import javax.jcr.version.VersionIterator; -import javax.jcr.version.VersionManager; - -import org.apache.jackrabbit.rmi.remote.RemoteItem; -import org.apache.jackrabbit.rmi.remote.RemoteItemDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteLock; -import org.apache.jackrabbit.rmi.remote.RemoteLockManager; -import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry; -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; -import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager; -import org.apache.jackrabbit.rmi.remote.RemoteObservationManager; -import org.apache.jackrabbit.rmi.remote.RemoteProperty; -import org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteQuery; -import org.apache.jackrabbit.rmi.remote.RemoteQueryManager; -import org.apache.jackrabbit.rmi.remote.RemoteQueryResult; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.remote.RemoteRow; -import org.apache.jackrabbit.rmi.remote.RemoteSession; -import org.apache.jackrabbit.rmi.remote.RemoteVersion; -import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory; -import org.apache.jackrabbit.rmi.remote.RemoteVersionManager; -import org.apache.jackrabbit.rmi.remote.RemoteWorkspace; -import org.apache.jackrabbit.rmi.remote.principal.RemoteGroup; -import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy; -import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege; - -/** - * Factory interface for creating local adapters for remote references. - * This interface defines how remote JCR-RMI references are adapted - * back to the normal JCR interfaces. The adaption mechanism can be - * modified (for example to add extra features) by changing the - * local adapter factory used by the repository client. - *

- * Note that the - * {@link org.apache.jackrabbit.rmi.client.ClientObject ClientObject} - * base class provides a number of utility methods designed to work with - * a local adapter factory. Adapter implementations may want to inherit - * that functionality by subclassing from ClientObject. - * - * @see org.apache.jackrabbit.rmi.server.RemoteAdapterFactory - * @see org.apache.jackrabbit.rmi.client.ClientAdapterFactory - * @see org.apache.jackrabbit.rmi.client.ClientObject - */ -public interface LocalAdapterFactory { - - /** - * Factory method for creating a local adapter for a remote repository. - * - * @param remote remote repository - * @return local repository adapter - */ - Repository getRepository(RemoteRepository remote); - - /** - * Factory method for creating a local adapter for a remote session. - * - * @param repository current repository - * @param remote remote session - * @return local session adapter - */ - Session getSession(Repository repository, RemoteSession remote); - - /** - * Factory method for creating a local adapter for a remote workspace. - * - * @param session current session - * @param remote remote workspace - * @return local workspace adapter - */ - Workspace getWorkspace(Session session, RemoteWorkspace remote); - - /** - * Factory method for creating a local adapter for a remote observation - * manager. - * - * @param workspace current workspace - * @param remote remote observation manager - * @return local observation manager adapter - */ - ObservationManager getObservationManager(Workspace workspace, - RemoteObservationManager remote); - - /** - * Factory method for creating a local adapter for a remote namespace - * registry. - * - * @param remote remote namespace registry - * @return local namespace registry adapter - */ - NamespaceRegistry getNamespaceRegistry(RemoteNamespaceRegistry remote); - - /** - * Factory method for creating a local adapter for a remote node type - * manager. - * - * @param remote remote node type manager - * @return local node type manager adapter - */ - NodeTypeManager getNodeTypeManager(RemoteNodeTypeManager remote); - - /** - * Factory method for creating a local adapter for a remote item. - * Note that before calling this method, the client may want to - * introspect the remote item reference to determine whether to use the - * {@link #getNode(Session, RemoteNode) getNode} or - * {@link #getProperty(Session, RemoteProperty) getProperty} method - * instead, as the adapter returned by this method will only cover - * the basic {@link Item Item} interface. - * - * @param session current session - * @param remote remote item - * @return local item adapter - */ - Item getItem(Session session, RemoteItem remote); - - /** - * Factory method for creating a local adapter for a remote property. - * - * @param session current session - * @param remote remote property - * @return local property adapter - */ - Property getProperty(Session session, RemoteProperty remote); - - /** - * Factory method for creating a local adapter for a remote node. - * - * @param session current session - * @param remote remote node - * @return local node adapter - */ - Node getNode(Session session, RemoteNode remote); - - /** - * Factory method for creating a local adapter for a remote version. - * - * @param session current session - * @param remote remote version - * @return local version adapter - */ - Version getVersion(Session session, RemoteVersion remote); - - /** - * Factory method for creating a local adapter for a remote version history. - * - * @param session current session - * @param remote remote version history - * @return local version history adapter - */ - VersionHistory getVersionHistory(Session session, RemoteVersionHistory remote); - - /** - * Factory method for creating a local adapter for a remote node type. - * - * @param remote remote node type - * @return local node type adapter - */ - NodeType getNodeType(RemoteNodeType remote); - - /** - * Factory method for creating a local adapter for a remote item - * definition. Note that before calling this method, the client may want to - * introspect the remote item definition to determine whether to use the - * {@link #getNodeDef(RemoteNodeDefinition) getNodeDef} or - * {@link #getPropertyDef(RemotePropertyDefinition) getPropertyDef} method - * instead, as the adapter returned by this method will only cover - * the {@link ItemDefinition ItemDef} base interface. - * - * @param remote remote item definition - * @return local item definition adapter - */ - ItemDefinition getItemDef(RemoteItemDefinition remote); - - /** - * Factory method for creating a local adapter for a remote node - * definition. - * - * @param remote remote node definition - * @return local node definition adapter - */ - NodeDefinition getNodeDef(RemoteNodeDefinition remote); - - /** - * Factory method for creating a local adapter for a remote property - * definition. - * - * @param remote remote property definition - * @return local property definition adapter - */ - PropertyDefinition getPropertyDef(RemotePropertyDefinition remote); - - /** - * Factory method for creating a local adapter for a remote lock. - * - * @param session current session - * @param remote remote lock - * @return local lock adapter - */ - Lock getLock(Session session, RemoteLock remote); - - /** - * Factory method for creating a local adapter for a remote query manager. - * - * @param session current session - * @param remote remote query manager - * @return local query manager adapter - */ - QueryManager getQueryManager(Session session, RemoteQueryManager remote); - - /** - * Factory method for creating a local adapter for a remote query. - * - * @param session current session - * @param remote remote query - * @return local query adapter - */ - Query getQuery(Session session, RemoteQuery remote); - - /** - * Factory method for creating a local adapter for a remote query result. - * - * @param session current session - * @param remote remote query result - * @return local query result adapter - */ - QueryResult getQueryResult(Session session, RemoteQueryResult remote); - - /** - * Factory method for creating a local adapter for a remote query row. - * - * @param session current session - * @param remote remote query row - * @return local query row adapter - */ - Row getRow(Session session, RemoteRow remote); - - /** - * Factory method for creating a local adapter for a remote node iterator. - * - * @param session current session - * @param remote remote node iterator - * @return local node iterator adapter - */ - NodeIterator getNodeIterator(Session session, RemoteIterator remote); - - /** - * Factory method for creating a local adapter for a remote property iterator. - * - * @param session current session - * @param remote remote property iterator - * @return local property iterator adapter - */ - PropertyIterator getPropertyIterator(Session session, RemoteIterator remote); - - /** - * Factory method for creating a local adapter for a remote version iterator. - * - * @param session current session - * @param remote remote version iterator - * @return local version iterator adapter - */ - VersionIterator getVersionIterator(Session session, RemoteIterator remote); - - /** - * Factory method for creating a local adapter for a remote - * node type iterator. - * - * @param remote remote node type iterator - * @return local node type iterator adapter - */ - NodeTypeIterator getNodeTypeIterator(RemoteIterator remote); - - /** - * Factory method for creating a local adapter for a remote row iterator. - * - * @param session current session - * @param remote remote row iterator - * @return local row iterator adapter - */ - RowIterator getRowIterator(Session session, RemoteIterator remote); - - LockManager getLockManager(Session session, RemoteLockManager lockManager); - - VersionManager getVersionManager( - Session session, RemoteVersionManager versionManager); - - /** - * Factory method for creating a local adapter for a remote access control - * manager - * - * @param remote remote access control manager - * @return local access control manager - */ - AccessControlManager getAccessControlManager( - RemoteAccessControlManager remote); - - /** - * Factory method for creating a local adapter for a remote access control - * policy - * - * @param remote remote access control policy - * @return local access control policy - */ - AccessControlPolicy getAccessControlPolicy(RemoteAccessControlPolicy remote); - - /** - * Factory method for creating an array of local adapter for an array of - * remote access control policies - * - * @param remote array of remote access control policies - * @return array of local access control policies - */ - AccessControlPolicy[] getAccessControlPolicy( - RemoteAccessControlPolicy[] remote); - - /** - * Factory method for creating a local adapter for a remote access control - * policy iterator - * - * @param remote access control policy iterator - * @return local access control policy iterator - */ - AccessControlPolicyIterator getAccessControlPolicyIterator( - RemoteIterator remote); - - /** - * Factory method for creating a local adapter for a remote access control - * entry - * - * @param remote remote access control entry - * @return local access control entry - */ - AccessControlEntry getAccessControlEntry(RemoteAccessControlEntry remote); - - /** - * Factory method for creating an array of local adapter for an array of - * remote access control entry - * - * @param remote array of remote access control entry - * @return local array of access control entry - */ - AccessControlEntry[] getAccessControlEntry(RemoteAccessControlEntry[] remote); - - /** - * Factory method for creating a local adapter for a remote principal. - *

- * If remote is a {@link RemoteGroup} the - * principal returned implements the org.apache.jackrabbit.api.security.principal.GroupPrincipal - * interface. - * - * @param remote principal - * @return local principal - */ - Principal getPrincipal(RemotePrincipal remote); - - /** - * Factory method for creating a local adapter for a remote principal - * iterator. - *

- * Each entry in the remote iterator which is a - * {@link RemoteGroup} will be - * provided as a principal implementing the - * org.apache.jackrabbit.api.security.principal.GroupPrincipal interface. - * - * @param remote remote principal iterator - * @return local principal iterator - */ - Iterator getPrincipalIterator(RemoteIterator remote); - - /** - * Factory method for creating a local adapter for a remote privilege - * - * @param remote remote privilege - * @return local privilege - */ - Privilege getPrivilege(RemotePrivilege remote); - - /** - * Factory method for creating an array of local adapter for an array of - * remote privilege - * - * @param remote array of remote privilege - * @return array of local privilege - */ - Privilege[] getPrivilege(RemotePrivilege[] remote); - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/RemoteRepositoryException.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/RemoteRepositoryException.java deleted file mode 100644 index ab5919a8fea..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/RemoteRepositoryException.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -/** - * JCR-RMI remote exception. Used by the JCR-RMI client to wrap RMI errors - * into RepositoryExceptions to avoid breaking the JCR interfaces. - *

- * Note that if a RemoteException is received by call with no declared - * exceptions, then the RemoteException is wrapped into a - * RemoteRuntimeException. - */ -public class RemoteRepositoryException extends RepositoryException { - - /** - * Creates a RemoteRepositoryException based on the given RemoteException. - * - * @param ex the remote exception - */ - public RemoteRepositoryException(RemoteException ex) { - super(ex); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/RemoteRuntimeException.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/RemoteRuntimeException.java deleted file mode 100644 index 72ad8080f50..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/RemoteRuntimeException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -/** - * JCR-RMI remote runtime exception. Used by the JCR-RMI client to wrap - * RMI errors into RuntimeExceptions to avoid breaking the JCR interfaces. - *

- * Note that if a RemoteException is received by call that declares to - * throw RepositoryExceptions, then the RemoteException is wrapped into - * a RemoteRepositoryException. - */ -public class RemoteRuntimeException extends RuntimeException { - - /** - * Creates a RemoteRuntimeException based on the given RemoteException. - * - * @param ex the remote exception - */ - public RemoteRuntimeException(RemoteException ex) { - super(ex); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/SafeClientRepository.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/SafeClientRepository.java deleted file mode 100644 index 4b6acafb0b4..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/SafeClientRepository.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.rmi.RemoteException; - -import javax.jcr.Credentials; -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.Value; - -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.remote.RemoteSession; - -/** - * A "safe" local adapter for the JCR-RMI - * {@link org.apache.jackrabbit.rmi.remote.RemoteRepository RemoteRepository} - * interface. This class uses an abstract factory method for loading - * (and reloading) the remote repository instance that is made locally - * available through the JCR {@link Repository} interface. If the remote - * reference breaks (a RemoteException is thrown by a remote call), then - * this adapter attempts to reload the remote reference once before failing. - * - * @see javax.jcr.Repository - * @see org.apache.jackrabbit.rmi.remote.RemoteRepository - */ -public abstract class SafeClientRepository extends ClientObject - implements Repository { - - /** The adapted remote repository. */ - private RemoteRepository remote; - - /** - * Creates a client adapter for the given remote repository. - * - * @param factory local adapter factory - */ - public SafeClientRepository(LocalAdapterFactory factory) { - super(factory); - try { - remote = getRemoteRepository(true); - } catch (RemoteException e) { - remote = new BrokenRemoteRepository(e); - } - } - - /** - * Abstract factory class for getting the remote repository. - * - * @return remote repository - * @throws RemoteException if the remote repository could not be accessed - */ - protected abstract RemoteRepository getRemoteRepository() - throws RemoteException; - - /** - * Method to obtain the remote remote repository. - * If initialize is true and a RepositoryException will be thrown no {@link BrokenRemoteRepository} - * will be created. - * - * @return remote repository - * @throws RemoteException if the remote repository could not be accessed - */ - protected RemoteRepository getRemoteRepository(boolean initialize) - throws RemoteException { - if (initialize) { - try { - return getRemoteRepository(); - } catch (RemoteException e) { - throw new RemoteRuntimeException(e); - } - } else { - return getRemoteRepository(); - } - } - - /** {@inheritDoc} */ - public synchronized String getDescriptor(String name) { - try { - return remote.getDescriptor(name); - } catch (RemoteException e1) { - try { - remote = getRemoteRepository(false); - return remote.getDescriptor(name); - } catch (RemoteException e2) { - remote = new BrokenRemoteRepository(e2); - throw new RemoteRuntimeException(e2); - } - } - } - - /** {@inheritDoc} */ - public synchronized String[] getDescriptorKeys() { - try { - return remote.getDescriptorKeys(); - } catch (RemoteException e1) { - try { - remote = getRemoteRepository(false); - return remote.getDescriptorKeys(); - } catch (RemoteException e2) { - remote = new BrokenRemoteRepository(e2); - throw new RemoteRuntimeException(e2); - } - } - } - - private synchronized RemoteSession remoteLogin( - Credentials credentials, String workspace) - throws RepositoryException { - try { - return remote.login(credentials, workspace); - } catch (RemoteException e1) { - try { - remote = getRemoteRepository(false); - return remote.login(credentials, workspace); - } catch (RemoteException e2) { - remote = new BrokenRemoteRepository(e2); - throw new RemoteRepositoryException(e2); - } - } - } - - /** {@inheritDoc} */ - public Session login(Credentials credentials, String workspace) - throws RepositoryException { - RemoteSession session = remoteLogin(credentials, workspace); - return getFactory().getSession(this, session); - } - - /** {@inheritDoc} */ - public Session login(String workspace) throws RepositoryException { - return login(null, workspace); - } - - /** {@inheritDoc} */ - public Session login(Credentials credentials) throws RepositoryException { - return login(credentials, null); - } - - /** {@inheritDoc} */ - public Session login() throws RepositoryException { - return login(null, null); - } - - /** {@inheritDoc} */ - public synchronized Value getDescriptorValue(String key) { - try { - return remote.getDescriptorValue(key); - } catch (RemoteException e1) { - try { - remote = getRemoteRepository(false); - return remote.getDescriptorValue(key); - } catch (RemoteException e2) { - remote = new BrokenRemoteRepository(e2); - throw new RemoteRuntimeException(e2); - } - } - } - - /** {@inheritDoc} */ - public synchronized Value[] getDescriptorValues(String key) { - try { - return remote.getDescriptorValues(key); - } catch (RemoteException e1) { - try { - remote = getRemoteRepository(false); - return remote.getDescriptorValues(key); - } catch (RemoteException e2) { - remote = new BrokenRemoteRepository(e2); - throw new RemoteRuntimeException(e2); - } - } - } - - /** {@inheritDoc} */ - public synchronized boolean isSingleValueDescriptor(String key) { - try { - return remote.isSingleValueDescriptor(key); - } catch (RemoteException e1) { - try { - remote = getRemoteRepository(false); - return remote.isSingleValueDescriptor(key); - } catch (RemoteException e2) { - remote = new BrokenRemoteRepository(e2); - throw new RemoteRuntimeException(e2); - } - } - } - - /** {@inheritDoc} */ - public synchronized boolean isStandardDescriptor(String key) { - try { - return remote.isStandardDescriptor(key); - } catch (RemoteException e1) { - try { - remote = getRemoteRepository(false); - return remote.isStandardDescriptor(key); - } catch (RemoteException e2) { - remote = new BrokenRemoteRepository(e2); - throw new RemoteRuntimeException(e2); - } - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/SerializingContentHandler.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/SerializingContentHandler.java deleted file mode 100644 index 7076210af2e..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/SerializingContentHandler.java +++ /dev/null @@ -1,439 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client; - -import java.io.OutputStream; -import java.io.StringWriter; -import java.io.Writer; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Result; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.sax.SAXTransformerFactory; -import javax.xml.transform.sax.TransformerHandler; -import javax.xml.transform.stream.StreamResult; - -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; -import org.xml.sax.helpers.DefaultHandler; - -/** - * A {@link ContentHandler} that serializes SAX events to a given - * {@link Result} instance. The JAXP {@link SAXTransformerFactory} - * facility is used for the serialization. - *

- * This class explicitly ensures that all namespace prefixes are also - * present as xmlns attributes in the serialized XML document. This avoids - * problems with Xalan's serialization behaviour which was (at least during - * JDK 1.4) to ignore namespaces if they were not present as xmlns attributes. - *

- * NOTE: The code in this class was originally written for Apache Cocoon and - * is included with some modifications here in Apache Jackrabbit. See the - * org.apache.cocoon.serialization.AbstractTextSerializer class in the - * cocoon-pipeline-impl component for the original code. - */ -class SerializingContentHandler extends DefaultContentHandler { - - /** - * The character encoding used for serialization (UTF-8). - * The encoding is fixed to make the text/xml content type safer to use. - * - * @see https://issues.apache.org/jira/browse/JCR-1621 - */ - public static final String ENCODING = "UTF-8"; - - /** The URI for xml namespaces */ - private static final String XML = "http://www.w3.org/XML/1998/namespace"; - - /** - * The factory used to create serializing SAX transformers. - */ - private static final SAXTransformerFactory FACTORY = - // Note that the cast from below is strictly speaking only valid when - // the factory instance supports the SAXTransformerFactory.FEATURE - // feature. But since this class would be useless without this feature, - // it's no problem to fail with a ClassCastException here and prevent - // this class from even being loaded. AFAIK all common JAXP - // implementations do support this feature. - (SAXTransformerFactory) TransformerFactory.newInstance(); - - /** - * Flag that indicates whether we need to work around the issue of - * the serializer not automatically generating the required xmlns - * attributes for the namespaces used in the document. - */ - private static final boolean NEEDS_XMLNS_ATTRIBUTES = - needsXmlnsAttributes(); - - /** - * Probes the available XML serializer for xmlns support. Used to set - * the value of the {@link #NEEDS_XMLNS_ATTRIBUTES} flag. - * - * @return whether the XML serializer needs explicit xmlns attributes - */ - private static boolean needsXmlnsAttributes() { - try { - StringWriter writer = new StringWriter(); - TransformerHandler probe = FACTORY.newTransformerHandler(); - probe.setResult(new StreamResult(writer)); - probe.startDocument(); - probe.startPrefixMapping("p", "uri"); - probe.startElement("uri", "e", "p:e", new AttributesImpl()); - probe.endElement("uri", "e", "p:e"); - probe.endPrefixMapping("p"); - probe.endDocument(); - return writer.toString().indexOf("xmlns") == -1; - } catch (Exception e) { - throw new UnsupportedOperationException("XML serialization fails"); - } - } - - /** - * Creates a serializing content handler that writes to the given stream. - * - * @param stream serialization target - * @return serializing content handler - * @throws SAXException if the content handler could not be initialized - */ - public static DefaultHandler getSerializer(OutputStream output) - throws SAXException { - return getSerializer(new StreamResult(output)); - } - - /** - * Creates a serializing content handler that writes to the given writer. - * - * @param writer serialization target - * @return serializing content handler - * @throws SAXException if the content handler could not be initialized - */ - public static DefaultHandler getSerializer(Writer writer) - throws SAXException { - return getSerializer(new StreamResult(writer)); - } - - /** - * Creates a serializing content handler that writes to the given result. - * - * @param result serialization target - * @return serializing content handler - * @throws SAXException if the content handler could not be initialized - */ - public static DefaultHandler getSerializer(Result result) - throws SAXException { - try { - TransformerHandler handler = FACTORY.newTransformerHandler(); - handler.setResult(result); - - // Specify the output properties to avoid surprises especially in - // character encoding or the output method (might be html for some - // documents!) - Transformer transformer = handler.getTransformer(); - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - transformer.setOutputProperty(OutputKeys.ENCODING, ENCODING); - transformer.setOutputProperty(OutputKeys.INDENT, "no"); - - if (NEEDS_XMLNS_ATTRIBUTES) { - // The serializer does not output xmlns declarations, - // so we need to do it explicitly with this wrapper - return new SerializingContentHandler(handler); - } else { - return new DefaultContentHandler(handler); - } - } catch (TransformerConfigurationException e) { - throw new SAXException("Failed to initialize XML serializer", e); - } - } - - /** - * The prefixes of startPrefixMapping() declarations for the coming element. - */ - private List prefixList = new ArrayList(); - - /** - * The URIs of startPrefixMapping() declarations for the coming element. - */ - private List uriList = new ArrayList(); - - /** - * Maps of URI<->prefix mappings. Used to work around a bug in the Xalan - * serializer. - */ - private Map uriToPrefixMap = new HashMap(); - private Map prefixToUriMap = new HashMap(); - - /** - * True if there has been some startPrefixMapping() for the coming element. - */ - private boolean hasMappings = false; - - /** - * Stack of the prefixes of explicitly generated prefix mapping calls - * per each element level. An entry is appended at the beginning of each - * {@link #startElement(String, String, String, Attributes)} call and - * removed at the end of each {@link #endElement(String, String, String)} - * call. By default the entry for each element is null to - * avoid losing performance, but whenever the code detects a new prefix - * mapping that needs to be registered, the null entry is - * replaced with a list of explicitly registered prefixes for that node. - * When that element is closed, the listed prefixes get unmapped. - * - * @see #checkPrefixMapping(String, String) - * @see JCR-1767 - */ - private final List addedPrefixMappings = new ArrayList(); - - private SerializingContentHandler(ContentHandler handler) { - super(handler); - } - - public void startDocument() throws SAXException { - // Cleanup - this.uriToPrefixMap.clear(); - this.prefixToUriMap.clear(); - clearMappings(); - super.startDocument(); - } - - /** - * Track mappings to be able to add xmlns: attributes - * in startElement(). - */ - public void startPrefixMapping(String prefix, String uri) throws SAXException { - // Store the mappings to reconstitute xmlns:attributes - // except prefixes starting with "xml": these are reserved - // VG: (uri != null) fixes NPE in startElement - if (uri != null && !prefix.startsWith("xml")) { - this.hasMappings = true; - this.prefixList.add(prefix); - this.uriList.add(uri); - - // append the prefix colon now, in order to save concatenations later, but - // only for non-empty prefixes. - if (prefix.length() > 0) { - this.uriToPrefixMap.put(uri, prefix + ":"); - } else { - this.uriToPrefixMap.put(uri, prefix); - } - - this.prefixToUriMap.put(prefix, uri); - } - super.startPrefixMapping(prefix, uri); - } - - /** - * Checks whether a prefix mapping already exists for the given namespace - * and generates the required {@link #startPrefixMapping(String, String)} - * call if the mapping is not found. By default the registered prefix - * is taken from the given qualified name, but a different prefix is - * automatically selected if that prefix is already used. - * - * @see JCR-1767 - * @param uri namespace URI - * @param qname element name with the prefix, or null - * @throws SAXException if the prefix mapping can not be added - */ - private void checkPrefixMapping(String uri, String qname) - throws SAXException { - // Only add the prefix mapping if the URI is not already known - if (uri != null && uri.length() > 0 && !uri.startsWith("xml") - && !uriToPrefixMap.containsKey(uri)) { - // Get the prefix - String prefix = "ns"; - if (qname != null && qname.length() > 0) { - int colon = qname.indexOf(':'); - if (colon != -1) { - prefix = qname.substring(0, colon); - } - } - - // Make sure that the prefix is unique - String base = prefix; - for (int i = 2; prefixToUriMap.containsKey(prefix); i++) { - prefix = base + i; - } - - int last = addedPrefixMappings.size() - 1; - List prefixes = (List) addedPrefixMappings.get(last); - if (prefixes == null) { - prefixes = new ArrayList(); - addedPrefixMappings.set(last, prefixes); - } - prefixes.add(prefix); - - startPrefixMapping(prefix, uri); - } - } - - /** - * Ensure all namespace declarations are present as xmlns: attributes - * and add those needed before calling superclass. This is a workaround for a Xalan bug - * (at least in version 2.0.1) : org.apache.xalan.serialize.SerializerToXML - * ignores start/endPrefixMapping(). - */ - public void startElement( - String eltUri, String eltLocalName, String eltQName, Attributes attrs) - throws SAXException { - // JCR-1767: Generate extra prefix mapping calls where needed - addedPrefixMappings.add(null); - checkPrefixMapping(eltUri, eltQName); - for (int i = 0; i < attrs.getLength(); i++) { - checkPrefixMapping(attrs.getURI(i), attrs.getQName(i)); - } - - // try to restore the qName. The map already contains the colon - if (null != eltUri && eltUri.length() != 0 && this.uriToPrefixMap.containsKey(eltUri)) { - eltQName = this.uriToPrefixMap.get(eltUri) + eltLocalName; - } - if (this.hasMappings) { - // Add xmlns* attributes where needed - - // New Attributes if we have to add some. - AttributesImpl newAttrs = null; - - int mappingCount = this.prefixList.size(); - int attrCount = attrs.getLength(); - - for (int mapping = 0; mapping < mappingCount; mapping++) { - - // Build infos for this namespace - String uri = (String) this.uriList.get(mapping); - String prefix = (String) this.prefixList.get(mapping); - String qName = prefix.equals("") ? "xmlns" : ("xmlns:" + prefix); - - // Search for the corresponding xmlns* attribute - boolean found = false; - for (int attr = 0; attr < attrCount; attr++) { - if (qName.equals(attrs.getQName(attr))) { - // Check if mapping and attribute URI match - if (!uri.equals(attrs.getValue(attr))) { - throw new SAXException("URI in prefix mapping and attribute do not match"); - } - found = true; - break; - } - } - - if (!found) { - // Need to add this namespace - if (newAttrs == null) { - // Need to test if attrs is empty or we go into an infinite loop... - // Well know SAX bug which I spent 3 hours to remind of :-( - if (attrCount == 0) { - newAttrs = new AttributesImpl(); - } else { - newAttrs = new AttributesImpl(attrs); - } - } - - if (prefix.equals("")) { - newAttrs.addAttribute(XML, qName, qName, "CDATA", uri); - } else { - newAttrs.addAttribute(XML, prefix, qName, "CDATA", uri); - } - } - } // end for mapping - - // Cleanup for the next element - clearMappings(); - - // Start element with new attributes, if any - super.startElement(eltUri, eltLocalName, eltQName, newAttrs == null ? attrs : newAttrs); - } else { - // Normal job - super.startElement(eltUri, eltLocalName, eltQName, attrs); - } - } - - - /** - * Receive notification of the end of an element. - * Try to restore the element qName. - */ - public void endElement(String eltUri, String eltLocalName, String eltQName) throws SAXException { - // try to restore the qName. The map already contains the colon - if (null != eltUri && eltUri.length() != 0 && this.uriToPrefixMap.containsKey(eltUri)) { - eltQName = this.uriToPrefixMap.get(eltUri) + eltLocalName; - } - - super.endElement(eltUri, eltLocalName, eltQName); - - // JCR-1767: Generate extra prefix un-mapping calls where needed - int last = addedPrefixMappings.size() - 1; - List prefixes = (List) addedPrefixMappings.remove(last); - if (prefixes != null) { - Iterator iterator = prefixes.iterator(); - while (iterator.hasNext()) { - endPrefixMapping((String) iterator.next()); - } - } - } - - /** - * End the scope of a prefix-URI mapping: - * remove entry from mapping tables. - */ - public void endPrefixMapping(String prefix) throws SAXException { - // remove mappings for xalan-bug-workaround. - // Unfortunately, we're not passed the uri, but the prefix here, - // so we need to maintain maps in both directions. - if (this.prefixToUriMap.containsKey(prefix)) { - this.uriToPrefixMap.remove(this.prefixToUriMap.get(prefix)); - this.prefixToUriMap.remove(prefix); - } - - if (hasMappings) { - // most of the time, start/endPrefixMapping calls have an element event between them, - // which will clear the hasMapping flag and so this code will only be executed in the - // rather rare occasion when there are start/endPrefixMapping calls with no element - // event in between. If we wouldn't remove the items from the prefixList and uriList here, - // the namespace would be incorrectly declared on the next element following the - // endPrefixMapping call. - int pos = prefixList.lastIndexOf(prefix); - if (pos != -1) { - prefixList.remove(pos); - uriList.remove(pos); - } - } - - super.endPrefixMapping(prefix); - } - - public void endDocument() throws SAXException { - // Cleanup - this.uriToPrefixMap.clear(); - this.prefixToUriMap.clear(); - clearMappings(); - super.endDocument(); - } - - private void clearMappings() { - this.hasMappings = false; - this.prefixList.clear(); - this.uriList.clear(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientIterator.java deleted file mode 100644 index 113f66bfbd4..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientIterator.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.iterator; - -import java.rmi.RemoteException; -import java.util.NoSuchElementException; - -import javax.jcr.RangeIterator; - -import org.apache.jackrabbit.rmi.client.ClientObject; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.client.RemoteRuntimeException; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; - -/** - * A buffering local adapter for the JCR-RMI {@link RemoteIterator} - * interface. This class makes the remote iterator locally available - * using the JCR {@link RangeIterator} interface. The element arrays - * returned by the remote iterator are buffered locally. - *

- * See the subclasses for type-specific versions of this abstract class. - */ -public abstract class ClientIterator extends ClientObject - implements RangeIterator { - - /** The adapted remote iterator. */ - private final RemoteIterator remote; - - /** - * The cached number of elements in the iterator, -1 if the iterator - * size is unknown, or -2 if the size has not been retrieved from the - * remote iterator. - */ - private long size; - - /** The position of the buffer within the iteration. */ - private long positionOfBuffer; - - /** The position within the buffer of the iteration. */ - private int positionInBuffer; - - /** - * The element buffer. Set to null when the end of the - * iteration has been reached. - */ - private Object[] buffer; - - /** - * Creates a local adapter for the given remote iterator. The element - * buffer is initially empty. - * - * @param remote remote iterator - * @param factory local adapter factory - */ - public ClientIterator(RemoteIterator remote, LocalAdapterFactory factory) { - super(factory); - this.remote = remote; - this.size = -2; - this.positionOfBuffer = 0; - this.positionInBuffer = 0; - this.buffer = new Object[0]; - } - - /** - * Returns the current position within the iterator. - * - * @return current position - * @see RangeIterator#getPosition() - */ - public long getPosition() { - return positionOfBuffer + positionInBuffer; - } - - /** - * Returns the size (the total number of elements) of this iteration. - * Returns -1 if the size is unknown. - *

- * To minimize the number of remote method calls, the size is retrieved - * when this method is first called and cached for subsequent invocations. - * - * @return number of elements in the iteration, or -1 - * @throws RemoteRuntimeException on RMI errors - * @see RangeIterator#getSize() - */ - public long getSize() throws RemoteRuntimeException { - if (size == -2) { - try { - size = remote.getSize(); - } catch (RemoteException e) { - throw new RemoteRuntimeException(e); - } - } - return size; - } - - /** - * Skips the given number of elements in this iteration. - *

- * The elements in the local element buffer are skipped first, and - * a remote skip method call is made only if more elements are being - * skipped than remain in the local buffer. - * - * @param skipNum the number of elements to skip - * @throws NoSuchElementException if skipped past the last element - * @throws RemoteRuntimeException on RMI errors - * @see RangeIterator#skip(long) - */ - public void skip(long skipNum) - throws NoSuchElementException, RemoteRuntimeException { - if (skipNum < 0) { - throw new IllegalArgumentException("Negative skip is not allowed"); - } else if (buffer == null && skipNum > 0) { - throw new NoSuchElementException("Skipped past the last element"); - } else if (positionInBuffer + skipNum <= buffer.length) { - positionInBuffer += skipNum; - } else { - try { - skipNum -= buffer.length - positionInBuffer; - remote.skip(skipNum); - positionInBuffer = buffer.length; - positionOfBuffer += skipNum; - } catch (RemoteException e) { - throw new RemoteRuntimeException(e); - } catch (NoSuchElementException e) { - buffer = null; // End of iterator reached - throw e; - } - } - } - - /** - * Advances the element buffer if there are no more elements in it. The - * element buffer is set to null if the end of the iteration - * has been reached. - * - * @throws RemoteException on RMI errors - */ - private void advance() throws RemoteException { - if (buffer != null && positionInBuffer == buffer.length) { - positionOfBuffer += buffer.length; - positionInBuffer = 0; - buffer = remote.nextObjects(); - if (buffer == null) { - size = positionOfBuffer; - } - } - } - - /** - * Checks if there are more elements in this iteration. - * - * @return true if there are more elements, - * false otherwise - * @throws RemoteRuntimeException on RMI errors - */ - public boolean hasNext() throws RemoteRuntimeException { - try { - advance(); - return buffer != null; - } catch (RemoteException e) { - throw new RemoteRuntimeException(e); - } - } - - /** - * Returns a local adapter for the given remote object. This abstract - * method is used by {@link #next()} to convert the remote references - * returned by the remote iterator to local adapters. - *

- * Subclasses should implement this method to use the local adapter - * factory to create local adapters of the specific element type. - * - * @param remote remote object - * @return local adapter - */ - protected abstract Object getObject(Object remote); - - /** - * Returns the next element in this iteration. - * - * @return next element - * @throws NoSuchElementException if there are no more elements - * @throws RemoteRuntimeException on RMI errors - */ - public Object next() throws NoSuchElementException, RemoteRuntimeException { - try { - advance(); - if (buffer == null) { - throw new NoSuchElementException("End of iterator reached"); - } else { - return getObject(buffer[positionInBuffer++]); - } - } catch (RemoteException e) { - throw new RemoteRuntimeException(e); - } - } - - /** - * Not supported. - * - * @throws UnsupportedOperationException always thrown - */ - public void remove() throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientNodeIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientNodeIterator.java deleted file mode 100644 index a8e228cbf26..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientNodeIterator.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.iterator; - -import javax.jcr.Node; -import javax.jcr.NodeIterator; -import javax.jcr.Session; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteNode; - -/** - * A ClientIterator for iterating remote nodes. - */ -public class ClientNodeIterator extends ClientIterator implements NodeIterator { - - /** The current session. */ - private final Session session; - - /** - * Creates a ClientNodeIterator instance. - * - * @param iterator remote iterator - * @param session current session - * @param factory local adapter factory - */ - public ClientNodeIterator( - RemoteIterator iterator, Session session, - LocalAdapterFactory factory) { - super(iterator, factory); - this.session = session; - } - - /** - * Creates and returns a local adapter for the given remote node. - * - * @param remote remote referecne - * @return local adapter - * @see ClientIterator#getObject(Object) - */ - protected Object getObject(Object remote) { - return getNode(session, (RemoteNode) remote); - } - - /** - * Returns the next node in this iteration. - * - * @return next node - * @see NodeIterator#nextNode() - */ - public Node nextNode() { - return (Node) next(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientNodeTypeIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientNodeTypeIterator.java deleted file mode 100644 index 3bc09cab013..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientNodeTypeIterator.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.iterator; - -import javax.jcr.nodetype.NodeType; -import javax.jcr.nodetype.NodeTypeIterator; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; - -/** - * A ClientIterator for iterating remote node types. - */ -public class ClientNodeTypeIterator extends ClientIterator - implements NodeTypeIterator { - - /** - * Creates a ClientNodeTypeIterator instance. - * - * @param iterator remote iterator - * @param factory local adapter factory - */ - public ClientNodeTypeIterator( - RemoteIterator iterator, LocalAdapterFactory factory) { - super(iterator, factory); - } - - /** - * Creates and returns a local adapter for the given remote node. - * - * @param remote remote referecne - * @return local adapter - * @see ClientIterator#getObject(Object) - */ - protected Object getObject(Object remote) { - return getFactory().getNodeType((RemoteNodeType) remote); - } - - /** - * Returns the next node type in this iteration. - * - * @return next node type - * @see NodeTypeIterator#nextNodeType() - */ - public NodeType nextNodeType() { - return (NodeType) next(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientPropertyIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientPropertyIterator.java deleted file mode 100644 index a180f508dd0..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientPropertyIterator.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.iterator; - -import javax.jcr.Property; -import javax.jcr.PropertyIterator; -import javax.jcr.Session; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteProperty; - -/** - * A ClientIterator for iterating remote properties. - */ -public class ClientPropertyIterator extends ClientIterator - implements PropertyIterator { - - /** The current session. */ - private final Session session; - - /** - * Creates a ClientPropertyIterator instance. - * - * @param iterator remote iterator - * @param session current session - * @param factory local adapter factory - */ - public ClientPropertyIterator( - RemoteIterator iterator, Session session, - LocalAdapterFactory factory) { - super(iterator, factory); - this.session = session; - } - - /** - * Creates and returns a local adapter for the given remote property. - * - * @param remote remote referecne - * @return local adapter - * @see ClientIterator#getObject(Object) - */ - protected Object getObject(Object remote) { - return getFactory().getProperty(session, (RemoteProperty) remote); - } - - /** - * Returns the next property in this iteration. - * - * @return next property - * @see PropertyIterator#nextProperty() - */ - public Property nextProperty() { - return (Property) next(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientRowIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientRowIterator.java deleted file mode 100644 index 7014fbeaa09..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientRowIterator.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.iterator; - -import javax.jcr.Session; -import javax.jcr.query.Row; -import javax.jcr.query.RowIterator; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteRow; - -/** - * A ClientIterator for iterating remote rows. - */ -public class ClientRowIterator extends ClientIterator implements RowIterator { - - /** Current session. */ - private Session session; - - /** - * Creates a ClientRowIterator instance. - * - * @param iterator remote iterator - * @param factory local adapter factory - */ - public ClientRowIterator(Session session, - RemoteIterator iterator, LocalAdapterFactory factory) { - super(iterator, factory); - this.session = session; - } - - /** - * Creates and returns a local adapter for the given remote row. - * - * @param remote remote reference - * @return local adapter - * @see ClientIterator#getObject(Object) - */ - protected Object getObject(Object remote) { - return getFactory().getRow(session, (RemoteRow) remote); - } - - /** - * Returns the next row in this iteration. - * - * @return next row - * @see RowIterator#nextRow() - */ - public Row nextRow() { - return (Row) next(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientVersionIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientVersionIterator.java deleted file mode 100644 index 44832ef8db1..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientVersionIterator.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.iterator; - -import javax.jcr.Session; -import javax.jcr.version.Version; -import javax.jcr.version.VersionIterator; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteVersion; - -/** - * A ClientIterator for iterating remote versions. - */ -public class ClientVersionIterator extends ClientIterator - implements VersionIterator { - - /** The current session. */ - private final Session session; - - /** - * Creates a ClientVersionIterator instance. - * - * @param iterator remote iterator - * @param session current session - * @param factory local adapter factory - */ - public ClientVersionIterator( - RemoteIterator iterator, Session session, - LocalAdapterFactory factory) { - super(iterator, factory); - this.session = session; - } - - /** - * Creates and returns a local adapter for the given remote version. - * - * @param remote remote referecne - * @return local adapter - * @see ClientIterator#getObject(Object) - */ - protected Object getObject(Object remote) { - return getFactory().getVersion(session, (RemoteVersion) remote); - } - - /** - * Returns the next version in this iteration. - * - * @return next version - * @see VersionIterator#nextVersion() - */ - public Version nextVersion() { - return (Version) next(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/package-info.java deleted file mode 100755 index ad196f8e5b6..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.client.iterator; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/package-info.java deleted file mode 100755 index 75e643f9218..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.client; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientGroup.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientGroup.java deleted file mode 100644 index 84ed3c100ef..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientGroup.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.principal; - -import java.rmi.RemoteException; -import java.security.Principal; -import java.util.Enumeration; -import java.util.Iterator; - -import org.apache.jackrabbit.api.security.principal.GroupPrincipal; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.client.RemoteRuntimeException; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.principal.RemoteGroup; -import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal; - -/** - * Local adapter for the JCR-RMI {@link RemoteGroup RemoteGroup} interface. - * - * @see RemoteGroup - */ -public class ClientGroup extends ClientPrincipal implements GroupPrincipal { - - private final LocalAdapterFactory factory; - - public ClientGroup(final RemotePrincipal p, - final LocalAdapterFactory factory) { - super(p); - this.factory = factory; - } - - /** - * @return false - this method is not implemented yet - */ - public boolean addMember(Principal user) { - // no support for adding member here - return false; - } - - public boolean isMember(Principal member) { - try { - return ((RemoteGroup) getRemotePrincipal()).isMember(member.getName()); - } catch (RemoteException re) { - throw new RemoteRuntimeException(re); - } - } - - public Enumeration members() { - try { - final RemoteIterator remote = ((RemoteGroup) getRemotePrincipal()).members(); - final Iterator pi = factory.getPrincipalIterator(remote); - return new Enumeration() { - public boolean hasMoreElements() { - return pi.hasNext(); - } - - public Principal nextElement() { - return pi.next(); - } - }; - } catch (RemoteException re) { - throw new RemoteRuntimeException(re); - } - } - - /** - * @return false - this method is not implemented yet - */ - public boolean removeMember(Principal user) { - // no support for removing member here - return false; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientPrincipal.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientPrincipal.java deleted file mode 100644 index 266c0810688..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientPrincipal.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.principal; - -import java.rmi.RemoteException; -import java.security.Principal; - -import org.apache.jackrabbit.rmi.client.RemoteRuntimeException; -import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal; - -/** - * Local adapter for the JCR-RMI {@link RemotePrincipal RemotePrincipal} - * interface. This class makes a remote principal locally available using the - * Java {@link Principal} interface. - * - * @see Principal - * @see RemotePrincipal - */ -public class ClientPrincipal implements Principal { - - private final RemotePrincipal p; - - public ClientPrincipal(final RemotePrincipal p) { - this.p = p; - } - - /** {@inheritDoc} */ - public String getName() { - try { - return p.getName(); - } catch (RemoteException re) { - throw new RemoteRuntimeException(re); - } - } - - /** - * Returns the {@link RemotePrincipal} encapsulated in this instance. - *

- * NOTE: This method is intended to only be used in the JCR RMI - * implementation to be able to "send back" remote principals to the server - * for implementation of the remote JCR API. - * - * @return the {@link RemotePrincipal} encapsulated in this instance. - */ - public final RemotePrincipal getRemotePrincipal() { - return p; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientPrincipalIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientPrincipalIterator.java deleted file mode 100644 index 207e113808f..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientPrincipalIterator.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.principal; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.client.iterator.ClientIterator; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal; - -/** - * A ClientIterator for iterating remote principals - */ -public class ClientPrincipalIterator extends ClientIterator { - - public ClientPrincipalIterator(final RemoteIterator iterator, - final LocalAdapterFactory factory) { - super(iterator, factory); - } - - /** {@inheritDoc} */ - @Override - protected Object getObject(Object remote) { - return getFactory().getPrincipal((RemotePrincipal) remote); - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/package-info.java deleted file mode 100755 index 8dd28b896ab..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("4.0.0") -package org.apache.jackrabbit.rmi.client.principal; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlEntry.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlEntry.java deleted file mode 100644 index 3554cdb1a11..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlEntry.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.security; - -import java.rmi.RemoteException; -import java.security.Principal; - -import javax.jcr.security.AccessControlEntry; -import javax.jcr.security.Privilege; - -import org.apache.jackrabbit.rmi.client.ClientObject; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.client.RemoteRuntimeException; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry; - -/** - * Local adapter for the JCR-RMI {@link RemoteAccessControlEntry - * RemoteAccessControlEntry} interface. This class makes a remote - * AccessControlEntry locally available using the JCR {@link AccessControlEntry - * AccessControlEntry} interface. - * - * @see javax.jcr.security.AccessControlEntry - * @see org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry - */ -public class ClientAccessControlEntry extends ClientObject implements - AccessControlEntry { - - private final RemoteAccessControlEntry race; - - public ClientAccessControlEntry(final RemoteAccessControlEntry race, - final LocalAdapterFactory factory) { - super(factory); - this.race = race; - } - - /** {@inheritDoc} */ - public Principal getPrincipal() { - try { - return getFactory().getPrincipal(race.getPrincipal()); - } catch (RemoteException re) { - throw new RemoteRuntimeException(re); - } - } - - /** {@inheritDoc} */ - public Privilege[] getPrivileges() { - try { - return getFactory().getPrivilege(race.getPrivileges()); - } catch (RemoteException re) { - throw new RemoteRuntimeException(re); - } - } - - RemoteAccessControlEntry getRemoteAccessControlEntry() { - return race; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlList.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlList.java deleted file mode 100644 index 98674442199..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlList.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.security; - -import java.rmi.RemoteException; -import java.security.Principal; - -import javax.jcr.RepositoryException; -import javax.jcr.UnsupportedRepositoryOperationException; -import javax.jcr.security.AccessControlEntry; -import javax.jcr.security.AccessControlList; -import javax.jcr.security.Privilege; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.client.RemoteRepositoryException; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlList; - -/** - * Local adapter for the JCR-RMI {@link RemoteAccessControlList - * RemoteAccessControlList} interface. This class makes a remote - * AccessControlList locally available using the JCR {@link AccessControlList - * AccessControlList} interface. - * - * @see javax.jcr.security.AccessControlList - * @see org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlList - */ -public class ClientAccessControlList extends ClientAccessControlPolicy - implements AccessControlList { - - public ClientAccessControlList(final RemoteAccessControlList racl, - final LocalAdapterFactory factory) { - super(racl, factory); - } - - /** - * @throws UnsupportedRepositoryOperationException This method is not - * implemented yet - */ - public boolean addAccessControlEntry(Principal principal, - Privilege[] privileges) - throws UnsupportedRepositoryOperationException { - // TODO: implement client side of the story - throw new UnsupportedRepositoryOperationException( - "addAccessControlEntry"); - } - - /** {@inheritDoc} */ - public AccessControlEntry[] getAccessControlEntries() - throws RepositoryException { - try { - return getFactory().getAccessControlEntry( - ((RemoteAccessControlList) getRemoteAccessControlPolicy()).getAccessControlEntries()); - } catch (RemoteException re) { - throw new RemoteRepositoryException(re); - } - } - - /** - * @throws UnsupportedRepositoryOperationException This method is not - * implemented yet - */ - public void removeAccessControlEntry(AccessControlEntry ace) - throws UnsupportedRepositoryOperationException { - // TODO: implement client side of the story - throw new UnsupportedRepositoryOperationException( - "removeAccessControlEntry"); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlManager.java deleted file mode 100644 index ef8996ff9c6..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlManager.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.security; - -import java.rmi.RemoteException; - -import javax.jcr.AccessDeniedException; -import javax.jcr.PathNotFoundException; -import javax.jcr.RepositoryException; -import javax.jcr.UnsupportedRepositoryOperationException; -import javax.jcr.security.AccessControlException; -import javax.jcr.security.AccessControlManager; -import javax.jcr.security.AccessControlPolicy; -import javax.jcr.security.AccessControlPolicyIterator; -import javax.jcr.security.Privilege; -import org.apache.jackrabbit.rmi.client.ClientObject; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.client.RemoteRepositoryException; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager; - -/** - * Local adapter for the JCR-RMI {@link RemoteAccessControlManager - * RemoteAccessControlManager} interface. This class makes a remote - * AccessControlManager locally available using the JCR - * {@link AccessControlManager AccessControlManager} interface. - * - * @see javax.jcr.security.AccessControlManager - * @see org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager - */ -public class ClientAccessControlManager extends ClientObject implements - AccessControlManager { - - private final RemoteAccessControlManager racm; - - public ClientAccessControlManager(final RemoteAccessControlManager racm, - final LocalAdapterFactory factory) { - super(factory); - this.racm = racm; - } - - /** {@inheritDoc} */ - public AccessControlPolicyIterator getApplicablePolicies(String absPath) - throws RepositoryException { - try { - return getFactory().getAccessControlPolicyIterator( - racm.getApplicablePolicies(absPath)); - } catch (RemoteException re) { - throw new RemoteRepositoryException(re); - } - } - - /** {@inheritDoc} */ - public AccessControlPolicy[] getEffectivePolicies(String absPath) - throws PathNotFoundException, AccessDeniedException, - RepositoryException { - try { - return getFactory().getAccessControlPolicy( - racm.getEffectivePolicies(absPath)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public AccessControlPolicy[] getPolicies(String absPath) - throws PathNotFoundException, AccessDeniedException, - RepositoryException { - try { - return getFactory().getAccessControlPolicy( - racm.getPolicies(absPath)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Privilege[] getPrivileges(String absPath) - throws PathNotFoundException, RepositoryException { - try { - return getFactory().getPrivilege(racm.getPrivileges(absPath)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Privilege[] getSupportedPrivileges(String absPath) - throws PathNotFoundException, RepositoryException { - try { - return getFactory().getPrivilege( - racm.getSupportedPrivileges(absPath)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasPrivileges(String absPath, Privilege[] privileges) - throws PathNotFoundException, RepositoryException { - String[] privNames = new String[privileges.length]; - for (int i = 0; i < privNames.length; i++) { - privNames[i] = privileges[i].getName(); - } - - try { - return racm.hasPrivileges(absPath, privNames); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - - } - - /** {@inheritDoc} */ - public Privilege privilegeFromName(String privilegeName) - throws AccessControlException, RepositoryException { - try { - return getFactory().getPrivilege( - racm.privilegeFromName(privilegeName)); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** - * @throws UnsupportedRepositoryOperationException This method is not - * implemented yet - */ - public void removePolicy(String absPath, AccessControlPolicy policy) - throws UnsupportedRepositoryOperationException { - // TODO: implement client side of the story - throw new UnsupportedRepositoryOperationException("removePolicy"); - } - - /** - * @throws UnsupportedRepositoryOperationException This method is not - * implemented yet - */ - public void setPolicy(String absPath, AccessControlPolicy policy) - throws UnsupportedRepositoryOperationException { - // TODO: implement client side of the story - throw new UnsupportedRepositoryOperationException("setPolicy"); - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlPolicy.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlPolicy.java deleted file mode 100644 index e68b5f55de3..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlPolicy.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.security; - -import javax.jcr.security.AccessControlPolicy; -import org.apache.jackrabbit.rmi.client.ClientObject; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy; - -/** - * Local adapter for the JCR-RMI {@link RemoteAccessControlPolicy - * RemoteAccessControlPolicy} interface. This class makes a remote - * AccessControlPolicy locally available using the JCR - * {@link AccessControlPolicy AccessControlPolicy} interface. - * - * @see javax.jcr.security.AccessControlPolicy - * @see org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy - */ -public class ClientAccessControlPolicy extends ClientObject implements - AccessControlPolicy { - - private final RemoteAccessControlPolicy racp; - - public ClientAccessControlPolicy(final RemoteAccessControlPolicy racp, - final LocalAdapterFactory factory) { - super(factory); - this.racp = racp; - } - - RemoteAccessControlPolicy getRemoteAccessControlPolicy() { - return racp; - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlPolicyIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlPolicyIterator.java deleted file mode 100644 index fe43e1d5424..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlPolicyIterator.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.security; - -import javax.jcr.security.AccessControlPolicy; -import javax.jcr.security.AccessControlPolicyIterator; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.client.iterator.ClientIterator; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlList; - -/** - * A ClientIterator for iterating remote access control policies. - */ -public class ClientAccessControlPolicyIterator extends ClientIterator implements - AccessControlPolicyIterator { - - public ClientAccessControlPolicyIterator(RemoteIterator iterator, - LocalAdapterFactory factory) { - super(iterator, factory); - } - - /** {@inheritDoc} */ - protected Object getObject(Object remote) { - return getFactory().getAccessControlPolicy( - (RemoteAccessControlList) remote); - } - - /** {@inheritDoc} */ - public AccessControlPolicy nextAccessControlPolicy() { - return (AccessControlPolicy) next(); - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientPrivilege.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientPrivilege.java deleted file mode 100644 index b8a6450cdd5..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientPrivilege.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.client.security; - -import java.rmi.RemoteException; - -import javax.jcr.security.Privilege; - -import org.apache.jackrabbit.rmi.client.ClientObject; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.client.RemoteRuntimeException; -import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege; - -/** - * Local adapter for the JCR-RMI {@link RemotePrivilege RemotePrivilege} - * interface. This class makes a remote Privilege locally available using the - * JCR {@link Privilege Privilege} interface. - * - * @see javax.jcr.security.Privilege - * @see org.apache.jackrabbit.rmi.remote.security.RemotePrivilege - */ -public class ClientPrivilege extends ClientObject implements Privilege { - - private final RemotePrivilege rp; - - public ClientPrivilege(final RemotePrivilege rp, - final LocalAdapterFactory factory) { - super(factory); - this.rp = rp; - } - - /** {@inheritDoc} */ - public Privilege[] getAggregatePrivileges() { - try { - return getFactory().getPrivilege(rp.getAggregatePrivileges()); - } catch (RemoteException re) { - throw new RemoteRuntimeException(re); - } - } - - /** {@inheritDoc} */ - public Privilege[] getDeclaredAggregatePrivileges() { - try { - return getFactory().getPrivilege( - rp.getDeclaredAggregatePrivileges()); - } catch (RemoteException re) { - throw new RemoteRuntimeException(re); - } - } - - /** {@inheritDoc} */ - public String getName() { - try { - return rp.getName(); - } catch (RemoteException re) { - throw new RemoteRuntimeException(re); - } - } - - /** {@inheritDoc} */ - public boolean isAbstract() { - try { - return rp.isAbstract(); - } catch (RemoteException re) { - throw new RemoteRuntimeException(re); - } - } - - /** {@inheritDoc} */ - public boolean isAggregate() { - try { - return rp.isAggregate(); - } catch (RemoteException re) { - throw new RemoteRuntimeException(re); - } - } - - public boolean equals(Object obj) { - if (obj == this) { - return true; - } else if (obj == null) { - return false; - } - - if (obj instanceof Privilege) { - return getName().equals(((Privilege) obj).getName()); - } - - return false; - } - - public int hashCode() { - return getName().hashCode(); - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/package-info.java deleted file mode 100755 index fef0d6cec51..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.client.security; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/ArrayEventIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/ArrayEventIterator.java deleted file mode 100644 index 543f620d9d7..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/ArrayEventIterator.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.iterator; - -import javax.jcr.observation.Event; -import javax.jcr.observation.EventIterator; - -/** - * Array implementation of the JCR - * {@link javax.jcr.observation.EventIterator EventIterator} interface. - * This class is used by the JCR-RMI client adapters to convert - * node arrays to iterators. - */ -public class ArrayEventIterator extends ArrayIterator implements EventIterator { - - /** - * Creates an iterator for the given array of events. - * - * @param nodes the nodes to iterate - */ - public ArrayEventIterator(Event[] nodes) { - super(nodes); - } - - /** {@inheritDoc} */ - public Event nextEvent() { - return (Event) next(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/ArrayEventListenerIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/ArrayEventListenerIterator.java deleted file mode 100644 index 8a497982ead..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/ArrayEventListenerIterator.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.iterator; - -import javax.jcr.observation.EventListener; -import javax.jcr.observation.EventListenerIterator; - -/** - * Array implementation of the JCR - * {@link javax.jcr.observation.EventListenerIterator EventListenerIterator} interface. - * This class is used by the JCR-RMI client adapters to convert - * listener arrays to iterators. - */ -public class ArrayEventListenerIterator extends ArrayIterator - implements EventListenerIterator { - - /** - * Creates an iterator for the given array of listeners. - * - * @param listeners the listeners to iterate - */ - public ArrayEventListenerIterator(EventListener[] listeners) { - super(listeners); - } - - /** {@inheritDoc} */ - public EventListener nextEventListener() { - return (EventListener) next(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/ArrayIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/ArrayIterator.java deleted file mode 100644 index f06ca8c7f62..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/ArrayIterator.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.iterator; - -import java.util.NoSuchElementException; - -import javax.jcr.RangeIterator; - -/** - * Array implementation of the JCR - * {@link javax.jcr.RangeIterator RangeIterator} interface. This class - * implements the RangeIterator functionality for an underlying array - * of objects. Used as the base class for the type-specific iterator - * classes defined in this package. - */ -public class ArrayIterator implements RangeIterator { - - /** The current iterator position. */ - private int position; - - /** The underlying array of objects. */ - private Object[] array; - - /** - * Creates an iterator for the given array of objects. - * - * @param array the objects to iterate - */ - public ArrayIterator(Object[] array) { - this.position = 0; - this.array = array; - } - - /** {@inheritDoc} */ - public boolean hasNext() { - return (position < array.length); - } - - /** {@inheritDoc} */ - public Object next() { - return array[position++]; - } - - /** {@inheritDoc} */ - public void remove() { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - public void skip(long items) { - position += items; - if (position > array.length) { - position = array.length; - throw new NoSuchElementException( - "Skipped past the last element of the iterator"); - } - } - - /** {@inheritDoc} */ - public long getSize() { - return array.length; - } - - /** {@inheritDoc} */ - public long getPosition() { - return position; - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/package-info.java deleted file mode 100755 index 06af128a016..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/iterator/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.iterator; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitClientAdapterFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitClientAdapterFactory.java deleted file mode 100644 index 972172d9cc4..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitClientAdapterFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.jackrabbit; - -import org.apache.jackrabbit.rmi.client.ClientAdapterFactory; - -/** - * @deprecated Use the normal {@link ClientAdapterFactory} instead - */ -public class JackrabbitClientAdapterFactory extends ClientAdapterFactory { -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/package-info.java deleted file mode 100755 index 09727fd1bba..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.jackrabbit; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/ClientEventPoll.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/ClientEventPoll.java deleted file mode 100644 index 7c3dca80819..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/ClientEventPoll.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.observation; - -import java.rmi.RemoteException; -import java.util.HashMap; -import java.util.Map; - -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.observation.Event; -import javax.jcr.observation.EventIterator; -import javax.jcr.observation.EventListener; - -import org.apache.jackrabbit.rmi.client.RemoteRepositoryException; -import org.apache.jackrabbit.rmi.client.RemoteRuntimeException; -import org.apache.jackrabbit.rmi.iterator.ArrayEventIterator; -import org.apache.jackrabbit.rmi.remote.RemoteEventCollection; -import org.apache.jackrabbit.rmi.remote.RemoteObservationManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The ClientEventPoll class is the registry for client-side - * event listeners on behalf of the - * {@link org.apache.jackrabbit.rmi.client.ClientObservationManager} class. In - * addition this class extends the java.lang.Thread class able - * to be run in a separate thread to constantly poll the server-side observation - * manager for new events. - *

- * Notes: - *

    - *
  1. Only one instance of this class should be instantiated for each instance - * of a {@link org.apache.jackrabbit.rmi.remote.RemoteObservationManager} class. - *
  2. EventListeners registered with this class must properly - * implement the Object.hashCode() and Object.equals() - * contracts for them to be handled correctly by this class. - *
- * - * @see #run() - */ -public class ClientEventPoll extends Thread { - - /** logger */ - private static final Logger log = - LoggerFactory.getLogger(ClientEventPoll.class); - - /** - * The time in milliseconds the {@link #run()} method should be waiting - * for remote events. - * @see #run() - */ - private static final long POLL_TIMEOUT = 5000; - - /** The thread name */ - private static final String THREAD_NAME = "Client Event Poller"; - - /** The primitive unique identifier generator. */ - private static long counter = 0; - - /** The {@link RemoteObservationManager} called for the new events. */ - private final RemoteObservationManager remote; - - /** - * The Session checked by the {@link #run} method whether it - * is still alive or the thread should terminate. - */ - private final Session session; - - /** The map of locally registered listeners indexed by the unique identifier */ - private Map listenerMap = new HashMap(); - - /** The map of unique identifieres indexed by the registered listeners */ - private Map idMap = new HashMap(); - - /** - * Flag indicating whether the {@link #run()} method should terminate. - * @see #run() - */ - private boolean running = true; - - /** - * Creates an instance of this class talking to the given - * {@link RemoteObservationManager}. - * - * @param remote The remote observation manager which is asked for new - * events. This must not be null. - * @param session The Session which is asked whether it is - * alive by the {@link #run()} method. This must not be null. - * - * @throws NullPointerException if remote or session - * is null. - */ - public ClientEventPoll(RemoteObservationManager remote, Session session) - throws NullPointerException { - super(THREAD_NAME); - - // check remote and session - if (remote == null) { - throw new NullPointerException("remote"); - } - if (session == null) { - throw new NullPointerException("session"); - } - - this.remote = remote; - this.session = session; - } - - /** - * Registers the given local listener with this instance and returns the - * unique identifier assigned to it. - * - * @param listener The EventListener to register. - * - * @return The unique identifier assigned to the newly registered event - * listener. - */ - public synchronized long addListener(EventListener listener) { - Long id = new Long(counter++); - listenerMap.put(id, listener); - idMap.put(listener, id); - return id.longValue(); - } - - /** - * Unregisters the given local listener from this instance and returns the - * unique identifier assigned to it. - * - * @param listener The EventListener to unregister. - * - * @return The unique identifier assigned to the unregistered event listener - * or -1 if the listener was not registered. - */ - public synchronized long removeListener(EventListener listener) { - Long key = (Long) idMap.remove(listener); - if (key != null) { - listenerMap.remove(key); - return key.longValue(); - } - - return -1; - } - - /** - * Returns an array of the registered event listeners. - * - * @return registered event listeners - */ - public synchronized EventListener[] getListeners() { - return (EventListener[]) listenerMap.values().toArray( - new EventListener[(listenerMap.size())]); - } - - /** - * Indicates to the {@link #run()} method, that asking for events should - * be terminated. - * - * @see #run() - */ - public void terminate() { - this.running = false; - } - - //---------- Thread overwrite --------------------------------------------- - - /** - * Checks for remote events and dispatches them to the locally registered - * event listeners. This is how this method works: - *
    - *
  1. Continue with next step if {@link #terminate()} has not been called - * yet and the session is still alive. - *
  2. Call the {@link RemoteObservationManager#getNextEvent(long)} method - * waiting for a specified time (5 seconds). - *
  3. If no event was received in the specified time go back to step #1. - *
  4. Extract the unique listener identifier from the remote event and - * find it in the list of locally registered event listeners. Go back to - * step #1 if no such listener exists. - *
  5. Convert the remote event list to an EventIterator and - * call the EventListener.onEvent() method. - *
  6. Go back to step #1. - *
- */ - public void run() { - while (running && session.isLive()) { - try { - // ask for an event waiting at most POLL_TIMEOUT milliseconds - RemoteEventCollection remoteEvent = remote.getNextEvent(POLL_TIMEOUT); - - // poll time out, check running and ask again - if (remoteEvent == null) { - continue; - } - - // extract the listener id from the remote event and find - // the locally registered event listener - Long id = new Long(remoteEvent.getListenerId()); - EventListener listener = (EventListener) listenerMap.get(id); - - // if the listener is not registered (anymore), the event is - // silently ignored, running is checked and the server asked again - if (listener == null) { - continue; - } - - // otherwise convert the remote events into an EventIterator - // and the listener is called - RemoteEventCollection.RemoteEvent[] remoteEvents = remoteEvent.getEvents(); - EventIterator events = toEvents(remoteEvents); - try { - listener.onEvent(events); - } catch (Exception e) { - log.error("Unexpected failure of Listener " + listener, e); - } - - } catch (RemoteException re) { - log.error("Problem handling event. Looking for next one.", re); - } - } - } - - //---------- internal ----------------------------------------------------- - - /** - * Converts an array of {@link RemoteEventCollection.RemoteEvent} instances to an - * instance of EventIterator suitable to be sent to the - * event listener. - * - * @param remoteEvents array of remote events - * @return event iterator - * @throws RemoteException on RMI errors - */ - private EventIterator toEvents(RemoteEventCollection.RemoteEvent[] remoteEvents) - throws RemoteException { - Event[] events = new Event[remoteEvents.length]; - for (int i = 0; i < events.length; i++) { - events[i] = new JCREvent(remoteEvents[i]); - } - return new ArrayEventIterator(events); - } - - /** - * The JCREvent class is a simple implementation of the JCR - * Event interface to be sent to the locally registered - * event listeners. - * - * @author Felix Meschberger - */ - private static class JCREvent implements Event { - - /** The adapted remote event. */ - private final RemoteEventCollection.RemoteEvent remote; - - /** - * Creates an instance of this class from the contents of the given - * remoteEvent. - * - * @param remoteEvent The {@link RemoteEventCollection.RemoteEvent} instance - * providing the data for this event. - */ - private JCREvent(RemoteEventCollection.RemoteEvent remoteEvent) { - remote = remoteEvent; - } - - /** {@inheritDoc} */ - public int getType() { - try { - return remote.getType(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public String getPath() throws RepositoryException { - try { - return remote.getPath(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getUserID() { - try { - return remote.getUserID(); - } catch (RemoteException ex) { - throw new RemoteRuntimeException(ex); - } - } - - /** {@inheritDoc} */ - public long getDate() throws RepositoryException { - try { - return remote.getDate(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getIdentifier() throws RepositoryException { - try { - return remote.getIdentifier(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Map getInfo() throws RepositoryException { - try { - return remote.getInfo(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getUserData() throws RepositoryException { - try { - return remote.getUserData(); - } catch (RemoteException ex) { - throw new RemoteRepositoryException(ex); - } - } - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/Queue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/Queue.java deleted file mode 100644 index c0f22230264..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/Queue.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.observation; - -import java.util.LinkedList; - -/** - * The Queue class is a very simple queue assuming that there is - * at least one consumer and potentially multiple producers. This class poses - * no restrictions on the size of the queue. - */ -public class Queue { - - /** The linked list implementing the queue of data */ - private final LinkedList queue; - - /** - * Creates an instance of this queue. - */ - public Queue() { - queue = new LinkedList(); - } - - /** - * Appends the given object to the end of the queue. - *

- * After appending the element, the queue is notified such that threads - * waiting to retrieve an element from the queue are woken up. - * - * @param object the object to be added - */ - public void put(Object object) { - synchronized (queue) { - queue.addLast(object); - queue.notifyAll(); - } - } - - /** - * Returns the first element from the queue. If the queue is currently empty - * the method waits at most the given number of milliseconds. - * - * @param timeout The maximum number of milliseconds to wait for an entry in - * the queue if the queue is empty. If zero, the method waits forever - * for an element. - * - * @return The first element of the queue or null if the method - * timed out waiting for an entry. - * - * @throws InterruptedException Is thrown if the current thread is - * interrupted while waiting for the queue to get at least one entry. - */ - public Object get(long timeout) throws InterruptedException { - synchronized (queue) { - // wait for data if the queue is empty - if (queue.isEmpty()) { - queue.wait(timeout); - } - - // return null if queue is (still) empty - if (queue.isEmpty()) { - return null; - } - - // return first if queue has content now - return queue.removeFirst(); - } - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/ServerEventListenerProxy.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/ServerEventListenerProxy.java deleted file mode 100644 index ad4a88267cd..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/ServerEventListenerProxy.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.observation; - -import java.rmi.RemoteException; - -import javax.jcr.observation.EventIterator; -import javax.jcr.observation.EventListener; - -import org.apache.jackrabbit.rmi.remote.RemoteEventCollection; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The ServerEventListenerProxy class is the server-side event - * listener proxy registered on behalf of a client-side event listener identified - * with the unique identifier. - *

- * The term Server in this class indicates, that this is a server-side - * class. In contrast to the classes in the - * {@link org.apache.jackrabbit.rmi.server} package, this class neither extends - * the {@link org.apache.jackrabbit.rmi.server.ServerObject} class nor does it - * implement any of the remote interfaces in the - * {@link org.apache.jackrabbit.rmi.remote} package because it only is - * instantiated to be used on the server side. - *

- * See the package overview for an explanation of the mechanisms implemented for - * event dispatching. - */ -public class ServerEventListenerProxy implements EventListener { - - /** logger */ - private static final Logger log = - LoggerFactory.getLogger(ServerEventListenerProxy.class); - - /** The factory used to convert event iterators to remote events */ - private final RemoteAdapterFactory factory; - - /** - * The unique indentifier of the client-side event listener on whose - * behalf this listener proxy is registered. - */ - private final long listenerId; - - /** - * The queue to which remote events are queue for them to be picked up - * by calls to the - * {@link org.apache.jackrabbit.rmi.remote.RemoteObservationManager#getNextEvent(long)} - * method. - */ - private final Queue queue; - - /** - * Creates a new instance of this listener proxy. - * - * @param factory The {@link RemoteAdapterFactory} used to convert the - * {@link EventIterator} instances to {@link RemoteEventCollection} objects. - * @param listenerId The unique identifier of the client-side event listener - * on whose behalf this proxy works. - * @param queue The sink to which events to be dispatched to the client are - * queued to be picked up. - */ - public ServerEventListenerProxy(RemoteAdapterFactory factory, - long listenerId, Queue queue) { - this.factory = factory; - this.listenerId = listenerId; - this.queue = queue; - } - - /** - * Converts the {@link javax.jcr.observation.Event} instances in the given - * iterator to an instance of {@link RemoteEventCollection} for them to be dispatched - * to the client-side event listener. - * - * @param events The {@link javax.jcr.observation.Event Events} to be - * dispatched. - */ - public void onEvent(EventIterator events) { - try { - RemoteEventCollection remoteEvent = factory.getRemoteEvent(listenerId, events); - queue.put(remoteEvent); - } catch (RemoteException re) { - Throwable t = (re.getCause() == null) ? re : re.getCause(); - log.error("Problem creating remote event for " + listenerId, t); - } - } - - //---------- Object overwrite ---------------------------------------------- - - /** - * Returns the client-side listener identifier as its hash code. - * - * @return hash code - */ - public int hashCode() { - return (int) listenerId; - } - - /** - * Returns true if obj is either the same as this - * or a proxy for the same client-side listener, which is identicated by the - * same listener identifier. - * - * @param obj The object to compare to. - * - * @return true if obj is the same or a proxy for - * the same client-side listener. - */ - public boolean equals(Object obj) { - if (this == obj) { - return true; - } else if (obj instanceof ServerEventListenerProxy) { - return listenerId == ((ServerEventListenerProxy) obj).listenerId; - } else { - return false; - } - } - - /** - * Returns the a string representation of this instance, which is an - * indication of this class's name and the unique identifier of the real - * event listener. - * - * @return string representation - */ - public String toString() { - return "EventListenerProxy: listenerId=" + listenerId; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/package-info.java deleted file mode 100755 index c78b4f6d8e9..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/observation/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.observation; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/ArrayIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/ArrayIterator.java deleted file mode 100644 index 1c58e43a679..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/ArrayIterator.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.io.Serializable; -import java.util.NoSuchElementException; - -/** - * A simple array-based remote iterator. Used when the iteration is - * short enough for all the elements to be sent over the network in - * one go. - */ -public class ArrayIterator implements RemoteIterator, Serializable { - - /** - * The elements in this iterator. Set to null when - * all elements have been iterated. - */ - private Object[] elements; - - /** - * The position of this iterator. Set to the size of the iterator - * when all elements have been iterated. - */ - private int position; - - /** - * Creates an array-based remote iterator from the given array - * of remote references or serializable objects. - * - * @param elements elements of the iteration - */ - public ArrayIterator(Object[] elements) { - this.elements = elements; - this.position = 0; - } - - /** - * Returns the size of the iterator. - * - * @return length of the iterator - * @see RemoteIterator#getSize() - */ - public long getSize() { - if (elements == null) { - return position; - } else { - return elements.length; - } - } - - /** - * Skips the first items elements in the array. - * {@inheritDoc} - */ - public void skip(long items) - throws IllegalArgumentException, NoSuchElementException { - if (items < 0) { - throw new IllegalArgumentException("Negative skip is not allowed"); - } else if (elements == null || items > elements.length) { - throw new NoSuchElementException("Skipped past the last element"); - } else if (items == elements.length) { - position = elements.length; - elements = null; - } else { - Object[] tmp = new Object[elements.length - (int) items]; - System.arraycopy(elements, (int) items, tmp, 0, tmp.length); - elements = tmp; - position += items; - } - } - - /** - * Returns the underlying array. - * {@inheritDoc} - */ - public Object[] nextObjects() throws IllegalArgumentException { - if (elements == null) { - return null; - } else { - Object[] tmp = elements; - position += elements.length; - elements = null; - return tmp; - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/BufferIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/BufferIterator.java deleted file mode 100644 index 542596eeb71..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/BufferIterator.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.io.Serializable; -import java.rmi.RemoteException; -import java.util.NoSuchElementException; - -/** - * A buffered remote iterator. Used to transfer a remote iterator reference - * along with a buffer of the first few iterator elements in one network - * transmission. - */ -public class BufferIterator implements RemoteIterator, Serializable { - - /** The element buffer. Set to null when the iterator ends. */ - private Object[] buffer; - - /** Cached size of the iterator. */ - private final long size; - - /** Remote iterator reference. */ - private final RemoteIterator remote; - - /** - * Creates a new buffered remote iterator. - * - * @param buffer first elements in the iterator - * @param size total iterator size - * @param remote reference to the remaining iterator - */ - public BufferIterator(Object[] buffer, long size, RemoteIterator remote) { - this.buffer = buffer; - this.size = size; - this.remote = remote; - } - - /** - * Returns the cached size of the iterator. - * - * @return iterator size, or -1 if unknown - * @see RemoteIterator#getSize() - */ - public long getSize() { - return size; - } - - /** - * Skips the given number of elements. First discards elements from the - * element buffer and only then contacts the remote iterator. - * - * @param items number of items to skip - * @throws IllegalArgumentException if items is negative - * @throws NoSuchElementException if skipped past the last element - * @throws RemoteException on RMI errors - * @see RemoteIterator#skip(long) - */ - public void skip(long items) - throws IllegalArgumentException, NoSuchElementException, - RemoteException { - if (items < 0) { - throw new IllegalArgumentException("Negative skip is not allowed"); - } else if (buffer == null && items > 0) { - throw new NoSuchElementException("Skipped past the last element"); - } else if (items > buffer.length) { - remote.skip(items - buffer.length); - buffer = remote.nextObjects(); - } else { - Object[] tmp = new Object[buffer.length - (int) items]; - System.arraycopy(buffer, (int) items, tmp, 0, tmp.length); - buffer = tmp; - } - } - - /** - * Returns the currently buffered elements and fills in the buffer - * with next elements. - * - * @return buffered elements, or null if the iterator has ended - * @throws RemoteException on RMI errors - * @see RemoteIterator#nextObjects() - */ - public Object[] nextObjects() throws RemoteException { - if (buffer == null) { - return null; - } else { - Object[] tmp = buffer; - buffer = remote.nextObjects(); - return tmp; - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteEventCollection.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteEventCollection.java deleted file mode 100644 index 9c9eca1d8c4..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteEventCollection.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.util.Map; - -import javax.jcr.RepositoryException; - -/** - * The RemoteEventCollection class serves as a container for - * notifications sent to registered event listeners. Instances of this class are - * created by the server-side event listener proxies and sent to the client-side - * event poller. On the client-side the enclosed list of events is then sent to - * the listener identified by the contained listener identifier. - */ -public interface RemoteEventCollection extends Remote { - - /** - * Returns unique identifier of the client-side listener to which the - * enclosed events should be sent. - * - * @return unique listener identifier - * @throws RemoteException on RMI errors - */ - long getListenerId() throws RemoteException; - - /** - * Returns the list of events to be sent to the client-side listener - * identified by {@link #getListenerId()}. - * - * @return list of events - * @throws RemoteException on RMI errors - */ - RemoteEvent[] getEvents() throws RemoteException; - - /** - * The RemoteEvent class provides an encapsulation of single - * events in an event list sent to a registered listener. - */ - public static interface RemoteEvent extends Remote { - /** - * Remote version of the - * {@link javax.jcr.observation.Event#getType() Event.getType()} method. - * - * @return the type of this event. - * @throws RemoteException on RMI errors - */ - int getType() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.observation.Event#getPath() Event.getPath()} method. - * - * @return the absolute path associated with this event or - * null. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getPath() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.observation.Event#getUserID() Event.getUserID()} method. - * - * @return the user ID. - * @throws RemoteException on RMI errors - */ - String getUserID() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.observation.Event#getIdentifier() Event.getIdentifier()} method. - * - * @return the identifier associated with this event or null. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getIdentifier() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.observation.Event#getInfo() Event.getInfo()} method. - * - * @return A Map containing parameter information for instances - * of a NODE_MOVED event. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - Map getInfo() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.observation.Event#getUserData() Event.getUserData()} method. - * - * @return The user data string. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getUserData() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.observation.Event#getDate() Event.getDate()} method. - * - * @return the date when the change was persisted that caused this event. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - long getDate() throws RepositoryException, RemoteException; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteItem.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteItem.java deleted file mode 100644 index bbf98380c39..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteItem.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -/** - * Remote version of the JCR {@link javax.jcr.Item Item} interface. - * Used by the {@link org.apache.jackrabbit.rmi.server.ServerItem ServerItem} - * and {@link org.apache.jackrabbit.rmi.client.ClientItem ClientItem} - * adapter base classes to provide transparent RMI access to remote items. - *

- * The methods in this interface are documented only with a reference - * to a corresponding Item method. The remote object will simply forward - * the method call to the underlying Item instance. Argument and return - * values, as well as possible exceptions, are copied over the network. - * Complex return values (Items and Nodes) are returned as remote references - * to the corresponding remote interfaces. RMI errors are signaled with - * RemoteExceptions. - * - * @see javax.jcr.Item - * @see org.apache.jackrabbit.rmi.client.ClientItem - * @see org.apache.jackrabbit.rmi.server.ServerItem - */ -public interface RemoteItem extends Remote { - - /** - * Remote version of the - * {@link javax.jcr.Item#getPath() Item.getPath()} method. - * - * @return item path - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getPath() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Item#getName() Item.getName()} method. - * - * @return item name - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getName() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Item#getAncestor(int) Item.getAncestor(int)} method. - * - * @param level ancestor level - * @return ancestor item - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteItem getAncestor(int level) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Item#getParent() Item.getParent()} method. - * - * @return parent node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode getParent() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Item#getDepth() Item.getDepth()} method. - * - * @return item depth - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - int getDepth() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Item#isNew() Item.isNew()} method. - * - * @return true if the item is new, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean isNew() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Item#isModified() Item.isModified()} method. - * - * @return true if the item is modified, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean isModified() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Item#save() Item.save()} method. - * - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void save() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Item#refresh(boolean) Item.refresh(boolean)} method. - * - * @param keepChanges flag to keep transient changes - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void refresh(boolean keepChanges) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Item#remove() Item.remove()} method. - * - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void remove() throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteItemDefinition.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteItemDefinition.java deleted file mode 100644 index 3ab6e0f17d6..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteItemDefinition.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -/** - * Remote version of the JCR {@link javax.jcr.nodetype.ItemDefinition ItemDef} - * interface. Used by the - * {@link org.apache.jackrabbit.rmi.server.ServerItemDefinition ServerItemDefinition} and - * {@link org.apache.jackrabbit.rmi.client.ClientItemDefinition ClientItemDefinition} - * adapter base classes to provide transparent RMI access to remote item - * definitions. - *

- * The methods in this interface are documented only with a reference - * to a corresponding ItemDef method. The remote object will simply forward - * the method call to the underlying ItemDef instance. Argument and return - * values, as well as possible exceptions, are copied over the network. - * Complex {@link javax.jcr.nodetype.NodeType NodeType} return values - * are returned as remote references to the - * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeType RemoteNodeType} - * interface. RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.nodetype.ItemDefinition - * @see org.apache.jackrabbit.rmi.client.ClientItemDefinition - * @see org.apache.jackrabbit.rmi.server.ServerItemDefinition - */ -public interface RemoteItemDefinition extends Remote { - - /** - * Remote version of the - * {@link javax.jcr.nodetype.ItemDefinition#getDeclaringNodeType() ItemDef.getDeclaringNodeType()} - * method. - * - * @return declaring node type - * @throws RemoteException on RMI errors - */ - RemoteNodeType getDeclaringNodeType() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.ItemDefinition#getName() ItemDef.getName()} method. - * - * @return item name - * @throws RemoteException on RMI errors - */ - String getName() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.ItemDefinition#isAutoCreated() ItemDef.isAutoCreate()} - * method. - * - * @return true if the item is automatically created, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean isAutoCreated() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.ItemDefinition#isMandatory() ItemDef.isMandatory()} - * method. - * - * @return true if the item is mandatory, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean isMandatory() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.ItemDefinition#getOnParentVersion() ItemDef.getOnParentVersion()} - * method. - * - * @return parent version behaviour - * @throws RemoteException on RMI errors - */ - int getOnParentVersion() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.ItemDefinition#isProtected() ItemDef.isProtected()} - * method. - * - * @return true if the item is protected, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean isProtected() throws RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteIterator.java deleted file mode 100644 index fa6b69f4d1d..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteIterator.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.util.NoSuchElementException; - -/** - * Remote version of the JCR {@link javax.jcr.RangeIterator} interface. - * Used by the {@link org.apache.jackrabbit.rmi.server.iterator.ServerIterator} and - * {@link org.apache.jackrabbit.rmi.client.iterator.ClientIterator} classes to - * provide transparent RMI access to remote iterators. - *

- * This interface allows both the client and server side to control the - * amount of buffering used to increase performance. - */ -public interface RemoteIterator extends Remote { - - /** - * Returns the size of the iteration, or -1 if the - * size is unknown. - * - * @return size of the iteration, or -1 if unknown - * @throws RemoteException on RMI errors - * @see javax.jcr.RangeIterator#getSize() - */ - long getSize() throws RemoteException; - - /** - * Skips the given number of elements in this iteration. - * - * @param items number of elements to skip - * @throws NoSuchElementException if skipped past the last element - * @throws RemoteException on RMI errors - * @see javax.jcr.RangeIterator#skip(long) - */ - void skip(long items) throws NoSuchElementException, RemoteException; - - /** - * Returns an array of remote references to the next elements in this - * iterator. Returns null if the end of this iteration has - * been reached. - *

- * To reduce the amount of remote method calls, this method returns an - * array of one or more elements in this iteration. - * - * @return array of remote references, or null - * @throws IllegalArgumentException if maxItems is not positive - * @throws RemoteException on RMI errors - * @see java.util.Iterator#next() - */ - Object[] nextObjects() throws IllegalArgumentException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java deleted file mode 100644 index 014c69cafd7..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -/** - * Remote version of the JCR {@link javax.jcr.lock.Lock} interface. - * Used by the {@link org.apache.jackrabbit.rmi.server.ServerLock ServerLock} - * and {@link org.apache.jackrabbit.rmi.client.ClientLock ClientLock} - * adapter classes to provide transparent RMI access to remote locks. - *

- * The methods in this interface are documented only with a reference - * to a corresponding Lock method. The remote object will simply forward - * the method call to the underlying Lock instance. Return values and - * possible exceptions are copied over the network. RMI errors are signaled - * with RemoteExceptions. - * - * @see javax.jcr.lock.Lock - * @see org.apache.jackrabbit.rmi.client.ClientLock - * @see org.apache.jackrabbit.rmi.server.ServerLock - */ -public interface RemoteLock extends Remote { - - /** - * Remote version of the - * {@link javax.jcr.lock.Lock#getNode() Lock.getNode()} method. - * - * @return remote node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - * @since JCR-RMI 2.0 - */ - RemoteNode getNode() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.lock.Lock#getLockOwner() Lock.getLockOwner()} method. - * - * @return lock owner - * @throws RemoteException on RMI errors - */ - String getLockOwner() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.lock.Lock#isDeep() Lock.isDeep()} method. - * - * @return true if the lock is deep, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean isDeep() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.lock.Lock#getLockToken() Lock.getLockToken()} method. - * - * @return lock token - * @throws RemoteException on RMI errors - */ - String getLockToken() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.lock.Lock#isLive() Lock.isLive()} method. - * - * @return true if the lock is live, - * false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean isLive() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.lock.Lock#refresh() Lock.refresh()} method. - * - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void refresh() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.lock.Lock#isSessionScoped()} () Lock.isSessionScoped()} method. - * - * @return true if the lock is live, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean isSessionScoped() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.lock.Lock#getSecondsRemaining()} () Lock.getSecondsRemaining()} method. - * - * @return the number of seconds remaining until this lock times out. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - long getSecondsRemaining() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.lock.Lock#isLockOwningSession()} () Lock.isLockOwningSession()} method. - * - * @return a boolean. - * @throws RemoteException on RMI errors - */ - boolean isLockOwningSession() throws RemoteException; - - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteLockManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteLockManager.java deleted file mode 100644 index caf3f387cba..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteLockManager.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -public interface RemoteLockManager extends Remote { - - String[] getLockTokens() throws RepositoryException, RemoteException; - - void addLockToken(String lockToken) - throws RepositoryException, RemoteException; - - void removeLockToken(String lockToken) - throws RepositoryException, RemoteException; - - RemoteLock getLock(String absPath) - throws RepositoryException, RemoteException; - - boolean holdsLock(String absPath) - throws RepositoryException, RemoteException; - - boolean isLocked(String absPath) - throws RepositoryException, RemoteException; - - RemoteLock lock( - String absPath, boolean isDeep, boolean isSessionScoped, - long timeoutHint, String ownerInfo) - throws RepositoryException, RemoteException; - - void unlock(String absPath) throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNamespaceRegistry.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNamespaceRegistry.java deleted file mode 100644 index b442f2033ed..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNamespaceRegistry.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -/** - * Remote version of the JCR - * {@link javax.jcr.NamespaceRegistry NamespaceRegistry} interface. - * Used by the - * {@link org.apache.jackrabbit.rmi.server.ServerNamespaceRegistry ServerNamespaceRegistry} - * and - * {@link org.apache.jackrabbit.rmi.client.ClientNamespaceRegistry ClientNamespaceRegistry} - * adapters to provide transparent RMI access to remote namespace registries. - *

- * The methods in this interface are documented only with a reference - * to a corresponding NamespaceRegistry method. The remote object will - * simply forward the method call to the underlying NamespaceRegistry instance. - * Argument and return values, as well as possible exceptions, are copied - * over the network. RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.NamespaceRegistry - * @see org.apache.jackrabbit.rmi.client.ClientNamespaceRegistry - * @see org.apache.jackrabbit.rmi.server.ServerNamespaceRegistry - */ -public interface RemoteNamespaceRegistry extends Remote { - - /** - * Remote version of the - * {@link javax.jcr.NamespaceRegistry#registerNamespace(String,String) NamespaceRegistry.registerNamespace(String,String)} - * method. - * - * @param prefix namespace prefix - * @param uri namespace uri - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void registerNamespace(String prefix, String uri) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.NamespaceRegistry#unregisterNamespace(String) NamespaceRegistry.unregisterNamespace(String)} - * method. - * - * @param prefix namespace prefix - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void unregisterNamespace(String prefix) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.NamespaceRegistry#getPrefixes() NamespaceRegistry.getPrefixes()} - * method. - * - * @return namespace prefixes - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String[] getPrefixes() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.NamespaceRegistry#getURIs() NamespaceRegistry,getURIs()} - * method. - * - * @return namespace uris - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String[] getURIs() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.NamespaceRegistry#getURI(String) NamespaceRegistry.getURI(String)} - * method. - * - * @param prefix namespace prefix - * @return namespace uri - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getURI(String prefix) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.NamespaceRegistry#getPrefix(String) NamespaceRegistry.getPrefix(String)} - * method. - * - * @param uri namespace uri - * @return namespace prefix - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getPrefix(String uri) throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java deleted file mode 100644 index e95a0473d7e..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java +++ /dev/null @@ -1,743 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.Value; - -/** - * Remote version of the JCR {@link javax.jcr.Node Node} interface. - * Used by the {@link org.apache.jackrabbit.rmi.server.ServerNode ServerNode} - * and {@link org.apache.jackrabbit.rmi.client.ClientNode ClientNode} - * adapters to provide transparent RMI access to remote nodes. - *

- * The methods in this interface are documented only with a reference - * to a corresponding Node method. The remote object will simply forward - * the method call to the underlying Node instance. Argument and return - * values, as well as possible exceptions, are copied over the network. - * Complex return values (like Nodes and Properties) are returned as remote - * references to the corresponding remote interfaces. Iterator values - * are transmitted as object arrays. RMI errors are signaled with - * RemoteExceptions. - *

- * Note that only two generic setProperty methods are included in this - * interface. Clients should implement the type-specific setProperty - * methods by wrapping the argument values into generic Value objects - * and calling the generic setProperty methods. Note also that the - * Value objects must be serializable and implemented using classes - * available on both the client and server side. The - * {@link org.apache.jackrabbit.rmi.value.SerialValueFactory SerialValueFactory} - * class provides two convenience methods to satisfy these requirements. - * - * @see javax.jcr.Node - * @see org.apache.jackrabbit.rmi.client.ClientNode - * @see org.apache.jackrabbit.rmi.server.ServerNode - */ -public interface RemoteNode extends RemoteItem { - - /** - * Remote version of the - * {@link javax.jcr.Node#addNode(String) Node.addNode(Sring)} method. - * - * @param path relative path - * @return new node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode addNode(String path) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#addNode(String,String) Node.addNode(String,String)} - * method. - * - * @param path relative path - * @param type node type name - * @return new node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode addNode(String path, String type) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getProperty(String) Node.getProperty(String)} - * method. - * - * @param path relative path - * @return node property - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteProperty getProperty(String path) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getProperties() Node.getProperties()} method. - * - * @return node properties - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getProperties() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getProperties(String) Node.getProperties(String)} - * method. - * - * @param pattern property name pattern - * @return matching node properties - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getProperties(String pattern) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getProperties(String[]) Node.getProperties(String[])} - * method. - * - * @param globs property name globs - * @return matching node properties - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getProperties(String[] globs) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getPrimaryItem() Node.getPrimaryItem()} method. - * - * @return primary item - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteItem getPrimaryItem() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getIdentifier() Node.getIdentifier()} method. - * - * @return node identifier - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getIdentifier() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getUUID() Node.getUUID()} method. - * - * @return node uuid - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getUUID() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getReferences() Node.getReferences()} method. - * - * @return reference properties - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getReferences() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getReferences(String) Node.getReferences(String)} method. - * - * @param name reference property name - * @return reference properties - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getReferences(String name) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getNodes() Node.getNodes()} method. - * - * @return child nodes - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getNodes() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getNodes(String) Node.getNodes(String)} method. - * - * @param pattern node name pattern - * @return matching child nodes - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getNodes(String pattern) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getNodes(String[]) Node.getNodes(String[])} method. - * - * @param globs node name globs - * @return matching child nodes - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getNodes(String[] globs) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#hasNode(String) Node.hasNode(String)} method. - * - * @param path relative path - * @return true if the identified node exists, - * false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean hasNode(String path) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#hasProperty(String) Node.hasProperty()} method. - * - * @param path relative path - * @return true if the identified property exists, - * false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean hasProperty(String path) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#hasNodes() Node.hasNodes()} method. - * - * @return true if this node has child nodes, - * false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean hasNodes() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#hasProperties() Node.hasProperties()} method. - * - * @return true if this node has properties, - * false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean hasProperties() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getPrimaryNodeType() Node.getPrimaryNodeType()} - * method. - * - * @return primary node type - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNodeType getPrimaryNodeType() - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getMixinNodeTypes() Node.getMixinNodeTypes()} - * method. - * - * @return mixin node types - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNodeType[] getMixinNodeTypes() - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#isNodeType(String) Node.isNodeType(String)} method. - * - * @param type node type name - * @return true if this node is an instance of the - * identified type, false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean isNodeType(String type) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getNode(String) Node.getNode(String)} method. - * - * @param path relative path - * @return node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode getNode(String path) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#orderBefore(String,String) Node.orderBefore(String,String)} - * method. - * - * @param src source path - * @param dst destination path - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void orderBefore(String src, String dst) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#setProperty(String,Value) Node.setProperty(String,Value)} - * method. - * - * @param name property name - * @param value property value - * @return property - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteProperty setProperty(String name, Value value) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#setProperty(String,Value,int) Node.setProperty(String,Value)} - * method. - * - * @param name property name - * @param value property value - * @param type property type - * @return property - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteProperty setProperty(String name, Value value, int type) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#setProperty(String,Value[]) Node.setProperty(String,Value[])} - * method. - * - * @param name property name - * @param values property values - * @return property - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteProperty setProperty(String name, Value[] values) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#addMixin(String) Node.addMixin(String)} method. - * - * @param name mixin type name - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void addMixin(String name) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#removeMixin(String) Node.removeMixin(String)} - * method. - * - * @param name mixin type name - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void removeMixin(String name) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#canAddMixin(String) Node.canAddMixin(String)} - * method. - * - * @param name mixin type name - * @return true if the mixin type can be added, - * false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean canAddMixin(String name) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getDefinition() Node.getDefinition()} method. - * - * @return node definition - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNodeDefinition getDefinition() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#checkin() Node.checkin()} method. - * - * @return checked in version - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteVersion checkin() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#checkout() Node.checkout()} method. - * - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void checkout() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#update(String) Node.update(String)} method. - * - * @param workspace source workspace name - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void update(String workspace) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#merge(String,boolean) Node.merge(String,boolean)} - * method. - * - * @param workspace source workspace name - * @param bestEffort best effort flag - * @return nodes that failed to merge - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator merge(String workspace, boolean bestEffort) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#cancelMerge(javax.jcr.version.Version) Node.cancelMerge(Version)} - * method. - * - * @param versionUUID The UUID of the version whose labels are to be returned. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void cancelMerge(String versionUUID) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#doneMerge(javax.jcr.version.Version) Node.doneMerge(Version)} - * method. - * - * @param versionUUID The UUID of the version whose labels are to be returned. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void doneMerge(String versionUUID) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getCorrespondingNodePath(String) Node.getCorrespondingNodePath(String)} - * method. - * - * @param workspace workspace name - * @return corresponding node path - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getCorrespondingNodePath(String workspace) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getIndex() Node.getIndex()} method. - * - * @return node index - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - int getIndex() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#restore(String,boolean) Node.restore(String,boolean)} - * method. - * - * @param version version name - * @param removeExisting flag to remove conflicting nodes - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void restore(String version, boolean removeExisting) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#restore(javax.jcr.version.Version, boolean) Node.restore(Version,boolean)} - * method. - *

- * This method has been rename to prevent a naming clash with - * {@link #restore(String, boolean)}. - * - * @param versionUUID The UUID of the version whose labels are to be returned. - * @param removeExisting flag to remove conflicting nodes - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void restoreByUUID(String versionUUID, boolean removeExisting) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#restore(javax.jcr.version.Version, String, boolean) Node.restore(Version,String,boolean)} - * method. - * - * @param versionUUID The UUID of the version whose labels are to be returned. - * @param path the path to which the version is to be restored - * @param removeExisting flag to remove conflicting nodes - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void restore(String versionUUID, String path, boolean removeExisting) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#restoreByLabel(String,boolean) Node.restoreByLabel(String,boolean)} - * method. - * - * @param label version label - * @param removeExisting flag to remove conflicting nodes - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void restoreByLabel(String label, boolean removeExisting) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#unlock() Node.unlock()} method. - * - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void unlock() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#holdsLock() Node.holdsLock()} method. - * - * @return true if this node holds a lock, - * false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean holdsLock() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#isLocked() Node.isLocked()} method. - * - * @return true if this node is locked, - * false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean isLocked() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#isCheckedOut() Node.isCheckedOut()} method. - * - * @return true if this node is checked out, - * false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean isCheckedOut() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getVersionHistory() Node.getVersionHistory()} method. - * - * @return the remote version history. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteVersionHistory getVersionHistory() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getBaseVersion() Node.getBaseVersion()} method. - * - * @return the remote base version - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteVersion getBaseVersion() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#setProperty(String,Value[],int) Node.setProperty(String,Value[],int)} - * method. - * - * @param name property name - * @param values property values - * @param type property type - * @return property - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteProperty setProperty(String name, Value[] values, int type) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#lock(boolean,boolean) Node.lock(boolean,boolean)} - * method. - * - * @param isDeep flag to create a deep lock - * @param isSessionScoped flag to create a session-scoped lock - * @return lock - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteLock lock(boolean isDeep, boolean isSessionScoped) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getLock() Node.getLock()} method. - * - * @return lock - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteLock getLock() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getSharedSet() Node.getSharedSet()} method. - * - * @return a NodeIterator. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getSharedSet() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#followLifecycleTransition(String) Node.followLifecycleTransition(String)} - * method. - * - * @param transition a state transition - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void followLifecycleTransition(String transition) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getAllowedLifecycleTransistions() Node.getAllowedLifecycleTransistions()} - * method. - * - * @return a String array. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String[] getAllowedLifecycleTransistions() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getWeakReferences() Node.getWeakReferences()} - * method. - * - * @return A PropertyIterator. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getWeakReferences() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#getWeakReferences(String) Node.getWeakReferences(String)} - * method. - * - * @param name name of referring WEAKREFERENCE properties to be - * returned; if null then all referring - * WEAKREFERENCEs are returned. - * @return A PropertyIterator. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getWeakReferences(String name) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#removeShare() Node.removeShare()} - * method. - * - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void removeShare() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#removeSharedSet() Node.removeSharedSet()} - * method. - * - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void removeSharedSet() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Node#setPrimaryType(String) Node.setPrimaryType(String)} - * method. - * - * @param nodeTypeName the node type name - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void setPrimaryType(String nodeTypeName) throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNodeDefinition.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNodeDefinition.java deleted file mode 100644 index a4c14c29857..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNodeDefinition.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.RemoteException; - -/** - * Remote version of the JCR {@link javax.jcr.nodetype.NodeDefinition NodeDefinition} - * interface. Used by the - * {@link org.apache.jackrabbit.rmi.server.ServerNodeDefinition ServerNodeDefinition} and - * {@link org.apache.jackrabbit.rmi.client.ClientNodeDefinition ClientNodeDefinition} - * adapters to provide transparent RMI access to remote node definitions. - *

- * The methods in this interface are documented only with a reference - * to a corresponding NodeDef method. The remote object will simply forward - * the method call to the underlying NodeDef instance. Return values - * and possible exceptions are copied over the network. Complex - * {@link javax.jcr.nodetype.NodeType NodeType} return values - * are returned as remote references to the - * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeType RemoteNodeType} - * interface. RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.nodetype.NodeDefinition - * @see org.apache.jackrabbit.rmi.client.ClientNodeDefinition - * @see org.apache.jackrabbit.rmi.server.ServerNodeDefinition - */ -public interface RemoteNodeDefinition extends RemoteItemDefinition { - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeDefinition#getRequiredPrimaryTypes() NodeDef.getRequiredPrimaryTypes()} - * method. - * - * @return required primary node types - * @throws RemoteException on RMI errors - */ - RemoteNodeType[] getRequiredPrimaryTypes() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeDefinition#getDefaultPrimaryType() NodeDef.getDefaultPrimaryType()} - * method. - * - * @return default primary node type - * @throws RemoteException on RMI errors - */ - RemoteNodeType getDefaultPrimaryType() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeDefinition#allowsSameNameSiblings() NodeDef.allowSameNameSibs()} - * method. - * - * @return true if same name siblings are allowed, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean allowsSameNameSiblings() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeDefinition#getDefaultPrimaryTypeName() NodeDef.getDefaultPrimaryTypeName()} - * method. - * - * @return a String - * @throws RemoteException on RMI errors - */ - String getDefaultPrimaryTypeName() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeDefinition#getRequiredPrimaryTypeNames() NodeDef.getRequiredPrimaryTypeNames()} - * method. - * - * @return a String array - * @throws RemoteException on RMI errors - */ - String[] getRequiredPrimaryTypeNames() throws RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNodeType.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNodeType.java deleted file mode 100644 index 8f4c834ce87..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNodeType.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.Value; - -/** - * Remote version of the JCR {@link javax.jcr.nodetype.NodeType NodeType} - * interface. Used by the - * {@link org.apache.jackrabbit.rmi.server.ServerNodeType ServerNodeType} and - * {@link org.apache.jackrabbit.rmi.client.ClientNodeType ClientNodeType} - * adapters to provide transparent RMI access to remote node types. - *

- * The methods in this interface are documented only with a reference - * to a corresponding NodeType method. The remote object will simply forward - * the method call to the underlying NodeType instance. Return values - * and possible exceptions are copied over the network. Complex return - * values (like NodeTypes and PropertyDefs) are returned as remote - * references to the corresponding remote interfaces. RMI errors are - * signaled with RemoteExceptions. - * - * @see javax.jcr.nodetype.NodeType - * @see org.apache.jackrabbit.rmi.client.ClientNodeType - * @see org.apache.jackrabbit.rmi.server.ServerNodeType - */ -public interface RemoteNodeType extends Remote { - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#getName() NodeType.getName()} method. - * - * @return node type name - * @throws RemoteException on RMI errors - */ - String getName() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#isMixin() NodeType.isMixin()} method. - * - * @return true if this is a mixin type, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean isMixin() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#isAbstract() NodeType.isAbstract()} method. - * - * @return true if this is an abstract type, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean isAbstract() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#hasOrderableChildNodes() NodeType.hasOrderableChildNodes()} - * method. - * - * @return true if nodes of this type has orderable - * child nodes, false otherwise - * @throws RemoteException on RMI errors - */ - boolean hasOrderableChildNodes() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#getSupertypes() NodeType.getSupertypes()} - * method. - * - * @return supertypes - * @throws RemoteException on RMI errors - */ - RemoteNodeType[] getSupertypes() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#getDeclaredSupertypes() NodeType.getDeclaredSupertypes()} - * method. - * - * @return declared supertypes - * @throws RemoteException on RMI errors - */ - RemoteNodeType[] getDeclaredSupertypes() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#isNodeType(String) NodeType.isNodeType(String)} - * method. - * - * @param type node type name - * @return true if this node type is or extends the - * given node type, false otherwise - * @throws RemoteException on RMI errors - */ - boolean isNodeType(String type) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#getPropertyDefinitions() NodeType.getPropertyDefinitions()} - * method. - * - * @return property definitions - * @throws RemoteException on RMI errors - */ - RemotePropertyDefinition[] getPropertyDefs() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#getDeclaredPropertyDefinitions() NodeType.getDeclaredPropertyDefinitions()} - * method. - * - * @return declared property definitions - * @throws RemoteException on RMI errors - */ - RemotePropertyDefinition[] getDeclaredPropertyDefs() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#getChildNodeDefinitions() NodeType.getChildNodeDefinitions()} - * method. - * - * @return child node definitions - * @throws RemoteException on RMI errors - */ - RemoteNodeDefinition[] getChildNodeDefs() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#getDeclaredChildNodeDefinitions() NodeType.getDeclaredChildNodeDefinitions()} - * method. - * - * @return declared child node definitions - * @throws RemoteException on RMI errors - */ - RemoteNodeDefinition[] getDeclaredChildNodeDefs() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#canSetProperty(String,Value) NodeType.canSetProperty(String,Value)} - * method. - * - * @param name property name - * @param value property value - * @return true if the property can be set, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean canSetProperty(String name, Value value) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#canSetProperty(String,Value[]) NodeType.canSetProperty(String,Value[])} - * method. - * - * @param name property name - * @param values property values - * @return true if the property can be set, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean canSetProperty(String name, Value[] values) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#canAddChildNode(String) NodeType.canAddChildNode(String)} - * method. - * - * @param name child node name - * @return true if the child node can be added, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean canAddChildNode(String name) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#canAddChildNode(String,String) NodeType.canAddChildNode(String,String)} - * method. - * - * @param name child node name - * @param type child node type - * @return true if the child node can be added, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean canAddChildNode(String name, String type) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#canRemoveItem(String) NodeType.canRemoveItem(String)} - * method. - * - * @param name item name - * @return true if the item can be removed, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean canRemoveItem(String name) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#getPrimaryItemName() NodeType.getPrimaryItemName()} - * method. - * - * @return primary item name - * @throws RemoteException on RMI errors - */ - String getPrimaryItemName() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#canRemoveNode(String) NodeType.canRemoveNode()} - * method. - * - * @return boolean - * @throws RemoteException on RMI errors - */ - boolean canRemoveNode(String nodeName) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#canRemoveProperty(String) NodeType.canRemoveProperty()} - * method. - * - * @return boolean - * @throws RemoteException on RMI errors - */ - boolean canRemoveProperty(String propertyName) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#getDeclaredSupertypeNames() NodeType.getDeclaredSupertypeNames()} - * method. - * - * @return a String[] - * @throws RemoteException on RMI errors - */ - String[] getDeclaredSupertypeNames() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#isQueryable() NodeType.isQueryable()} - * method. - * - * @return boolean - * @throws RemoteException on RMI errors - */ - boolean isQueryable() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#getDeclaredSubtypes() NodeType.getDeclaredSubtypes()} - * method. - * - * @return RemoteIterator - * @throws RemoteException on RMI errors - */ - RemoteIterator getDeclaredSubtypes() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeType#getSubtypes() NodeType.getSubtypes()} - * method. - * - * @return RemoteIterator - * @throws RemoteException on RMI errors - */ - RemoteIterator getSubtypes() throws RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNodeTypeManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNodeTypeManager.java deleted file mode 100644 index 6f21d595143..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNodeTypeManager.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -/** - * Remote version of the JCR - * {@link javax.jcr.nodetype.NodeTypeManager NodeTypeManager} interface. - * Used by the - * {@link org.apache.jackrabbit.rmi.server.ServerNodeTypeManager ServerNodeTypeManager} - * and - * {@link org.apache.jackrabbit.rmi.client.ClientNodeTypeManager ClientNodeTypeManager} - * adapters to provide transparent RMI access to remote node type managers. - *

- * The methods in this interface are documented only with a reference - * to a corresponding NodeTypeManager method. The remote object will - * simply forward the method call to the underlying NodeTypeManager instance. - * Arguments and possible exceptions are copied over the network. Complex - * {@link javax.jcr.nodetype.NodeType NodeType} values are returned as - * remote references to the - * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeType RemoteNodeType} - * interface. Iterator values are transmitted as object arrays. RMI errors - * are signaled with RemoteExceptions. - * - * @see javax.jcr.nodetype.NodeTypeManager - * @see org.apache.jackrabbit.rmi.client.ClientNodeTypeManager - * @see org.apache.jackrabbit.rmi.server.ServerNodeTypeManager - */ -public interface RemoteNodeTypeManager extends Remote { - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeTypeManager#getNodeType(String) NodeTypeManager.getNodeType(String)} - * method. - * - * @param name node type name - * @return node type - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNodeType getNodeType(String name) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeTypeManager#getAllNodeTypes() NodeTypeManager.getAllNodeTypes()} - * method. - * - * @return all node types - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getAllNodeTypes() - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeTypeManager#getPrimaryNodeTypes() NodeTypeManager.getPrimaryNodeTypes()} - * method. - * - * @return primary node types - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getPrimaryNodeTypes() - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.NodeTypeManager#getMixinNodeTypes() NodeTypeManager.getMixinNodeTypes()} - * method. - * - * @return mixin node types - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getMixinNodeTypes() - throws RepositoryException, RemoteException; - - boolean hasNodeType(String name) - throws RepositoryException, RemoteException; - - void unregisterNodeTypes(String[] names) - throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteObservationManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteObservationManager.java deleted file mode 100644 index fcd36000053..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteObservationManager.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -/** - * Remote version of the JCR {@link javax.jcr.observation.ObservationManager ObservationManager} - * interface. Used by the - * {@link org.apache.jackrabbit.rmi.server.ServerObservationManager ServerObservationManager} - * and - * {@link org.apache.jackrabbit.rmi.client.ClientObservationManager ClientObservationManager} - * adapter base classes to provide transparent RMI access to remote observation - * managers. - *

- * See the observation - * package comment for a description on how event listener registration and - * notification is implemented. - * - * @see javax.jcr.observation.ObservationManager - * @see org.apache.jackrabbit.rmi.client.ClientObservationManager - * @see org.apache.jackrabbit.rmi.server.ServerObservationManager - */ -public interface RemoteObservationManager extends Remote { - - /** - * Remote version of the - * {@link javax.jcr.observation.ObservationManager#addEventListener(javax.jcr.observation.EventListener, int, String, boolean, String[], String[], boolean) ObservationManager.addEventListener()} - * method. See class comment for an explanation on how the - * listenerId is used. - * - * @param listenerId The identification of the listener on the client - * side to which events will be directed. - * @param eventTypes The mask of event types to be sent to this listener. - * @param absPath The root item defining a subtree for which events are to - * be delivered. - * @param isDeep true if the events from the complete subtree - * rooted at absPath are to be sent or only for the item - * at the given path. - * @param uuid An optional list of node UUIDs for which events are to be - * sent. If null this parameter is ignored. - * @param nodeTypeName An optional list of node type names for which events - * are to be sent. If null this parameter is ignored. - * @param noLocal true if only events are to be sent which do - * not originate from the session to which this instance belongs. - * - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void addEventListener(long listenerId, int eventTypes, - String absPath, boolean isDeep, String[] uuid, - String[] nodeTypeName, boolean noLocal) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.observation.ObservationManager#removeEventListener(javax.jcr.observation.EventListener) ObservationManager.removeEventListener()} - * method. See class comment for an explanation on how the - * listenerId is used. - * - * @param listenerId The identification of the listener on the client - * side to which events will be directed. - * - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void removeEventListener(long listenerId) - throws RepositoryException, RemoteException; - - /** - * Returns the next event to be dispatched to registered event listeners. If - * no event is available, this method blocks until one is available or until - * the given timeout expires. - * - * @param timeout The time in milliseconds to wait for the next event - * available to be dispatched. If negative or zero, this method waits - * for ever. - * - * @return The {@link RemoteEventCollection} to be dispatched. null is - * returned if the method timed out waiting for an event to be - * dispatched. - * - * @throws RemoteException on RMI errors - */ - RemoteEventCollection getNextEvent(long timeout) - throws RemoteException; -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteProperty.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteProperty.java deleted file mode 100644 index b760627b8a5..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteProperty.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.Value; - -/** - * Remote version of the JCR {@link javax.jcr.Property Property} interface. - * Used by the - * {@link org.apache.jackrabbit.rmi.server.ServerProperty ServerProperty} - * and {@link org.apache.jackrabbit.rmi.client.ClientProperty ClientProperty} - * adapters to provide transparent RMI access to remote properties. - *

- * The methods in this interface are documented only with a reference - * to a corresponding Property method. The remote object will simply forward - * the method call to the underlying Property instance. Argument and return - * values, as well as possible exceptions, are copied over the network. - * Complex {@link javax.jcr.nodetype.PropertyDefinition PropertyDef} return values - * are returned as remote references to the corresponding - * {@link org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition RemotePropertyDefinition} - * interface. RMI errors are signaled with RemoteExceptions. - *

- * Note that only the generic getValue and setValue methods are included - * in this interface. Clients should implement the type-specific value - * getters and setters wrapping using the generic methods. Note also that the - * Value objects must be serializable and implemented using classes - * available on both the client and server side. The - * {@link org.apache.jackrabbit.rmi.value.SerialValueFactory SerialValueFactory} - * class provides two convenience methods to satisfy these requirements. - * - * @see javax.jcr.Property - * @see org.apache.jackrabbit.rmi.client.ClientProperty - * @see org.apache.jackrabbit.rmi.server.ServerProperty - */ -public interface RemoteProperty extends RemoteItem { - - /** - * Remote version of the - * {@link javax.jcr.Property#getValue() Property.getValue()} method. - * - * @return property value - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - Value getValue() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Property#getValues() Property.getValues()} method. - * - * @return property values - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - Value[] getValues() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Property#setValue(Value) Property.setValue(Value)} - * method. - * - * @param value property value - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void setValue(Value value) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Property#setValue(Value[]) Property.setValue(Value[])} - * method. - * - * @param values property values - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void setValue(Value[] values) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Property#getLength() Property.getLength()} - * method. - * - * @return value length - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - long getLength() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Property#getLengths() Property.getLengths()} - * method. - * - * @return value lengths - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - long[] getLengths() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Property#getDefinition() Property.getDefinition()} - * method. - * - * @return property definition - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemotePropertyDefinition getDefinition() - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Property#getType() Property.getType()} method. - * - * @return property type - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - int getType() throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemotePropertyDefinition.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemotePropertyDefinition.java deleted file mode 100644 index 3219b156953..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemotePropertyDefinition.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.RemoteException; - -import javax.jcr.Value; - -/** - * Remote version of the JCR {@link javax.jcr.nodetype.PropertyDefinition PropertyDefinition} - * interface. Used by the - * {@link org.apache.jackrabbit.rmi.server.ServerPropertyDefinition ServerPropertyDefinition} - * and - * {@link org.apache.jackrabbit.rmi.client.ClientPropertyDefinition ClientPropertyDefinition} - * adapters to provide transparent RMI access to remote property definitions. - *

- * The methods in this interface are documented only with a reference - * to a corresponding PropertyDef method. The remote object will simply - * forward the method call to the underlying PropertyDef instance. Return - * values and possible exceptions are copied over the network. RMI errors - * are signaled with RemoteExceptions. - *

- * Note that the returned Value objects must be serializable and implemented - * using classes available on both the client and server side. The - * {@link org.apache.jackrabbit.rmi.value.SerialValueFactory SerialValueFactory} - * class provides two convenience methods to satisfy this requirement. - * - * @see javax.jcr.nodetype.PropertyDefinition - * @see org.apache.jackrabbit.rmi.client.ClientPropertyDefinition - * @see org.apache.jackrabbit.rmi.server.ServerPropertyDefinition - */ -public interface RemotePropertyDefinition extends RemoteItemDefinition { - - /** - * Remote version of the - * {@link javax.jcr.nodetype.PropertyDefinition#getRequiredType() PropertyDefinition.getRequiredType()} - * method. - * - * @return required type - * @throws RemoteException on RMI errors - */ - int getRequiredType() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.PropertyDefinition#getValueConstraints() PropertyDefinition.getValueConstraints()} - * method. - * - * @return value constraints - * @throws RemoteException on RMI errors - */ - String[] getValueConstraints() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.PropertyDefinition#getDefaultValues() PropertyDefinition.getDefaultValues()} - * method. - * - * @return default values - * @throws RemoteException on RMI errors - */ - Value[] getDefaultValues() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.PropertyDefinition#isMultiple() PropertyDefinition.isMultiple()} - * method. - * - * @return true if the property is multi-valued, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean isMultiple() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.PropertyDefinition#getAvailableQueryOperators() PropertyDefinition.getAvailableQueryOperators()} - * method. - * - * @return a String[] - * @throws RemoteException on RMI errors - */ - String[] getAvailableQueryOperators() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.PropertyDefinition#isFullTextSearchable() PropertyDefinition.isFullTextSearchable()} - * method. - * - * @return a boolean - * @throws RemoteException on RMI errors - */ - boolean isFullTextSearchable() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.nodetype.PropertyDefinition#isQueryOrderable() PropertyDefinition.isQueryOrderable()} - * method. - * - * @return a boolean - * @throws RemoteException on RMI errors - */ - boolean isQueryOrderable() throws RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteQuery.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteQuery.java deleted file mode 100644 index 0a9c37c6c0d..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteQuery.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.Value; - -/** - * Remote version of the JCR {@link javax.jcr.query.Query Query} interface. - * Used by the {@link org.apache.jackrabbit.rmi.server.ServerQuery ServerQuery} - * and {@link org.apache.jackrabbit.rmi.client.ClientQuery ClientQuery} - * adapter base classes to provide transparent RMI access to remote items. - *

- * RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.query.Query - * @see org.apache.jackrabbit.rmi.client.ClientQuery - * @see org.apache.jackrabbit.rmi.server.ServerQuery - */ -public interface RemoteQuery extends Remote { - - /** - * @see javax.jcr.query.Query#execute() - * - * @return a QueryResult - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteQueryResult execute() throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.Query#setLimit(long) - * - * @param limit a long - * @throws RemoteException on RMI errors - */ - void setLimit(long limit) throws RemoteException; - - /** - * @see javax.jcr.query.Query#setOffset(long) - * - * @param offset a long - * @throws RemoteException on RMI errors - */ - void setOffset(long offset) throws RemoteException; - - /** - * @see javax.jcr.query.Query#getStatement() - * - * @return the query statement. - * @throws RemoteException on RMI errors - */ - String getStatement() throws RemoteException; - - /** - * @see javax.jcr.query.Query#getLanguage() - * - * @return the query language. - * @throws RemoteException on RMI errors - */ - String getLanguage() throws RemoteException; - - /** - * @see javax.jcr.query.Query#getStoredQueryPath() - * - * @return path of the node representing this query. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getStoredQueryPath() throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.Query#storeAsNode(String) - * - * @param absPath path at which to persist this query. - * @return stored node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode storeAsNode(String absPath) throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.Query#bindValue(String, Value) - * - * @param varName name of variable in query - * @param value value to bind - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void bindValue(String varName, Value value) throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.Query#getBindVariableNames() - * - * @return the names of the bind variables in this query. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - public String[] getBindVariableNames() throws RepositoryException, RemoteException; -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteQueryManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteQueryManager.java deleted file mode 100644 index da672ec3ed7..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteQueryManager.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.query.Query; - -/** - * Remote version of the JCR {@link javax.jcr.query.QueryManager QueryManager} interface. - * Used by the {@link org.apache.jackrabbit.rmi.server.ServerQueryManager ServerQueryManager} - * and {@link org.apache.jackrabbit.rmi.client.ClientQueryManager ClientQueryManager} - * adapter base classes to provide transparent RMI access to remote items. - *

- * RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.query.QueryManager - * @see org.apache.jackrabbit.rmi.client.ClientQueryManager - * @see org.apache.jackrabbit.rmi.server.ServerQueryManager - */ -public interface RemoteQueryManager extends Remote { - - /** - * @see javax.jcr.query.QueryManager#createQuery - * - * @param statement query statement - * @param language query language - * @return query - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteQuery createQuery(String statement, String language) - throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.QueryManager#getQuery - * - * @param absPath node path of a persisted query (that is, a node of type nt:query). - * @return a Query object. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteQuery getQuery(String absPath) - throws RepositoryException, RemoteException; - - /** - * See {@link Query}. - * - * @see javax.jcr.query.QueryManager#getSupportedQueryLanguages - * @return An string array. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String[] getSupportedQueryLanguages() - throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteQueryResult.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteQueryResult.java deleted file mode 100644 index 5fe8691c5e9..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteQueryResult.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -/** - * Remote version of the JCR {@link javax.jcr.query.QueryResult QueryResult} interface. - * Used by the {@link org.apache.jackrabbit.rmi.server.ServerQueryResult ServerQueryResult} - * and {@link org.apache.jackrabbit.rmi.client.ClientQueryResult ClientQueryResult} - * adapter base classes to provide transparent RMI access to remote items. - *

- * RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.query.QueryResult - * @see org.apache.jackrabbit.rmi.client.ClientQueryResult - * @see org.apache.jackrabbit.rmi.server.ServerQueryResult - */ -public interface RemoteQueryResult extends Remote { - /** - * @see javax.jcr.query.QueryResult#getColumnNames() - * - * @return a PropertyIterator - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String[] getColumnNames() throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.QueryResult#getRows() - * - * @return a RowIterator - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getRows() throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.QueryResult#getNodes() - * - * @return a remote node iterator - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteIterator getNodes() throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.QueryResult#getSelectorNames() - * - * @return a String array holding the selector names. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - public String[] getSelectorNames() throws RepositoryException, RemoteException; -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteRepository.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteRepository.java deleted file mode 100644 index 93b5ac6be20..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteRepository.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.Credentials; -import javax.jcr.RepositoryException; -import javax.jcr.Value; - -/** - * Remote version of the JCR {@link javax.jcr.Repository Repository} interface. - * Used by the - * {@link org.apache.jackrabbit.rmi.server.ServerRepository ServerRepository} - * and - * {@link org.apache.jackrabbit.rmi.client.ClientRepository ClientRepository} - * adapters to provide transparent RMI access to remote repositories. -*

- * The methods in this interface are documented only with a reference - * to a corresponding Repository method. The remote object will simply - * forward the method call to the underlying Repository instance. - * {@link javax.jcr.Session Session} objects are returned as remote references - * to the {@link RemoteSession RemoteSession} interface. Simple return - * values and possible exceptions are copied over the network to the client. - * RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.Repository - * @see org.apache.jackrabbit.rmi.client.ClientRepository - * @see org.apache.jackrabbit.rmi.server.ServerRepository - */ -public interface RemoteRepository extends Remote { - - /** - * Remote version of the - * {@link javax.jcr.Repository#getDescriptor(String) Repository.getDescriptor(String)} - * method. - * - * @param key descriptor key - * @return descriptor value - * @throws RemoteException on RMI errors - */ - String getDescriptor(String key) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Repository#getDescriptorKeys() Repository.getDescriptorKeys()} - * method. - * - * @return descriptor keys - * @throws RemoteException on RMI errors - */ - String[] getDescriptorKeys() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Repository#login() Repository.login(}} method. - * - * @return remote session - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteSession login() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Repository#login(String) Repository.login(String}} - * method. - * - * @param workspace workspace name - * @return remote session - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteSession login(String workspace) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Repository#login(Credentials) Repository.login(Credentials}} - * method. - * - * @param credentials client credentials - * @return remote session - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteSession login(Credentials credentials) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Repository#login(Credentials,String) Repository.login(Credentials,String}} - * method. - * - * @param credentials client credentials - * @param workspace workspace name - * @return remote session - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteSession login(Credentials credentials, String workspace) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Repository#getDescriptorValue(String) Repository.getDescriptorValue(String)} - * method. - * - * @return descriptor value - * @throws RemoteException on RMI errors - */ - Value getDescriptorValue(String key) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Repository#getDescriptorValues(String) Repository.getDescriptorValues(String)} - * method. - * - * @return descriptor value array - * @throws RemoteException on RMI errors - */ - Value[] getDescriptorValues(String key) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Repository#isSingleValueDescriptor(String) Repository.isSingleValueDescriptor(String)} - * method. - * - * @return boolean - * @throws RemoteException on RMI errors - */ - boolean isSingleValueDescriptor(String key) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Repository#isStandardDescriptor(String) Repository.isStandardDescriptor(String)} - * method. - * - * @return boolean - * @throws RemoteException on RMI errors - */ - boolean isStandardDescriptor(String key) throws RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteRow.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteRow.java deleted file mode 100644 index 0aa8365d126..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteRow.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.Value; - -/** - * Remote version of the JCR {@link javax.jcr.query.Row Row} interface. - * Used by the {@link org.apache.jackrabbit.rmi.server.ServerRow ServerRow} - * and {@link org.apache.jackrabbit.rmi.client.ClientRow ClientRow} - * adapter base classes to provide transparent RMI access to remote items. - *

- * RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.query.Row - * @see org.apache.jackrabbit.rmi.client.ClientRow - * @see org.apache.jackrabbit.rmi.server.ServerRow - */ -public interface RemoteRow extends Remote { - - /** - * @see javax.jcr.query.Row#getValues() - * - * @return row values - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - Value[] getValues() throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.Row#getValue(String) - * - * @param propertyName property name - * @return identified value - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - Value getValue(String propertyName) - throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.Row#getNode() - * - * @return a node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode getNode() throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.Row#getNode(String) - * - * @param selectorName - * @return a node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode getNode(String selectorName) throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.Row#getPath() - * - * @return the path - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getPath() throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.Row#getPath(String) - * - * @param selectorName - * @return the path - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getPath(String selectorName) throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.Row#getScore() - * - * @return the score - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - double getScore() throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.query.Row#getScore(String) - * - * @param selectorName - * @return the score - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - double getScore(String selectorName) throws RepositoryException, RemoteException; -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java deleted file mode 100644 index 7edce7929ab..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java +++ /dev/null @@ -1,462 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.io.IOException; -import java.rmi.Remote; -import java.rmi.RemoteException; -import javax.jcr.Credentials; -import javax.jcr.RepositoryException; -import javax.jcr.UnsupportedRepositoryOperationException; - -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager; - -/** - * Remote version of the JCR {@link javax.jcr.Session Session} interface. - * Used by the - * {@link org.apache.jackrabbit.rmi.server.ServerSession ServerSession} - * and - * {@link org.apache.jackrabbit.rmi.client.ClientSession ClientSession} - * adapters to provide transparent RMI access to remote sessions. - *

- * Most of the methods in this interface are documented only with a reference - * to a corresponding Session method. In these cases the remote object - * will simply forward the method call to the underlying Session instance. - * Complex return values like workspaces and other objects are returned - * as remote references to the corresponding remote interface. Simple - * return values and possible exceptions are simply copied over the network - * to the client. RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.Session - * @see org.apache.jackrabbit.rmi.client.ClientSession - * @see org.apache.jackrabbit.rmi.server.ServerSession - */ -public interface RemoteSession extends Remote { - - /** - * Remote version of the - * {@link javax.jcr.Session#getUserID() Session.getUserID()} method. - * - * @return user id - * @throws RemoteException on RMI errors - * @see javax.jcr.Session#getUserID() - */ - String getUserID() throws RemoteException; - - /** - * Returns the named attribute. Note that only serializable - * attribute values can be transmitted over the network and that - * the client should have (or be able to fetch) the object class - * to access the returned value. Failures to meet these conditions - * are signalled with RemoteExceptions. - * - * @param name attribute name - * @return attribute value - * @throws RemoteException on RMI errors - * @see javax.jcr.Session#getAttribute(java.lang.String) - */ - Object getAttribute(String name) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getAttributeNames() Session.getAttributeNames()} - * method. - * - * @return attribute names - * @throws RemoteException on RMI errors - */ - String[] getAttributeNames() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getWorkspace() Session.getWorkspace()} method. - * - * @return workspace - * @see javax.jcr.Session#getWorkspace() - * @throws RemoteException on RMI errors - */ - RemoteWorkspace getWorkspace() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#impersonate(Credentials) Session.impersonate(Credentials)} - * method. - * - * @param credentials credentials for the new session - * @return new session - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteSession impersonate(Credentials credentials) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getNodeByIdentifier(String) Session.getNodeByIdentifier(String)} - * method. - * - * @param id node identifier - * @return node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode getNodeByIdentifier(String id) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getNodeByUUID(String) Session.getNodeByUUID(String)} - * method. - * - * @param uuid node uuid - * @return node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode getNodeByUUID(String uuid) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getItem(String) Session.getItem(String)} - * method. - * - * @param path item path - * @return item - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteItem getItem(String path) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getNode(String) Session.getNode(String)} - * method. - * - * @param path node path - * @return node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode getNode(String path) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getProperty(String) Session.getProperty(String)} - * method. - * - * @param path property path - * @return property - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteProperty getProperty(String path) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#itemExists(String) Session.itemExists(String)} - * method. - * - * @param path item path - * @return true if the item exists, - * false otherwise - * @throws RepositoryException on repository exception - * @throws RemoteException on RMI errors - */ - boolean itemExists(String path) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#nodeExists(String) Session.nodeExists(String)} - * method. - * - * @param path node path - * @return true if the node exists, - * false otherwise - * @throws RepositoryException on repository exception - * @throws RemoteException on RMI errors - */ - boolean nodeExists(String path) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#propertyExists(String) Session.propertyExists(String)} - * method. - * - * @param path property path - * @return true if the property exists, - * false otherwise - * @throws RepositoryException on repository exception - * @throws RemoteException on RMI errors - */ - boolean propertyExists(String path) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#removeItem(String) Session.removeItem(String)} - * method. - * - * @param path item path - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void removeItem(String path) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#move(String,String) Session.move(String,String)} - * method. - * - * @param from source path - * @param to destination path - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void move(String from, String to) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#save() Session.save()} method. - * - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void save() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#refresh(boolean) Session.refresh(boolean)} - * method. - * - * @param keepChanges flag to keep transient changes - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void refresh(boolean keepChanges) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#logout() Session.logout()} - * method. - * - * @throws RemoteException on RMI errors - */ - void logout() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#isLive() Session.isLive()} - * method. - * - * @return true if the session is live, - * false otherwise - * @throws RemoteException on RMI errors - */ - boolean isLive() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getRootNode() Session.getRootNode()} method. - * - * @return root node - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode getRootNode() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#hasPendingChanges() Session.hasPendingChanges()} - * method. - * - * @return true if the session has pending changes, - * false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean hasPendingChanges() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#hasPermission(String,String) Session.hasPermission(String,String)} - * method. - * - * @param path item path - * @param actions actions - * @return true if permission is granted, - * false otherwise - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean hasPermission(String path, String actions) - throws RepositoryException, RemoteException; - - /** - * Imports the system or document view XML data into a subtree of - * the identified node. Note that the entire XML stream is transferred - * as a single byte array over the network. This may cause problems with - * large XML streams. The remote server will wrap the XML data into - * a {@link java.io.ByteArrayInputStream ByteArrayInputStream} and feed - * it to the normal importXML method. - * - * @param path node path - * @param xml imported XML document - * @param uuidBehaviour UUID handling mode - * @throws IOException on IO errors - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - * @see javax.jcr.Session#importXML(java.lang.String, java.io.InputStream, int) - */ - void importXML(String path, byte[] xml, int uuidBehaviour) - throws IOException, RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#setNamespacePrefix(String,String) Session.setNamespacePrefix(String,String)} - * method. - * - * @param prefix namespace prefix - * @param uri namespace uri - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void setNamespacePrefix(String prefix, String uri) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getNamespacePrefixes() Session.getNamespacePrefixes()} - * method. - * - * @return namespace prefixes - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String[] getNamespacePrefixes() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getNamespaceURI(String) Session.getNamespaceURI(String)} - * method. - * - * @param prefix namespace prefix - * @return namespace uri - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getNamespaceURI(String prefix) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getNamespacePrefix(String) Session.getNamespacePrefix(String)} - * method. - * - * @param uri namespace uri - * @return namespace prefix - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String getNamespacePrefix(String uri) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#addLockToken(String) Session.addLockToken(String)} - * method. - * - * @param name lock token - * @throws RemoteException on RMI errors - */ - void addLockToken(String name) throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#getLockTokens() Session.getLockTokens()} - * method. - * - * @return lock tokens - * @throws RemoteException on RMI errors - */ - String[] getLockTokens() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Session#removeLockToken(String) Session.removeLockToken(String)} - * method. - * - * @param name lock token - * @throws RemoteException on RMI errors - */ - void removeLockToken(String name) throws RemoteException; - - /** - * Exports the identified repository subtree as a system view XML - * stream. Note that the entire XML stream is transferred as a - * single byte array over the network. This may cause problems with - * large exports. The remote server uses a - * {@link java.io.ByteArrayOutputStream ByteArrayOutputStream} to capture - * the XML data written by the normal exportSysView method. - * - * @param path node path - * @param skipBinary binary skip flag - * @param noRecurse no recursion flag - * @return exported XML document - * @throws IOException on IO errors - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - * @see javax.jcr.Session#exportSystemView - */ - byte[] exportSystemView(String path, boolean skipBinary, boolean noRecurse) - throws IOException, RepositoryException, RemoteException; - - /** - * Exports the identified repository subtree as a document view XML - * stream. Note that the entire XML stream is transferred as a - * single byte array over the network. This may cause problems with - * large exports. The remote server uses a - * {@link java.io.ByteArrayOutputStream ByteArrayOutputStream} to capture - * the XML data written by the normal exportDocView method. - * - * @param path node path - * @param skipBinary skip binary flag - * @param noRecurse no recursion flag - * @return exported XML document - * @throws IOException on IO errors - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - * @see javax.jcr.Session#exportDocumentView - */ - byte[] exportDocumentView(String path, boolean skipBinary, boolean noRecurse) - throws IOException, RepositoryException, RemoteException; - - /** - * Remote version of the {@link javax.jcr.Session#getAccessControlManager() - * Session.getAccessControlManager()} method. - * - * @throws UnsupportedRepositoryOperationException if the remote session - * does not support this method - * @throws RepositoryException if an error occurred getting the access - * control manager - * @throws RemoteException on RMI errors - */ - RemoteAccessControlManager getAccessControlManager() - throws UnsupportedRepositoryOperationException, - RepositoryException, RemoteException; -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteVersion.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteVersion.java deleted file mode 100644 index 5598fa2c225..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteVersion.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.RemoteException; -import java.util.Calendar; - -import javax.jcr.RepositoryException; - -/** - * Remote version of the JCR {@link javax.jcr.version.Version Version} interface. - * Used by the {@link org.apache.jackrabbit.rmi.server.ServerVersion ServerVersion} - * and {@link org.apache.jackrabbit.rmi.client.ClientVersion ClientVersion} - * adapters to provide transparent RMI access to remote versions. - *

- * The methods in this interface are documented only with a reference - * to a corresponding Version method. The remote object will simply forward - * the method call to the underlying Version instance. Argument and return - * values, as well as possible exceptions, are copied over the network. - * Complex return values (like Versions) are returned as remote - * references to the corresponding remote interfaces. Iterator values - * are transmitted as object arrays. RMI errors are signaled with - * RemoteExceptions. - * - * @see javax.jcr.version.Version - * @see org.apache.jackrabbit.rmi.client.ClientVersion - * @see org.apache.jackrabbit.rmi.server.ServerVersion - */ -public interface RemoteVersion extends RemoteNode { - - /** - * Remote version of the - * {@link javax.jcr.version.Version#getContainingHistory() Version.getContainingHistory()} method. - * - * @return a RemoteVersionHistory object. - * - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteVersionHistory getContainingHistory() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.Version#getCreated() Version.getCreated()} method. - * - * @return a Calendar object. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - Calendar getCreated() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.Version#getLinearSuccessor() Version.getLinearSuccessor()} method. - * - * @return a RemoteVersion or null if no linear - * successor exists. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - * @see RemoteVersionHistory#getAllLinearVersions - */ - RemoteVersion getLinearSuccessor() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.Version#getSuccessors() Version.getSuccessors()} method. - * - * @return a RemoteVersion array. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteVersion[] getSuccessors() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.Version#getLinearPredecessor() Version.getLinearPredecessor()} method. - * - * @return a RemoteVersion or null if no linear - * predecessor exists. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - * @see RemoteVersionHistory#getAllLinearVersions - */ - RemoteVersion getLinearPredecessor() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.Version#getPredecessors() Version.getPredecessors()} method. - * - * @return a RemoteVersion array. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteVersion[] getPredecessors() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.Version#getFrozenNode() Version.getFrozenNode()} method. - * - * @return a RemoteNode object. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNode getFrozenNode() throws RepositoryException, RemoteException; -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteVersionHistory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteVersionHistory.java deleted file mode 100644 index 6bcc0ef58c9..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteVersionHistory.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -/** - * Remote version of the JC - * {@link javax.jcr.version.VersionHistory VersionHistory} interface. Used by - * the - * {@link org.apache.jackrabbit.rmi.server.ServerVersionHistory ServerVersionHistory} - * and - * {@link org.apache.jackrabbit.rmi.client.ClientVersionHistory ClientVersionHistory} - * adapters to provide transparent RMI access to remote version histories. - *

- * The methods in this interface are documented only with a reference - * to a corresponding VersionHistory method. The remote object will simply - * forward the method call to the underlying VersionHistory instance. Argument - * and return values, as well as possible exceptions, are copied over the - * network. Complex return values (like Versions) are returned as remote - * references to the corresponding remote interfaces. Iterator values - * are transmitted as object arrays. RMI errors are signaled with - * RemoteExceptions. - * - * @see javax.jcr.version.Version - * @see org.apache.jackrabbit.rmi.client.ClientVersionHistory - * @see org.apache.jackrabbit.rmi.server.ServerVersionHistory - */ -public interface RemoteVersionHistory extends RemoteNode { - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#getVersionableUUID()} VersionHistory.getVersionableUUID()} - * method. - * - * @return the uuid of the versionable node - * @throws RepositoryException if an error occurs. - * @throws RemoteException on RMI errors - * @deprecated As of JCR 2.0, {@link #getVersionableIdentifier} should be - * used instead. - */ - String getVersionableUUID() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#getVersionableIdentifier()} VersionHistory.getVersionableIdentifier()} - * method. - * - * @return the identifier of the versionable node - * @throws RepositoryException if an error occurs. - * @throws RemoteException on RMI errors - */ - String getVersionableIdentifier() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#getRootVersion() VersionHistory.getRootVersion()} - * method. - * - * @return a Version object. - * @throws RepositoryException if an error occurs. - * @throws RemoteException on RMI errors - */ - RemoteVersion getRootVersion() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#getAllLinearVersions() VersionHistory.getAllLinearVersions()} - * method. - * - * @return linear remote versions - * @throws RepositoryException if an error occurs. - * @throws RemoteException on RMI errors - */ - RemoteIterator getAllLinearVersions() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#getAllVersions() VersionHistory.getAllVersions()} - * method. - * - * @return remote versions - * @throws RepositoryException if an error occurs. - * @throws RemoteException on RMI errors - */ - RemoteIterator getAllVersions() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#getAllLinearFrozenNodes() VersionHistory.getAllLinearFrozenNodes()} - * method. - * - * @return linear remote frozen nodes - * @throws RepositoryException if an error occurs. - * @throws RemoteException on RMI errors - */ - RemoteIterator getAllLinearFrozenNodes() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#getAllFrozenNodes() VersionHistory.getAllFrozenNodes()} - * method. - * - * @return remote frozen nodes - * @throws RepositoryException if an error occurs. - * @throws RemoteException on RMI errors - */ - RemoteIterator getAllFrozenNodes() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#getVersion(String) VersionHistory.getVersion(String)} - * method. - * - * @param versionName a version name - * @return a Version object. - * @throws RepositoryException if an error occurs. - * @throws RemoteException on RMI errors - */ - RemoteVersion getVersion(String versionName) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#getVersionByLabel(String) VersionHistory.getVersionByLabel(String)} - * method. - * - * @param label a version label - * @return a Version object. - * @throws RepositoryException if an error occurs. - * @throws RemoteException on RMI errors - */ - RemoteVersion getVersionByLabel(String label) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#addVersionLabel(String, String, boolean) - * VersionHistory.addVersionLabel(String, String, boolean)} - * method. - * - * @param versionName the name of the version to which the label is to be added. - * @param label the label to be added. - * @param moveLabel if true, then if label is already assigned to a version in - * this version history, it is moved to the new version specified; if false, then attempting - * to assign an already used label will throw a VersionException. - * - * @throws RepositoryException if another error occurs. - * @throws RemoteException on RMI errors - */ - void addVersionLabel(String versionName, String label, boolean moveLabel) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#removeVersionLabel(String) VersionHistory.removeVersionLabel(String)} - * method. - * - * @param label a version label - * @throws RepositoryException if another error occurs. - * @throws RemoteException on RMI errors - */ - void removeVersionLabel(String label) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#hasVersionLabel(String) VersionHistory.hasVersionLabel(String)} - * method. - * - * @param label a version label - * @return a boolean - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean hasVersionLabel(String label) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#hasVersionLabel(javax.jcr.version.Version, String) hasVersionLabel(Version, String)} - * method. - * - * @param versionUUID The UUID of the version whose labels are to be returned. - * @param label a version label - * @return a boolean. - * @throws RepositoryException if another error occurs. - * @throws RemoteException on RMI errors - */ - boolean hasVersionLabel(String versionUUID, String label) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#getVersionLabels() VersionHistory.getVersionLabels()} - * method. - * - * @return a String array containing all the labels of the version history - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String[] getVersionLabels() throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#getVersionLabels(javax.jcr.version.Version) VersionHistory.getVersionLabels(Version)} - * method. - * - * @param versionUUID The UUID of the version whose labels are to be returned. - * @return a String array containing all the labels of the given version - * @throws RepositoryException if another error occurs. - * @throws RemoteException on RMI errors - */ - String[] getVersionLabels(String versionUUID) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionHistory#removeVersion(String) VersionHistory.removeVersion(String)} - * method. - * - * @param versionName the name of a version in this version history. - * @throws RepositoryException if another error occurs. - * @throws RemoteException on RMI errors - */ - void removeVersion(String versionName) - throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteVersionManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteVersionManager.java deleted file mode 100644 index 626be070ec7..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteVersionManager.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -public interface RemoteVersionManager extends Remote { - - /** - * Remote version of the - * {@link javax.jcr.version.VersionManager#checkin(String) VersionManager.checkin(String)} - * method. - * - * @param absPath an absolute path. - * @return the created version. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteVersion checkin(String absPath) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionManager#checkout(String) VersionManager.checkout(String)} - * method. - * - * @param absPath an absolute path. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void checkout(String absPath) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionManager#checkpoint(String) VersionManager.checkpoint(String)} - * method. - * - * @param absPath an absolute path. - * @return the created version. - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteVersion checkpoint(String absPath) throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.version.VersionManager#isCheckedOut(String) VersionManager.isCheckedOut(String)} - * method. - * - * @param absPath an absolute path. - * @return a boolean - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - boolean isCheckedOut(String absPath) throws RepositoryException, RemoteException; - - RemoteVersionHistory getVersionHistory(String absPath) throws RepositoryException, RemoteException; - - RemoteVersion getBaseVersion(String absPath) throws RepositoryException, RemoteException; - - void restore(String[] versionIdentifiers, boolean removeExisting) throws RepositoryException, RemoteException; - - void restore(String absPath, String versionName, boolean removeExisting) throws RepositoryException, RemoteException; - - void restore(String versionIdentifier, boolean removeExisting) throws RepositoryException, RemoteException; - - void restoreVI(String absPath, String versionIdentifier, boolean removeExisting) throws RepositoryException, RemoteException; - - void restoreByLabel(String absPath, String versionLabel, boolean removeExisting) throws RepositoryException, RemoteException; - - RemoteIterator merge(String absPath, String srcWorkspace, boolean bestEffort) - throws RepositoryException, RemoteException; - - RemoteIterator merge(String absPath, String srcWorkspace, boolean bestEffort, boolean isShallow) - throws RepositoryException, RemoteException; - - void doneMerge(String absPath, String versionIdentifier) throws RepositoryException, RemoteException; - - void cancelMerge(String absPath, String versionIdentifier) throws RepositoryException, RemoteException; - - RemoteNode createConfiguration(String absPath) throws RepositoryException, RemoteException; - - RemoteNode setActivity(String activityNodeIdentifier) throws RepositoryException, RemoteException; - - RemoteNode getActivity() throws RepositoryException, RemoteException; - - RemoteNode createActivity(String title) throws RepositoryException, RemoteException; - - void removeActivity(String activityNodeIdentifier) throws RepositoryException, RemoteException; - - RemoteIterator merge(String activityNodeIdentifier) throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteWorkspace.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteWorkspace.java deleted file mode 100644 index 078b20680cf..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteWorkspace.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.io.IOException; -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -/** - * Remote version of the JCR {@link javax.jcr.Workspace Workspace} interface. - * Used by the - * {@link org.apache.jackrabbit.rmi.server.ServerWorkspace ServerWorkspace} - * and - * {@link org.apache.jackrabbit.rmi.client.ClientWorkspace ClientWorkspace} - * adapters to provide transparent RMI access to remote workspaces. - *

- * Most of the methods in this interface are documented only with a reference - * to a corresponding Workspace method. In these cases the remote object - * will simply forward the method call to the underlying Workspace instance. - * Complex return values like namespace registries and other objects are - * returned as remote references to the corresponding remote interface. Simple - * return values and possible exceptions are copied over the network - * to the client. RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.Workspace - * @see org.apache.jackrabbit.rmi.client.ClientWorkspace - * @see org.apache.jackrabbit.rmi.server.ServerWorkspace - */ -public interface RemoteWorkspace extends Remote { - - /** - * Remote version of the - * {@link javax.jcr.Workspace#getName() Workspace.getName()} method. - * - * @return workspace name - * @throws RemoteException on RMI errors - */ - String getName() throws RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Workspace#copy(String,String) Workspace.copy(String,String)} - * method. - * - * @param from source path - * @param to destination path - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void copy(String from, String to) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Workspace#copy(String,String,String) Workspace.copy(String,String,String)} - * method. - * - * @param workspace source workspace - * @param from source path - * @param to destination path - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void copy(String workspace, String from, String to) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Workspace#clone(String,String,String,boolean) Workspace.clone(String,String,String,boolean)} - * method. - * - * @param workspace source workspace - * @param from source path - * @param to destination path - * @param removeExisting flag to remove existing items - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void clone(String workspace, String from, String to, boolean removeExisting) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Workspace#move(String,String) Workspace.move(String,String)} - * method. - * - * @param from source path - * @param to destination path - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void move(String from, String to) - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Workspace#getNodeTypeManager() Workspace.getNodeTypeManager()} - * method. - * - * @return node type manager - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNodeTypeManager getNodeTypeManager() - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Workspace#getNamespaceRegistry() Workspace.getNamespaceRegistry()} - * method. - * - * @return namespace registry - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteNamespaceRegistry getNamespaceRegistry() - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Workspace#getQueryManager() Workspace.getQueryManager()} - * method. - * - * @return query manager - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteQueryManager getQueryManager() - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Workspace#getObservationManager() Workspace.getObservationManager()} - * method. - * - * @return observation manager - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - RemoteObservationManager getObservationManager() - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Workspace#getAccessibleWorkspaceNames() Workspace.getAccessibleWorkspaceNames()} - * method. - * - * @return accessible workspace names - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - String[] getAccessibleWorkspaceNames() - throws RepositoryException, RemoteException; - - /** - * Remote version of the - * {@link javax.jcr.Workspace#importXML(String,java.io.InputStream,int) Workspace.importXML(String,InputStream,int)} - * method. - * - * @param path node path - * @param xml imported XML document - * @param uuidBehaviour uuid behaviour flag - * @throws IOException on IO errors - * @throws RepositoryException on repository errors - * @throws RemoteException on RMI errors - */ - void importXML(String path, byte[] xml, int uuidBehaviour) - throws IOException, RepositoryException, RemoteException; - - void createWorkspace(String name, String source) - throws RepositoryException, RemoteException; - - void deleteWorkspace(String name) - throws RepositoryException, RemoteException; - - RemoteLockManager getLockManager() - throws RepositoryException, RemoteException; - - RemoteVersionManager getVersionManager() - throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteXASession.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteXASession.java deleted file mode 100644 index b6f425faa01..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteXASession.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.transaction.xa.XAException; -import javax.transaction.xa.Xid; - -/** - * Remote version of the {@link org.apache.jackrabbit.api.XASession} - * interface. - */ -public interface RemoteXASession extends RemoteSession, Remote { - - /** - * Remote version of the - * {@link javax.transaction.xa.XAResource#commit(Xid, boolean)} method. - */ - void commit(Xid xid, boolean onePhase) throws XAException, RemoteException; - - /** - * Remote version of the - * {@link javax.transaction.xa.XAResource#end(Xid, int)} method. - */ - void end(Xid xid, int flags) throws XAException, RemoteException; - - /** - * Remote version of the - * {@link javax.transaction.xa.XAResource#forget(Xid)} method. - */ - void forget(Xid xid) throws XAException, RemoteException; - - /** - * Remote version of the - * {@link javax.transaction.xa.XAResource#getTransactionTimeout()} method. - */ - int getTransactionTimeout() throws XAException, RemoteException; - - /** - * Remote version of the - * {@link javax.transaction.xa.XAResource#prepare(Xid)} method. - */ - int prepare(Xid xid) throws XAException, RemoteException; - - /** - * Remote version of the - * {@link javax.transaction.xa.XAResource#recover(int)} method. - */ - Xid[] recover(int flag) throws XAException, RemoteException; - - /** - * Remote version of the - * {@link javax.transaction.xa.XAResource#rollback(Xid)} method. - */ - void rollback(Xid xid) throws XAException, RemoteException; - - /** - * Remote version of the - * {@link javax.transaction.xa.XAResource#setTransactionTimeout(int)} method. - */ - boolean setTransactionTimeout(int seconds) - throws XAException, RemoteException; - - /** - * Remote version of the - * {@link javax.transaction.xa.XAResource#start(Xid, int)} method. - */ - void start(Xid xid, int flags) throws XAException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/SerializableXid.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/SerializableXid.java deleted file mode 100644 index 83bd3524208..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/SerializableXid.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote; - -import java.io.Serializable; -import java.util.Arrays; - -import javax.transaction.xa.Xid; - -/** - * Serializable {@link Xid}. - * - * @since Jackrabbit JCR-RMI 1.5 - */ -public class SerializableXid implements Serializable, Xid { - - private final int formatId; - - private final byte[] globalTransactionId; - - private final byte[] branchQualifier; - - private final int hashCode; - - public SerializableXid(Xid xid) { - formatId = xid.getFormatId(); - globalTransactionId = xid.getGlobalTransactionId(); - branchQualifier = xid.getBranchQualifier(); - hashCode = xid.hashCode(); - } - - public int getFormatId() { - return formatId; - } - - public byte[] getGlobalTransactionId() { - return globalTransactionId; - } - - public byte[] getBranchQualifier() { - return branchQualifier; - } - - public int hashCode() { - return hashCode; - } - - public boolean equals(Object xid) { - return (xid instanceof Xid) - && formatId == ((Xid) xid).getFormatId() - && Arrays.equals( - globalTransactionId, ((Xid) xid).getGlobalTransactionId()) - && Arrays.equals( - branchQualifier, ((Xid) xid).getBranchQualifier()); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/package-info.java deleted file mode 100755 index 1292557dc2a..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.remote; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/RemoteGroup.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/RemoteGroup.java deleted file mode 100644 index ae3695396c0..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/RemoteGroup.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote.principal; - -import java.rmi.RemoteException; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; - -/** - * Remote version of the JCR {@link org.apache.jackrabbit.api.security.principal.GroupPrincipal GroupPrincipal} interface. - * Used by the {@link org.apache.jackrabbit.rmi.server.principal.ServerGroup - * ServerGroup} and - * {@link org.apache.jackrabbit.rmi.client.principal.ClientGroup ClientGroup} - * adapter base classes to provide transparent RMI access to remote item - * definitions. - *

- * The methods in this interface are documented only with a reference to a - * corresponding Group method. The remote object will simply forward the method - * call to the underlying Group instance. Argument and return values, as well as - * possible exceptions, are copied over the network. Complex return values are - * returned as remote references to the corresponding remote interface. RMI - * errors are signaled with RemoteExceptions. - * - * @see org.apache.jackrabbit.api.security.principal.GroupPrincipal - * @see org.apache.jackrabbit.rmi.client.principal.ClientGroup - * @see org.apache.jackrabbit.rmi.server.principal.ServerGroup - */ -public interface RemoteGroup extends RemotePrincipal { - - /** - * @see org.apache.jackrabbit.api.security.principal.GroupPrincipal#isMember(java.security.Principal) - */ - boolean isMember(String member) throws RemoteException; - - /** - * @see org.apache.jackrabbit.api.security.principal.GroupPrincipal#members() - */ - RemoteIterator members() throws RemoteException; - -} \ No newline at end of file diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/RemotePrincipal.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/RemotePrincipal.java deleted file mode 100644 index fb49911a9cd..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/RemotePrincipal.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote.principal; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -/** - * Remote version of the JCR {@link java.security.Principal Principal} - * interface. Used by the - * {@link org.apache.jackrabbit.rmi.server.principal.ServerPrincipal - * ServerPrincipal} and - * {@link org.apache.jackrabbit.rmi.client.principal.ClientPrincipal - * ClientPrincipal} adapter base classes to provide transparent RMI access to - * remote item definitions. - *

- * The methods in this interface are documented only with a reference to a - * corresponding Principal method. The remote object will simply forward the - * method call to the underlying Principal instance. Argument and return values, - * as well as possible exceptions, are copied over the network. Complex return - * values are returned as remote references to the corresponding remote - * interface. RMI errors are signaled with RemoteExceptions. - * - * @see java.security.Principal - * @see org.apache.jackrabbit.rmi.client.principal.ClientPrincipal - * @see org.apache.jackrabbit.rmi.server.principal.ServerPrincipal - */ -public interface RemotePrincipal extends Remote { - - /** - * @see java.security.Principal#getName() - */ - public String getName() throws RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/package-info.java deleted file mode 100755 index f7a35d50ae4..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.remote.principal; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlEntry.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlEntry.java deleted file mode 100644 index b02fb584060..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlEntry.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote.security; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal; - -/** - * Remote version of the JCR {@link javax.jcr.security.AccessControlEntry - * AccessControlEntry} interface. Used by the - * {@link org.apache.jackrabbit.rmi.server.security.ServerAccessControlEntry - * ServerAccessControlEntry} and - * {@link org.apache.jackrabbit.rmi.client.security.ClientAccessControlEntry - * ClientAccessControlEntry} adapter base classes to provide transparent RMI - * access to remote item definitions. - *

- * The methods in this interface are documented only with a reference to a - * corresponding AccessControlEntry method. The remote object will simply - * forward the method call to the underlying AccessControlEntry instance. - * Argument and return values, as well as possible exceptions, are copied over - * the network. Complex return values are returned as remote references to the - * corresponding remote interface. RMI errors are signaled with - * RemoteExceptions. - * - * @see javax.jcr.security.AccessControlEntry - * @see org.apache.jackrabbit.rmi.client.security.ClientAccessControlEntry - * @see org.apache.jackrabbit.rmi.server.security.ServerAccessControlEntry - */ -public interface RemoteAccessControlEntry extends Remote { - - /** - * @see javax.jcr.security.AccessControlEntry#getPrincipal() - */ - public RemotePrincipal getPrincipal() throws RemoteException; - - /** - * @see javax.jcr.security.AccessControlEntry#getPrivileges() - */ - public RemotePrivilege[] getPrivileges() throws RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlList.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlList.java deleted file mode 100644 index 12b15d4e553..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlList.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote.security; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -/** - * Remote version of the JCR {@link javax.jcr.security.AccessControlList - * AccessControlList} interface. Used by the - * {@link org.apache.jackrabbit.rmi.server.security.ServerAccessControlList - * ServerAccessControlList} and - * {@link org.apache.jackrabbit.rmi.client.security.ClientAccessControlList - * ClientAccessControlList} adapter base classes to provide transparent RMI - * access to remote item definitions. - *

- * The methods in this interface are documented only with a reference to a - * corresponding AccessControlList method. The remote object will simply forward - * the method call to the underlying AccessControlList instance. Argument and - * return values, as well as possible exceptions, are copied over the network. - * Complex return values are returned as remote references to the corresponding - * remote interface. RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.security.AccessControlList - * @see org.apache.jackrabbit.rmi.client.security.ClientAccessControlList - * @see org.apache.jackrabbit.rmi.server.security.ServerAccessControlList - */ -public interface RemoteAccessControlList extends RemoteAccessControlPolicy { - - /** - * @see javax.jcr.security.AccessControlList#getAccessControlEntries() - */ - public RemoteAccessControlEntry[] getAccessControlEntries() - throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlManager.java deleted file mode 100644 index bca2539f496..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlManager.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote.security; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; - -/** - * Remote version of the JCR {@link javax.jcr.security.AccessControlManager - * AccessControlManager} interface. Used by the - * {@link org.apache.jackrabbit.rmi.server.security.ServerAccessControlManager - * ServerAccessControlManager} and - * {@link org.apache.jackrabbit.rmi.client.security.ClientAccessControlManager - * ClientAccessControlManager} adapter base classes to provide transparent RMI - * access to remote item definitions. - *

- * The methods in this interface are documented only with a reference to a - * corresponding AccessControlManager method. The remote object will simply - * forward the method call to the underlying AccessControlManager instance. - * Argument and return values, as well as possible exceptions, are copied over - * the network. Complex return values are returned as remote references to the - * corresponding remote interface. RMI errors are signaled with - * RemoteExceptions. - * - * @see javax.jcr.security.AccessControlManager - * @see org.apache.jackrabbit.rmi.client.security.ClientAccessControlManager - * @see org.apache.jackrabbit.rmi.server.security.ServerAccessControlManager - */ -public interface RemoteAccessControlManager extends Remote { - - /** - * @see javax.jcr.security.AccessControlManager#getApplicablePolicies(String) - */ - public RemoteIterator getApplicablePolicies(String absPath) - throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.security.AccessControlManager#getEffectivePolicies(String) - */ - public RemoteAccessControlPolicy[] getEffectivePolicies(String absPath) - throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.security.AccessControlManager#getPolicies(String) - */ - public RemoteAccessControlPolicy[] getPolicies(String absPath) - throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.security.AccessControlManager#getPrivileges(String) - */ - public RemotePrivilege[] getPrivileges(String absPath) - throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.security.AccessControlManager#getSupportedPrivileges(String) - */ - public RemotePrivilege[] getSupportedPrivileges(String absPath) - throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.security.AccessControlManager#privilegeFromName(String) - */ - public RemotePrivilege privilegeFromName(String privilegeName) - throws RepositoryException, RemoteException; - - /** - * @see javax.jcr.security.AccessControlManager#hasPrivileges(String, - * javax.jcr.security.Privilege[]) - */ - public boolean hasPrivileges(String absPath, String[] privileges) - throws RepositoryException, RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlPolicy.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlPolicy.java deleted file mode 100644 index a775b5ac0f6..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlPolicy.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote.security; - -import java.rmi.Remote; - -/** - * Remote version of the JCR {@link javax.jcr.security.AccessControlPolicy - * AccessControlPolicy} interface. Used by the - * {@link org.apache.jackrabbit.rmi.server.security.ServerAccessControlPolicy - * ServerAccessControlPolicy} and - * {@link org.apache.jackrabbit.rmi.client.security.ClientAccessControlPolicy - * ClientAccessControlPolicy} adapter base classes to provide transparent RMI - * access to remote item definitions. - *

- * The methods in this interface are documented only with a reference to a - * corresponding AccessControlPolicy method. The remote object will simply - * forward the method call to the underlying AccessControlPolicy instance. - * Argument and return values, as well as possible exceptions, are copied over - * the network. Complex return values are returned as remote references to the - * corresponding remote interface. RMI errors are signaled with - * RemoteExceptions. - * - * @see javax.jcr.security.AccessControlPolicy - * @see org.apache.jackrabbit.rmi.client.security.ClientAccessControlPolicy - * @see org.apache.jackrabbit.rmi.server.security.ServerAccessControlPolicy - */ -public interface RemoteAccessControlPolicy extends Remote { - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemotePrivilege.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemotePrivilege.java deleted file mode 100644 index 148aff1de02..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemotePrivilege.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.remote.security; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -/** - * Remote version of the JCR {@link javax.jcr.security.Privilege Privilege} - * interface. Used by the - * {@link org.apache.jackrabbit.rmi.server.security.ServerPrivilege - * ServerPrivilege} and - * {@link org.apache.jackrabbit.rmi.client.security.ClientPrivilege - * ClientPrivilege} adapter base classes to provide transparent RMI access to - * remote item definitions. - *

- * The methods in this interface are documented only with a reference to a - * corresponding Privilege method. The remote object will simply forward the - * method call to the underlying Privilege instance. Argument and return values, - * as well as possible exceptions, are copied over the network. Complex return - * values are returned as remote references to the corresponding remote - * interface. RMI errors are signaled with RemoteExceptions. - * - * @see javax.jcr.security.Privilege - * @see org.apache.jackrabbit.rmi.client.security.ClientPrivilege - * @see org.apache.jackrabbit.rmi.server.security.ServerPrivilege - */ -public interface RemotePrivilege extends Remote { - - /** - * @see javax.jcr.security.Privilege#getAggregatePrivileges() - */ - public RemotePrivilege[] getAggregatePrivileges() throws RemoteException; - - /** - * @see javax.jcr.security.Privilege#getDeclaredAggregatePrivileges() - */ - public RemotePrivilege[] getDeclaredAggregatePrivileges() - throws RemoteException; - - /** - * @see javax.jcr.security.Privilege#getName() - */ - public String getName() throws RemoteException; - - /** - * @see javax.jcr.security.Privilege#isAbstract() - */ - public boolean isAbstract() throws RemoteException; - - /** - * @see javax.jcr.security.Privilege#isAggregate() - */ - public boolean isAggregate() throws RemoteException; -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/package-info.java deleted file mode 100755 index ba87be38ddb..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.remote.security; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/AbstractRemoteRepositoryFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/AbstractRemoteRepositoryFactory.java deleted file mode 100644 index 1a8be8d8dd0..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/AbstractRemoteRepositoryFactory.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.repository; - -import javax.jcr.Repository; -import javax.jcr.RepositoryException; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; - -/** - * Abstract base class for repository factories that make a remote repository - * available locally. Subclasses need to implement the - * {@link #getRemoteRepository()} method to actually retrieve the remote - * repository reference. - * - * @since 1.4 - */ -public abstract class AbstractRemoteRepositoryFactory - implements RepositoryFactory { - - /** - * Local adapter factory. - */ - private final LocalAdapterFactory factory; - - /** - * Creates a factory for looking up a repository from the given RMI URL. - * - * @param factory local adapter factory - */ - protected AbstractRemoteRepositoryFactory(LocalAdapterFactory factory) { - this.factory = factory; - } - - /** - * Returns a local adapter for the remote repository. - * - * @return local adapter for the remote repository - * @throws RepositoryException if the remote repository is not available - */ - public Repository getRepository() throws RepositoryException { - return factory.getRepository(getRemoteRepository()); - } - - /** - * Returns the remote repository reference. - * - * @return remote repository reference - * @throws RepositoryException if the remote repository is not available - */ - protected abstract RemoteRepository getRemoteRepository() - throws RepositoryException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/JNDIRemoteRepository.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/JNDIRemoteRepository.java deleted file mode 100644 index add03b1f880..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/JNDIRemoteRepository.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.repository; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; - -import org.apache.jackrabbit.rmi.client.ClientAdapterFactory; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; - -/** - * Proxy for a remote repository bound in JNDI. The configured repository is - * looked up from JNDI lazily during each method call. Thus the JNDI entry - * does not need to exist when this class is instantiated. The JNDI entry - * can also be replaced with another repository during the lifetime of an - * instance of this class. - * - * @since 1.4 - */ -public class JNDIRemoteRepository extends ProxyRepository { - - /** - * Creates a proxy for a remote repository in JNDI. - * - * @param factory local adapter factory - * @param context JNDI context - * @param location JNDI location - */ - public JNDIRemoteRepository( - LocalAdapterFactory factory, Context context, String location) { - super(new JNDIRemoteRepositoryFactory(factory, context, location)); - } - - /** - * Creates a proxy for the remote repository in JNDI. - * Uses {@link ClientAdapterFactory} as the default - * local adapter factory. - * - * @param context JNDI context - * @param location JNDI location - */ - public JNDIRemoteRepository(Context context, String location) { - this(new ClientAdapterFactory(), context, location); - } - - /** - * Creates a proxy for the remote repository in JNDI. - * Uses {@link ClientAdapterFactory} as the default - * local adapter factory. - * - * @param location JNDI location in default context - * @throws NamingException if the default JNDI context is not available - */ - public JNDIRemoteRepository(String location) throws NamingException { - this(new InitialContext(), location); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/JNDIRemoteRepositoryFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/JNDIRemoteRepositoryFactory.java deleted file mode 100644 index 5d00a582c03..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/JNDIRemoteRepositoryFactory.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.repository; - -import javax.jcr.RepositoryException; -import javax.naming.Context; -import javax.naming.NamingException; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; - -/** - * Factory that looks up a remote repository from JNDI. - * - * @since 1.4 - */ -public class JNDIRemoteRepositoryFactory - extends AbstractRemoteRepositoryFactory { - - /** - * JNDI context of the remote repository. - */ - private final Context context; - - /** - * JNDI location of the remote repository. - */ - private final String location; - - /** - * Creates a factory for looking up a remote repository from JNDI. - * - * @param factory local adapter factory - * @param context JNDI context - * @param location JNDI location - */ - public JNDIRemoteRepositoryFactory( - LocalAdapterFactory factory, Context context, String location) { - super(factory); - this.context = context; - this.location = location; - } - - /** - * Looks up a remote repository from JNDI. - * - * @return remote repository reference - * @throws RepositoryException if the remote repository is not available - */ - protected RemoteRepository getRemoteRepository() - throws RepositoryException { - try { - Object remote = context.lookup(location); - if (remote instanceof RemoteRepository) { - return (RemoteRepository) remote; - } else if (remote == null) { - throw new RepositoryException( - "Remote repository not found: The JNDI entry " - + location + " is null"); - } else { - throw new RepositoryException( - "Invalid remote repository: The JNDI entry " - + location + " is an instance of " - + remote.getClass().getName()); - } - } catch (NamingException e) { - throw new RepositoryException( - "Remote repository not found: The JNDI entry " + location - + " could not be looked up", e); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/ProxyRepository.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/ProxyRepository.java deleted file mode 100644 index 36496d0ce3b..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/ProxyRepository.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.repository; - -import java.util.HashSet; -import java.util.Set; - -import javax.jcr.Credentials; -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.Value; - -/** - * Repository that proxies all method calls to another repository. - * The other repository is accessed lazily using a - * {@link RepositoryFactory repository factory}. - * - * @since 1.4 - */ -public class ProxyRepository implements Repository { - - /** - * The set of standard descriptor keys defined in the - * {@link Repository} interface. - */ - private static final Set STANDARD_KEYS = new HashSet() {{ - add(Repository.IDENTIFIER_STABILITY); - add(Repository.LEVEL_1_SUPPORTED); - add(Repository.LEVEL_2_SUPPORTED); - add(Repository.OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_AUTOCREATED_DEFINITIONS_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_INHERITANCE); - add(Repository.NODE_TYPE_MANAGEMENT_MULTIPLE_BINARY_PROPERTIES_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_MULTIVALUED_PROPERTIES_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_ORDERABLE_CHILD_NODES_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_OVERRIDES_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_PRIMARY_ITEM_NAME_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_PROPERTY_TYPES); - add(Repository.NODE_TYPE_MANAGEMENT_RESIDUAL_DEFINITIONS_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_VALUE_CONSTRAINTS_SUPPORTED); - add(Repository.NODE_TYPE_MANAGEMENT_UPDATE_IN_USE_SUPORTED); - add(Repository.OPTION_ACCESS_CONTROL_SUPPORTED); - add(Repository.OPTION_JOURNALED_OBSERVATION_SUPPORTED); - add(Repository.OPTION_LIFECYCLE_SUPPORTED); - add(Repository.OPTION_LOCKING_SUPPORTED); - add(Repository.OPTION_OBSERVATION_SUPPORTED); - add(Repository.OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED); - add(Repository.OPTION_QUERY_SQL_SUPPORTED); - add(Repository.OPTION_RETENTION_SUPPORTED); - add(Repository.OPTION_SHAREABLE_NODES_SUPPORTED); - add(Repository.OPTION_SIMPLE_VERSIONING_SUPPORTED); - add(Repository.OPTION_TRANSACTIONS_SUPPORTED); - add(Repository.OPTION_UNFILED_CONTENT_SUPPORTED); - add(Repository.OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED); - add(Repository.OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED); - add(Repository.OPTION_VERSIONING_SUPPORTED); - add(Repository.OPTION_WORKSPACE_MANAGEMENT_SUPPORTED); - add(Repository.OPTION_XML_EXPORT_SUPPORTED); - add(Repository.OPTION_XML_IMPORT_SUPPORTED); - add(Repository.OPTION_ACTIVITIES_SUPPORTED); - add(Repository.OPTION_BASELINES_SUPPORTED); - - add(Repository.QUERY_FULL_TEXT_SEARCH_SUPPORTED); - add(Repository.QUERY_JOINS); - add(Repository.QUERY_LANGUAGES); - add(Repository.QUERY_STORED_QUERIES_SUPPORTED); - add(Repository.QUERY_XPATH_DOC_ORDER); - add(Repository.QUERY_XPATH_POS_INDEX); - add(Repository.REP_NAME_DESC); - add(Repository.REP_VENDOR_DESC); - add(Repository.REP_VENDOR_URL_DESC); - add(Repository.SPEC_NAME_DESC); - add(Repository.SPEC_VERSION_DESC); - add(Repository.WRITE_SUPPORTED); - }}; - - /** - * Factory for accessing the proxied repository. - */ - private final RepositoryFactory factory; - - /** - * Creates a proxy for the repository (or repositories) accessible - * through the given factory. - * - * @param factory repository factory - */ - public ProxyRepository(RepositoryFactory factory) { - this.factory = factory; - } - - /** - * Returns the descriptor keys of the proxied repository, or an empty - * array if the proxied repository can not be accessed. - * - * @return descriptor keys (possibly empty) - */ - public String[] getDescriptorKeys() { - try { - return factory.getRepository().getDescriptorKeys(); - } catch (RepositoryException e) { - return new String[0]; - } - } - - /** - * Checks whether the given key identifies a valid single-valued - * descriptor key in the proxied repository. Returns false - * if the proxied repository can not be accessed. - * - * @return true if the key identifies a valid single-valued - * descriptor in the proxied repository, - * false otherwise - */ - public boolean isSingleValueDescriptor(String key) { - try { - return factory.getRepository().isSingleValueDescriptor(key); - } catch (RepositoryException e) { - return false; - } - } - - /** - * Returns the descriptor with the given key from the proxied repository. - * Returns null if the descriptor does not exist or if the - * proxied repository can not be accessed. - * - * @param key descriptor key - * @return descriptor value, or null - */ - public String getDescriptor(String key) { - try { - return factory.getRepository().getDescriptor(key); - } catch (RepositoryException e) { - return null; - } - } - - /** - * Returns the value of the descriptor with the given key from the proxied - * repository. Returns null if the descriptor does not exist - * or if the proxied repository can not be accessed. - * - * @param key descriptor key - * @return descriptor value, or null - */ - public Value getDescriptorValue(String key) { - try { - return factory.getRepository().getDescriptorValue(key); - } catch (RepositoryException e) { - return null; - } - } - - /** - * Returns the values of the descriptor with the given key from the proxied - * repository. Returns null if the descriptor does not exist - * or if the proxied repository can not be accessed. - * - * @param key descriptor key - * @return descriptor values, or null - */ - public Value[] getDescriptorValues(String key) { - try { - return factory.getRepository().getDescriptorValues(key); - } catch (RepositoryException e) { - return null; - } - } - - /** - * Logs in to the proxied repository and returns the resulting session. - *

- * Note that the {@link Session#getRepository()} method of the resulting - * session will return the proxied repository, not this repository proxy! - * - * @throws RepositoryException if the proxied repository can not be - * accessed, or if the login in the proxied - * repository fails - */ - public Session login(Credentials credentials, String workspace) - throws RepositoryException { - return factory.getRepository().login(credentials, workspace); - } - - /** - * Returns true if the given key identifies a standard descriptor. - * - * @param key descriptor key - * @return true if the key identifies a standard descriptor, - * false otherwise - */ - public boolean isStandardDescriptor(String key) { - return STANDARD_KEYS.contains(key); - } - - /** - * Calls {@link Repository#login(Credentials, String)} with - * null arguments. - * - * @return logged in session - * @throws RepositoryException if an error occurs - */ - public Session login() throws RepositoryException { - return login(null, null); - } - - /** - * Calls {@link Repository#login(Credentials, String)} with - * the given credentials and a null workspace name. - * - * @param credentials login credentials - * @return logged in session - * @throws RepositoryException if an error occurs - */ - public Session login(Credentials credentials) throws RepositoryException { - return login(credentials, null); - } - - /** - * Calls {@link Repository#login(Credentials, String)} with - * null credentials and the given workspace name. - * - * @param workspace workspace name - * @return logged in session - * @throws RepositoryException if an error occurs - */ - public Session login(String workspace) throws RepositoryException { - return login(null, workspace); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RMIRemoteRepository.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RMIRemoteRepository.java deleted file mode 100644 index d1c2d0b866e..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RMIRemoteRepository.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.repository; - -import org.apache.jackrabbit.rmi.client.ClientAdapterFactory; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; - -/** - * Proxy for a remote repository bound in RMI. The configured repository is - * looked up from RMI lazily during each method call. Thus the RMI entry - * does not need to exist when this class is instantiated. The RMI entry - * can also be replaced with another repository during the lifetime of an - * instance of this class. - * - * @since 1.4 - */ -public class RMIRemoteRepository extends ProxyRepository { - - /** - * Creates a proxy for the remote repository in the given RMI URL. - * - * @param factory local adapter factory - * @param url RMI URL of the remote repository - */ - public RMIRemoteRepository(LocalAdapterFactory factory, String url) { - super(new RMIRemoteRepositoryFactory(factory, url)); - } - - /** - * Creates a proxy for the remote repository in the given RMI URL. - * Uses {@link ClientAdapterFactory} as the default - * local adapter factory. - * - * @param url URL of the remote repository - */ - public RMIRemoteRepository(String url) { - this(new ClientAdapterFactory(), url); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RMIRemoteRepositoryFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RMIRemoteRepositoryFactory.java deleted file mode 100644 index d462b8c8cda..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RMIRemoteRepositoryFactory.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.repository; - -import java.net.MalformedURLException; -import java.rmi.Naming; -import java.rmi.NotBoundException; -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; - -/** - * Factory that looks up a remote repository from an RMI registry. - * - * @since 1.4 - */ -public class RMIRemoteRepositoryFactory - extends AbstractRemoteRepositoryFactory { - - /** - * RMI URL of the remote repository. - */ - private final String url; - - /** - * Creates a factory for looking up a remote repository from - * an RMI registry. - * - * @param factory local adapter factory - * @param url RMI URL of the repository - */ - public RMIRemoteRepositoryFactory(LocalAdapterFactory factory, String url) { - super(factory); - this.url = url; - } - - /** - * Looks up a remote repository from the RMI registry. - * - * @return remote repository reference - * @throws RepositoryException if the remote repository is not available - */ - protected RemoteRepository getRemoteRepository() - throws RepositoryException { - try { - return (RemoteRepository) Naming.lookup(url); - } catch (MalformedURLException e) { - throw new RepositoryException("Invalid repository URL: " + url, e); - } catch (NotBoundException e) { - throw new RepositoryException("Repository not found: " + url, e); - } catch (ClassCastException e) { - throw new RepositoryException("Invalid repository: " + url, e); - } catch (RemoteException e) { - throw new RepositoryException("Repository access error: " + url, e); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RepositoryFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RepositoryFactory.java deleted file mode 100644 index 92decd5c676..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RepositoryFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.repository; - -import javax.jcr.Repository; -import javax.jcr.RepositoryException; - -/** - * Factory interface for JCR content repositories. - */ -interface RepositoryFactory { - - /** - * Returns a content repository. - * - * @return content repository - * @throws RepositoryException if a repository is not available - */ - Repository getRepository() throws RepositoryException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RmiRepositoryFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RmiRepositoryFactory.java deleted file mode 100644 index a4c1c85ac9f..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/RmiRepositoryFactory.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.repository; - -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.rmi.Naming; -import java.rmi.NotBoundException; -import java.rmi.RemoteException; -import java.util.Hashtable; -import java.util.Map; - -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.RepositoryFactory; -import javax.naming.InitialContext; -import javax.naming.NamingException; - -import org.apache.jackrabbit.rmi.client.ClientAdapterFactory; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.client.SafeClientRepository; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; - -public class RmiRepositoryFactory implements RepositoryFactory { - - private static final String REPOSITORY_URI = - "org.apache.jackrabbit.repository.uri"; - - @SuppressWarnings({"unchecked", "rawtypes"}) - public Repository getRepository(Map parameters) throws RepositoryException { - if (parameters != null && parameters.containsKey(REPOSITORY_URI)) { - URI uri; - try { - uri = new URI(parameters.get(REPOSITORY_URI).toString().trim()); - } catch (URISyntaxException e) { - return null; - } - - String scheme = uri.getScheme(); - if ("rmi".equalsIgnoreCase(scheme)) { - return getRmiRepository(uri.getSchemeSpecificPart()); - } else if ("jndi".equalsIgnoreCase(scheme)) { - Hashtable environment = new Hashtable(parameters); - environment.remove(REPOSITORY_URI); - return getJndiRepository( - uri.getSchemeSpecificPart(), environment); - } else { - try { - return getUrlRepository(uri.toURL()); - } catch (MalformedURLException e) { - return null; - } - } - } else { - return null; - } - } - - private Repository getUrlRepository(final URL url) - throws RepositoryException { - return new RmiSafeClientRepository(new ClientAdapterFactory()) { - - @Override - protected RemoteRepository getRemoteRepository() throws RemoteException { - try { - InputStream stream = url.openStream(); - try { - Object remote = new ObjectInputStream(stream).readObject(); - if (remote instanceof RemoteRepository) { - return (RemoteRepository) remote; - } else { - throw new RemoteException("The resource at URL " + url - + " is not a remote repository stub: " + remote); - } - } finally { - if (stream != null) { - stream.close(); - } - } - } catch (ClassNotFoundException e) { - throw new RemoteException("The resource at URL " + url - + " requires a class that is not available", e); - } catch (IOException e) { - throw new RemoteException("Failed to read the resource at URL " - + url, e); - } - } - }; - } - - @SuppressWarnings("rawtypes") - private Repository getJndiRepository(final String name, - final Hashtable environment) throws RepositoryException { - return new RmiSafeClientRepository(new ClientAdapterFactory()) { - - @Override - protected RemoteRepository getRemoteRepository() throws RemoteException { - try { - Object value = new InitialContext(environment).lookup(name); - if (value instanceof RemoteRepository) { - return (RemoteRepository) value; - } else { - throw new RemoteException("The JNDI resource " + name - + " is not a remote repository stub: " + value); - } - } catch (NamingException e) { - throw new RemoteException( - "Failed to look up the JNDI resource " + name, e); - } - } - }; - } - - private Repository getRmiRepository(final String name) - throws RepositoryException { - return new RmiSafeClientRepository(new ClientAdapterFactory()) { - - @Override - protected RemoteRepository getRemoteRepository() throws RemoteException { - try { - Object value = Naming.lookup(name); - if (value instanceof RemoteRepository) { - return (RemoteRepository) value; - } else { - throw new RemoteException("The RMI resource " + name - + " is not a remote repository stub: " + value); - } - } catch (NotBoundException e) { - throw new RemoteException( - "RMI resource " + name + " not found", e); - } catch (MalformedURLException e) { - throw new RemoteException("Invalid RMI name: " + name, e); - } catch (RemoteException e) { - throw new RemoteException("Failed to look up the RMI resource " - + name, e); - } - } - }; - } - - /** - * Basic SafeClientRepository for the different lookup types of a rmi repository - */ - private static class RmiSafeClientRepository extends SafeClientRepository { - - public RmiSafeClientRepository(LocalAdapterFactory factory) { - super(factory); - } - - @Override - protected RemoteRepository getRemoteRepository() throws RemoteException { - return null; - } - - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/URLRemoteRepository.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/URLRemoteRepository.java deleted file mode 100644 index 0e8fce5668b..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/URLRemoteRepository.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.repository; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.apache.jackrabbit.rmi.client.ClientAdapterFactory; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; - -/** - * Proxy for a remote repository accessed via a URL. The configured URL is - * dereferenced lazily during each method call. Thus the resource pointed to - * by the URL does not need to exist when this class is instantiated. The - * resource can also be replaced with another remote repository instance - * during the lifetime of an instance of this class. - * - * @since 1.4 - */ -public class URLRemoteRepository extends ProxyRepository { - - /** - * Creates a proxy for the remote repository at the given URL. - * - * @param factory local adapter factory - * @param url URL of the remote repository - */ - public URLRemoteRepository(LocalAdapterFactory factory, URL url) { - super(new URLRemoteRepositoryFactory(factory, url)); - } - - /** - * Creates a proxy for the remote repository at the given URL. - * Uses {@link ClientAdapterFactory} as the default - * local adapter factory. - * - * @param url URL of the remote repository - */ - public URLRemoteRepository(URL url) { - this(new ClientAdapterFactory(), url); - } - - /** - * Creates a proxy for the remote repository at the given URL. - * Uses {@link ClientAdapterFactory} as the default - * local adapter factory. - * - * @param url URL of the remote repository - * @throws MalformedURLException if the given URL is malformed - */ - public URLRemoteRepository(String url) throws MalformedURLException { - this(new URL(url)); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/URLRemoteRepositoryFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/URLRemoteRepositoryFactory.java deleted file mode 100644 index 633a98d1223..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/URLRemoteRepositoryFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.repository; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.net.URL; - -import javax.jcr.RepositoryException; - -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; - -/** - * Factory that looks up a remote repository from a given URL. - * - * @since 1.4 - */ -public class URLRemoteRepositoryFactory - extends AbstractRemoteRepositoryFactory { - - /** - * URL of the remote repository. - */ - private final URL url; - - /** - * Creates a factory for looking up a remote repository from a URL. - * - * @param factory local adapter factory - * @param url URL or the remote repository - */ - public URLRemoteRepositoryFactory(LocalAdapterFactory factory, URL url) { - super(factory); - this.url = url; - } - - /** - * Looks up and returns a remote repository from the configured URL. - * - * @return remote repository reference - * @throws RepositoryException if the remote repository is not available - */ - protected RemoteRepository getRemoteRepository() - throws RepositoryException { - try { - ObjectInputStream input = new ObjectInputStream(url.openStream()); - try { - Object remote = input.readObject(); - if (remote instanceof RemoteRepository) { - return (RemoteRepository) remote; - } else if (remote == null) { - throw new RepositoryException( - "Remote repository not found: The resource at " - + url + " is null"); - } else { - throw new RepositoryException( - "Invalid remote repository: The resource at " - + url + " is an instance of " - + remote.getClass().getName()); - } - } finally { - input.close(); - } - } catch (ClassNotFoundException e) { - throw new RepositoryException( - "Invalid remote repository: The resource at " + url - + " is an instance of an unknown class", e); - } catch (IOException e) { - throw new RepositoryException( - "Remote repository not found: The resource at " + url - + " could not be retrieved", e); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/package-info.java deleted file mode 100755 index 33e6942b6d8..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/repository/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.repository; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java deleted file mode 100644 index 58e6c940ff8..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java +++ /dev/null @@ -1,477 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; -import java.security.Principal; -import java.util.Iterator; - -import javax.jcr.Item; -import javax.jcr.NamespaceRegistry; -import javax.jcr.Node; -import javax.jcr.NodeIterator; -import javax.jcr.Property; -import javax.jcr.PropertyIterator; -import javax.jcr.Repository; -import javax.jcr.Session; -import javax.jcr.Workspace; -import javax.jcr.lock.Lock; -import javax.jcr.lock.LockManager; -import javax.jcr.nodetype.ItemDefinition; -import javax.jcr.nodetype.NodeDefinition; -import javax.jcr.nodetype.NodeType; -import javax.jcr.nodetype.NodeTypeIterator; -import javax.jcr.nodetype.NodeTypeManager; -import javax.jcr.nodetype.PropertyDefinition; -import javax.jcr.observation.EventIterator; -import javax.jcr.observation.ObservationManager; -import javax.jcr.query.Query; -import javax.jcr.query.QueryManager; -import javax.jcr.query.QueryResult; -import javax.jcr.query.Row; -import javax.jcr.query.RowIterator; -import javax.jcr.security.AccessControlEntry; -import javax.jcr.security.AccessControlManager; -import javax.jcr.security.AccessControlPolicy; -import javax.jcr.security.AccessControlPolicyIterator; -import javax.jcr.security.Privilege; -import javax.jcr.version.Version; -import javax.jcr.version.VersionHistory; -import javax.jcr.version.VersionIterator; -import javax.jcr.version.VersionManager; - -import org.apache.jackrabbit.rmi.remote.RemoteEventCollection; -import org.apache.jackrabbit.rmi.remote.RemoteItem; -import org.apache.jackrabbit.rmi.remote.RemoteItemDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteLock; -import org.apache.jackrabbit.rmi.remote.RemoteLockManager; -import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry; -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; -import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager; -import org.apache.jackrabbit.rmi.remote.RemoteObservationManager; -import org.apache.jackrabbit.rmi.remote.RemoteProperty; -import org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteQuery; -import org.apache.jackrabbit.rmi.remote.RemoteQueryManager; -import org.apache.jackrabbit.rmi.remote.RemoteQueryResult; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.remote.RemoteRow; -import org.apache.jackrabbit.rmi.remote.RemoteSession; -import org.apache.jackrabbit.rmi.remote.RemoteVersion; -import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory; -import org.apache.jackrabbit.rmi.remote.RemoteVersionManager; -import org.apache.jackrabbit.rmi.remote.RemoteWorkspace; -import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy; -import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege; - -/** - * Factory interface for creating remote adapters for local resources. - * This interface defines how the local JCR interfaces are adapted to - * remote JCR-RMI references. The adaption mechanism can be - * modified (for example to add extra features) by changing the - * remote adapter factory used by the repository server. - *

- * Note that the {@link ServerObject ServerObject} base class provides - * a number of utility methods designed to work with a remote adapter - * factory. Adapter implementations may want to inherit that functionality - * by subclassing from ServerObject. - * - * @see org.apache.jackrabbit.rmi.client.LocalAdapterFactory - * @see org.apache.jackrabbit.rmi.server.ServerAdapterFactory - * @see org.apache.jackrabbit.rmi.server.ServerObject - */ -public interface RemoteAdapterFactory { - - /** - * Returns the port number to which the server objects created by - * this factory are bound. This method is mostly used internally by - * the {@link ServerObject} constructor to determine which port number - * to use. - * - * @return port number, or 0 for a random port - */ - int getPortNumber(); - - /** - * Returns a remote adapter for the given local repository. - * - * @param repository local repository - * @return remote repository adapter - * @throws RemoteException on RMI errors - */ - RemoteRepository getRemoteRepository(Repository repository) - throws RemoteException; - - /** - * Returns a remote adapter for the given local session. - * - * @param session local session - * @return remote session adapter - * @throws RemoteException on RMI errors - */ - RemoteSession getRemoteSession(Session session) throws RemoteException; - - /** - * Returns a remote adapter for the given local workspace. - * - * @param workspace local workspace - * @return remote workspace adapter - * @throws RemoteException on RMI errors - */ - RemoteWorkspace getRemoteWorkspace(Workspace workspace) - throws RemoteException; - - /** - * Returns a remote adapter for the given local observation manager. - * - * @param observationManager local observation manager - * @return remote observation manager adapter - * @throws RemoteException on RMI errors - */ - RemoteObservationManager getRemoteObservationManager( - ObservationManager observationManager) - throws RemoteException; - - /** - * Returns a remote adapter for the given local namespace registry. - * - * @param registry local namespace registry - * @return remote namespace registry adapter - * @throws RemoteException on RMI errors - */ - RemoteNamespaceRegistry getRemoteNamespaceRegistry( - NamespaceRegistry registry) throws RemoteException; - - /** - * Returns a remote adapter for the given local node type manager. - * - * @param manager local node type manager - * @return remote node type manager adapter - * @throws RemoteException on RMI errors - */ - RemoteNodeTypeManager getRemoteNodeTypeManager(NodeTypeManager manager) - throws RemoteException; - - /** - * Returns a remote adapter for the given local item. This method - * will return an adapter that implements only the - * {@link Item Item} interface. The caller may want to introspect - * the local item to determine whether to use either the - * {@link #getRemoteNode(Node) getRemoteNode} or the - * {@link #getRemoteProperty(Property) getRemoteProperty} method instead. - * - * @param item local item - * @return remote item adapter - * @throws RemoteException on RMI errors - */ - RemoteItem getRemoteItem(Item item) throws RemoteException; - - /** - * Returns a remote adapter for the given local property. - * - * @param property local property - * @return remote property adapter - * @throws RemoteException on RMI errors - */ - RemoteProperty getRemoteProperty(Property property) throws RemoteException; - - /** - * Returns a remote adapter for the given local node. - * - * @param node local node - * @return remote node adapter - * @throws RemoteException on RMI errors - */ - RemoteNode getRemoteNode(Node node) throws RemoteException; - - /** - * Returns a remote adapter for the given local version. - * - * @param version local version - * @return remote version adapter - * @throws RemoteException on RMI errors - */ - RemoteVersion getRemoteVersion(Version version) throws RemoteException; - - /** - * Returns a remote adapter for the given local version history. - * - * @param versionHistory local version history - * @return remote version history adapter - * @throws RemoteException on RMI errors - */ - RemoteVersionHistory getRemoteVersionHistory(VersionHistory versionHistory) - throws RemoteException; - - /** - * Returns a remote adapter for the given local node type. - * - * @param type local node type - * @return remote node type adapter - * @throws RemoteException on RMI errors - */ - RemoteNodeType getRemoteNodeType(NodeType type) throws RemoteException; - - /** - * Returns a remote adapter for the given local item definition. - * This method will return an adapter that implements only the - * {@link ItemDefinition ItemDefinition} interface. The caller may want to introspect - * the local item definition to determine whether to use either the - * {@link #getRemoteNodeDefinition(NodeDefinition) getRemoteNodeDef} or the - * {@link #getRemotePropertyDefinition(PropertyDefinition) getRemotePropertyDef} - * method instead. - * - * @param def local item definition - * @return remote item definition adapter - * @throws RemoteException on RMI errors - */ - RemoteItemDefinition getRemoteItemDefinition(ItemDefinition def) throws RemoteException; - - /** - * Returns a remote adapter for the given local node definition. - * - * @param def local node definition - * @return remote node definition adapter - * @throws RemoteException on RMI errors - */ - RemoteNodeDefinition getRemoteNodeDefinition(NodeDefinition def) throws RemoteException; - - /** - * Returns a remote adapter for the given local property definition. - * - * @param def local property definition - * @return remote property definition adapter - * @throws RemoteException on RMI errors - */ - RemotePropertyDefinition getRemotePropertyDefinition(PropertyDefinition def) - throws RemoteException; - - /** - * Returns a remote adapter for the given local lock. - * - * @param lock local lock - * @return remote lock adapter - * @throws RemoteException on RMI errors - */ - RemoteLock getRemoteLock(Lock lock) throws RemoteException; - - /** - * Returns a remote adapter for the given local query manager. - * - * @param session current session - * @param manager local query manager - * @return remote query manager adapter - * @throws RemoteException on RMI errors - */ - RemoteQueryManager getRemoteQueryManager( - Session session, QueryManager manager) throws RemoteException; - - /** - * Returns a remote adapter for the given local query. - * - * @param query local query - * @return remote query adapter - * @throws RemoteException on RMI errors - */ - RemoteQuery getRemoteQuery(Query query) throws RemoteException; - - /** - * Returns a remote adapter for the given local query result. - * - * @param result local query result - * @return remote query result adapter - * @throws RemoteException on RMI errors - */ - RemoteQueryResult getRemoteQueryResult(QueryResult result) - throws RemoteException; - - /** - * Returns a remote adapter for the given local query row. - * - * @param row local query row - * @return remote query row adapter - * @throws RemoteException on RMI errors - */ - RemoteRow getRemoteRow(Row row) throws RemoteException; - - /** - * Returns a remote adapter for the given local events. - * - * @param listenerId The listener identifier to which the events are to be - * dispatched. - * @param events the local events - * @return remote event iterator adapter - * @throws RemoteException on RMI errors - */ - RemoteEventCollection getRemoteEvent(long listenerId, EventIterator events) - throws RemoteException; - - - /** - * Returns a remote adapter for the given local node iterator. - * - * @param iterator local node iterator - * @return remote iterator adapter - * @throws RemoteException on RMI errors - */ - RemoteIterator getRemoteNodeIterator(NodeIterator iterator) - throws RemoteException; - - /** - * Returns a remote adapter for the given local property iterator. - * - * @param iterator local property iterator - * @return remote iterator adapter - * @throws RemoteException on RMI errors - */ - RemoteIterator getRemotePropertyIterator(PropertyIterator iterator) - throws RemoteException; - - /** - * Returns a remote adapter for the given local version iterator. - * - * @param iterator local version iterator - * @return remote iterator adapter - * @throws RemoteException on RMI errors - */ - RemoteIterator getRemoteVersionIterator(VersionIterator iterator) - throws RemoteException; - - /** - * Returns a remote adapter for the given local node type iterator. - * - * @param iterator local node type iterator - * @return remote iterator adapter - * @throws RemoteException on RMI errors - */ - RemoteIterator getRemoteNodeTypeIterator(NodeTypeIterator iterator) - throws RemoteException; - - /** - * Returns a remote adapter for the given local row iterator. - * - * @param iterator local row iterator - * @return remote iterator adapter - * @throws RemoteException on RMI errors - */ - RemoteIterator getRemoteRowIterator(RowIterator iterator) - throws RemoteException; - - RemoteLockManager getRemoteLockManager(LockManager lockManager) - throws RemoteException; - - RemoteVersionManager getRemoteVersionManager(Session session, VersionManager versionManager) - throws RemoteException; - - /** - * Returns a remote adapter for the given local access control manager. - * - * @param acm local access control manager - * @return remote access control manager - * @throws RemoteException on RMI errors - */ - RemoteAccessControlManager getRemoteAccessControlManager( - AccessControlManager acm) throws RemoteException; - - /** - * Returns a remote adapter for the given local access control manager. - * - * @return remote access control manager - * @throws RemoteException on RMI errors - */ - public RemotePrivilege getRemotePrivilege(final Privilege local) - throws RemoteException; - - /** - * Returns a remote adapter for the given local access control manager. - * - * @return remote access control manager - * @throws RemoteException on RMI errors - */ - public RemotePrivilege[] getRemotePrivilege(final Privilege[] local) - throws RemoteException; - - /** - * Returns a remote adapter for the given local access control manager. - * - * @return remote access control manager - * @throws RemoteException on RMI errors - */ - public RemoteAccessControlPolicy getRemoteAccessControlPolicy( - final AccessControlPolicy local) throws RemoteException; - - /** - * Returns a remote adapter for the given local access control manager. - * - * @return remote access control manager - * @throws RemoteException on RMI errors - */ - public RemoteAccessControlPolicy[] getRemoteAccessControlPolicy( - final AccessControlPolicy[] local) throws RemoteException; - - /** - * Returns a remote adapter for the given local access control manager. - * - * @return remote access control manager - * @throws RemoteException on RMI errors - */ - public RemoteIterator getRemoteAccessControlPolicyIterator( - AccessControlPolicyIterator iterator) throws RemoteException; - - /** - * Returns a remote adapter for the given local access control manager. - * - * @return remote access control manager - * @throws RemoteException on RMI errors - */ - public RemoteAccessControlEntry getRemoteAccessControlEntry( - final AccessControlEntry local) throws RemoteException; - - /** - * Returns a remote adapter for the given local access control manager. - * - * @return remote access control manager - * @throws RemoteException on RMI errors - */ - public RemoteAccessControlEntry[] getRemoteAccessControlEntry( - final AccessControlEntry[] local) throws RemoteException; - - /** - * Returns a remote adapter for the given local access control manager. - * - * @return remote access control manager - * @throws RemoteException on RMI errors - */ - public RemotePrincipal getRemotePrincipal(final Principal principal) - throws RemoteException; - - /** - * Returns a remote adapter for the given local access control manager. - * - * @return remote access control manager - * @throws RemoteException on RMI errors - */ - public RemoteIterator getRemotePrincipalIterator( - final Iterator principals) throws RemoteException; - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java deleted file mode 100644 index 2551d6971d5..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java +++ /dev/null @@ -1,529 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; -import java.security.Principal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.jcr.Item; -import javax.jcr.NamespaceRegistry; -import javax.jcr.Node; -import javax.jcr.NodeIterator; -import javax.jcr.Property; -import javax.jcr.PropertyIterator; -import javax.jcr.Repository; -import javax.jcr.Session; -import javax.jcr.Workspace; -import javax.jcr.lock.Lock; -import javax.jcr.lock.LockManager; -import javax.jcr.nodetype.ItemDefinition; -import javax.jcr.nodetype.NodeDefinition; -import javax.jcr.nodetype.NodeType; -import javax.jcr.nodetype.NodeTypeIterator; -import javax.jcr.nodetype.NodeTypeManager; -import javax.jcr.nodetype.PropertyDefinition; -import javax.jcr.observation.Event; -import javax.jcr.observation.EventIterator; -import javax.jcr.observation.ObservationManager; -import javax.jcr.query.Query; -import javax.jcr.query.QueryManager; -import javax.jcr.query.QueryResult; -import javax.jcr.query.Row; -import javax.jcr.query.RowIterator; -import javax.jcr.security.AccessControlEntry; -import javax.jcr.security.AccessControlList; -import javax.jcr.security.AccessControlManager; -import javax.jcr.security.AccessControlPolicy; -import javax.jcr.security.AccessControlPolicyIterator; -import javax.jcr.security.Privilege; -import javax.jcr.version.Version; -import javax.jcr.version.VersionHistory; -import javax.jcr.version.VersionIterator; -import javax.jcr.version.VersionManager; -import javax.transaction.xa.XAResource; - -import org.apache.jackrabbit.rmi.remote.ArrayIterator; -import org.apache.jackrabbit.rmi.remote.BufferIterator; -import org.apache.jackrabbit.rmi.remote.RemoteEventCollection; -import org.apache.jackrabbit.rmi.remote.RemoteItem; -import org.apache.jackrabbit.rmi.remote.RemoteItemDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteLock; -import org.apache.jackrabbit.rmi.remote.RemoteLockManager; -import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry; -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; -import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager; -import org.apache.jackrabbit.rmi.remote.RemoteObservationManager; -import org.apache.jackrabbit.rmi.remote.RemoteProperty; -import org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteQuery; -import org.apache.jackrabbit.rmi.remote.RemoteQueryManager; -import org.apache.jackrabbit.rmi.remote.RemoteQueryResult; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.remote.RemoteRow; -import org.apache.jackrabbit.rmi.remote.RemoteSession; -import org.apache.jackrabbit.rmi.remote.RemoteVersion; -import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory; -import org.apache.jackrabbit.rmi.remote.RemoteVersionManager; -import org.apache.jackrabbit.rmi.remote.RemoteWorkspace; -import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy; -import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege; -import org.apache.jackrabbit.rmi.server.iterator.ServerNodeIterator; -import org.apache.jackrabbit.rmi.server.iterator.ServerNodeTypeIterator; -import org.apache.jackrabbit.rmi.server.iterator.ServerPropertyIterator; -import org.apache.jackrabbit.rmi.server.iterator.ServerRowIterator; -import org.apache.jackrabbit.rmi.server.iterator.ServerVersionIterator; -import org.apache.jackrabbit.rmi.server.principal.ServerGroup; -import org.apache.jackrabbit.rmi.server.principal.ServerPrincipal; -import org.apache.jackrabbit.rmi.server.principal.ServerPrincipalIterator; -import org.apache.jackrabbit.rmi.server.security.ServerAccessControlEntry; -import org.apache.jackrabbit.rmi.server.security.ServerAccessControlList; -import org.apache.jackrabbit.rmi.server.security.ServerAccessControlManager; -import org.apache.jackrabbit.rmi.server.security.ServerAccessControlPolicy; -import org.apache.jackrabbit.rmi.server.security.ServerAccessControlPolicyIterator; -import org.apache.jackrabbit.rmi.server.security.ServerPrivilege; - -/** - * Default implementation of the {@link RemoteAdapterFactory - * RemoteAdapterFactory} interface. This factory uses the server adapters - * defined in this package as the default adapter implementations. Subclasses - * can override or extend the default adapters by implementing the corresponding - * factory methods. - *

- * The bufferSize property can be used to configure the size of the - * buffer used by iterators to speed up iterator traversal over the network. - */ -public class ServerAdapterFactory implements RemoteAdapterFactory { - - /** The default iterator buffer size. */ - private static final int DEFAULT_BUFFER_SIZE = 100; - - /** The buffer size of iterators created by this factory. */ - private int bufferSize = DEFAULT_BUFFER_SIZE; - - /** - * The port number for server objects. Initializes to the value of the - * org.apache.jackrabbit.rmi.port system property, or to 0 if - * the property is not set. Value 0 means that the server objects should use - * a random anonymous port. - */ - private int portNumber = Integer.getInteger( - "org.apache.jackrabbit.rmi.port", 0).intValue(); - - /** - * Returns the iterator buffer size. - * - * @return iterator buffer size - */ - public int getBufferSize() { - return bufferSize; - } - - /** - * Sets the iterator buffer size. - * - * @param bufferSize iterator buffer size - */ - public void setBufferSize(int bufferSize) { - this.bufferSize = bufferSize; - } - - /** - * Returns the port number for server objects. - * - * @return port number, or 0 for the default - */ - public int getPortNumber() { - return portNumber; - } - - /** - * Sets the port number for server objects. - * - * @param portNumber port number, or 0 for the default - */ - public void setPortNumber(int portNumber) { - this.portNumber = portNumber; - } - - /** - * Creates a {@link ServerRepository ServerRepository} instance. - * {@inheritDoc} - */ - public RemoteRepository getRemoteRepository(Repository repository) - throws RemoteException { - return new ServerRepository(repository, this); - } - - /** - * Creates a {@link ServerSession ServerSession} instance. In case the - * underlying session is transaction enabled, the remote interface is will - * be transaction enabled too through the {@link ServerXASession}. - * {@inheritDoc} - */ - public RemoteSession getRemoteSession(Session session) - throws RemoteException { - if (session instanceof XAResource) { - return new ServerXASession(session, (XAResource) session, this); - } else { - return new ServerSession(session, this); - } - } - - /** - * Creates a {@link ServerWorkspace ServerWorkspace} instance. {@inheritDoc} - */ - public RemoteWorkspace getRemoteWorkspace(Workspace workspace) - throws RemoteException { - return new ServerWorkspace(workspace, this); - } - - /** - * Creates a {@link ServerObservationManager ServerObservationManager} - * instance. {@inheritDoc} - */ - public RemoteObservationManager getRemoteObservationManager( - ObservationManager observationManager) throws RemoteException { - return new ServerObservationManager(observationManager, this); - } - - /** - * Creates a {@link ServerNamespaceRegistry ServerNamespaceRegistry} - * instance. {@inheritDoc} - */ - public RemoteNamespaceRegistry getRemoteNamespaceRegistry( - NamespaceRegistry registry) throws RemoteException { - return new ServerNamespaceRegistry(registry, this); - } - - /** - * Creates a {@link ServerNodeTypeManager ServerNodeTypeManager} instance. - * {@inheritDoc} - */ - public RemoteNodeTypeManager getRemoteNodeTypeManager( - NodeTypeManager manager) throws RemoteException { - return new ServerNodeTypeManager(manager, this); - } - - /** - * Creates a {@link ServerItem ServerItem} instance. {@inheritDoc} - */ - public RemoteItem getRemoteItem(Item item) throws RemoteException { - return new ServerItem(item, this); - } - - /** - * Creates a {@link ServerProperty ServerProperty} instance. {@inheritDoc} - */ - public RemoteProperty getRemoteProperty(Property property) - throws RemoteException { - return new ServerProperty(property, this); - } - - /** - * Creates a {@link ServerNode ServerNode} instance. {@inheritDoc} - */ - public RemoteNode getRemoteNode(Node node) throws RemoteException { - return new ServerNode(node, this); - } - - /** - * Creates a {@link ServerVersion ServerVersion} instance. {@inheritDoc} - */ - public RemoteVersion getRemoteVersion(Version version) - throws RemoteException { - return new ServerVersion(version, this); - } - - /** - * Creates a {@link ServerVersionHistory ServerVersionHistory} instance. - * {@inheritDoc} - */ - public RemoteVersionHistory getRemoteVersionHistory( - VersionHistory versionHistory) throws RemoteException { - return new ServerVersionHistory(versionHistory, this); - } - - /** - * Creates a {@link ServerNodeType ServerNodeType} instance. {@inheritDoc} - */ - public RemoteNodeType getRemoteNodeType(NodeType type) - throws RemoteException { - return new ServerNodeType(type, this); - } - - /** - * Creates a {@link ServerItemDefinition ServerItemDefinition} instance. - * {@inheritDoc} - */ - public RemoteItemDefinition getRemoteItemDefinition(ItemDefinition def) - throws RemoteException { - return new ServerItemDefinition(def, this); - } - - /** - * Creates a {@link ServerNodeDefinition ServerNodeDefinition} instance. - * {@inheritDoc} - */ - public RemoteNodeDefinition getRemoteNodeDefinition(NodeDefinition def) - throws RemoteException { - return new ServerNodeDefinition(def, this); - } - - /** - * Creates a {@link ServerPropertyDefinition ServerPropertyDefinition} - * instance. {@inheritDoc} - */ - public RemotePropertyDefinition getRemotePropertyDefinition( - PropertyDefinition def) throws RemoteException { - return new ServerPropertyDefinition(def, this); - } - - /** - * Creates a {@link ServerLock ServerLock} instance. {@inheritDoc} - */ - public RemoteLock getRemoteLock(Lock lock) throws RemoteException { - return new ServerLock(lock, this); - } - - /** - * Creates a {@link ServerQueryManager ServerQueryManager} instance. - * {@inheritDoc} - */ - public RemoteQueryManager getRemoteQueryManager(Session session, - QueryManager manager) throws RemoteException { - return new ServerQueryManager(session, manager, this); - } - - /** - * Creates a {@link ServerQuery ServerQuery} instance. {@inheritDoc} - */ - public RemoteQuery getRemoteQuery(Query query) throws RemoteException { - return new ServerQuery(query, this); - } - - /** - * Creates a {@link ServerQueryResult ServerQueryResult} instance. - * {@inheritDoc} - */ - public RemoteQueryResult getRemoteQueryResult(QueryResult result) - throws RemoteException { - return new ServerQueryResult(result, this); - } - - /** - * Creates a {@link ServerQueryResult ServerQueryResult} instance. - * {@inheritDoc} - */ - public RemoteRow getRemoteRow(Row row) throws RemoteException { - return new ServerRow(row, this); - } - - /** - * Creates a {@link ServerEventCollection ServerEventCollection} instances. - * {@inheritDoc} - */ - public RemoteEventCollection getRemoteEvent(long listenerId, - EventIterator events) throws RemoteException { - RemoteEventCollection.RemoteEvent[] remoteEvents; - if (events != null) { - List eventList = new ArrayList(); - while (events.hasNext()) { - Event event = events.nextEvent(); - eventList - .add(new ServerEventCollection.ServerEvent(event, this)); - } - remoteEvents = eventList.toArray(new RemoteEventCollection.RemoteEvent[eventList.size()]); - } else { - remoteEvents = new RemoteEventCollection.RemoteEvent[0]; // for - // safety - } - - return new ServerEventCollection(listenerId, remoteEvents, this); - } - - /** - * Optimizes the given remote iterator for transmission across the network. - * This method retrieves the first set of elements from the iterator by - * calling {@link RemoteIterator#nextObjects()} and then asks for the total - * size of the iterator. If the size is unkown or greater than the length of - * the retrieved array, then the elements, the size, and the remote iterator - * reference are wrapped into a {@link BufferIterator} instance that gets - * passed over the network. If the retrieved array of elements contains all - * the elements in the iterator, then the iterator instance is discarded and - * just the elements are wrapped into a {@link ArrayIterator} instance to be - * passed to the client. - *

- * Subclasses can override this method to provide alternative optimizations. - * - * @param remote remote iterator - * @return optimized remote iterator - * @throws RemoteException on RMI errors - */ - protected RemoteIterator optimizeIterator(RemoteIterator remote) - throws RemoteException { - Object[] elements = remote.nextObjects(); - long size = remote.getSize(); - if (size == -1 || (elements != null && size > elements.length)) { - return new BufferIterator(elements, size, remote); - } else { - return new ArrayIterator(elements); - } - } - - /** - * Creates a {@link ServerNodeIterator} instance. {@inheritDoc} - */ - public RemoteIterator getRemoteNodeIterator(NodeIterator iterator) - throws RemoteException { - return optimizeIterator(new ServerNodeIterator(iterator, this, - bufferSize)); - } - - /** - * Creates a {@link ServerPropertyIterator} instance. {@inheritDoc} - */ - public RemoteIterator getRemotePropertyIterator(PropertyIterator iterator) - throws RemoteException { - return optimizeIterator(new ServerPropertyIterator(iterator, this, - bufferSize)); - } - - /** - * Creates a {@link ServerVersionIterator} instance. {@inheritDoc} - */ - public RemoteIterator getRemoteVersionIterator(VersionIterator iterator) - throws RemoteException { - return optimizeIterator(new ServerVersionIterator(iterator, this, - bufferSize)); - } - - /** - * Creates a {@link ServerNodeTypeIterator} instance. {@inheritDoc} - */ - public RemoteIterator getRemoteNodeTypeIterator(NodeTypeIterator iterator) - throws RemoteException { - return optimizeIterator(new ServerNodeTypeIterator(iterator, this, - bufferSize)); - } - - /** - * Creates a {@link ServerRowIterator} instance. {@inheritDoc} - */ - public RemoteIterator getRemoteRowIterator(RowIterator iterator) - throws RemoteException { - return optimizeIterator(new ServerRowIterator(iterator, this, - bufferSize)); - } - - public RemoteLockManager getRemoteLockManager(LockManager lockManager) - throws RemoteException { - return new ServerLockManager(lockManager, this); - } - - public RemoteVersionManager getRemoteVersionManager(Session session, - VersionManager versionManager) throws RemoteException { - return new ServerVersionManager(session, versionManager, this); - } - - /** - * Creates a - * {@link org.apache.jackrabbit.rmi.server.security.ServerAccessControlManager} - * instance. {@inheritDoc} - */ - public RemoteAccessControlManager getRemoteAccessControlManager( - AccessControlManager acm) throws RemoteException { - return new ServerAccessControlManager(acm, this); - } - - public RemotePrivilege getRemotePrivilege(final Privilege local) - throws RemoteException { - return new ServerPrivilege(local, this); - } - - public RemotePrivilege[] getRemotePrivilege(final Privilege[] local) - throws RemoteException { - RemotePrivilege[] remote = new RemotePrivilege[local.length]; - for (int i = 0; i < remote.length; i++) { - remote[i] = getRemotePrivilege(local[i]); - } - return remote; - } - - public RemoteAccessControlPolicy getRemoteAccessControlPolicy( - final AccessControlPolicy local) throws RemoteException { - if (local instanceof AccessControlList) { - return new ServerAccessControlList((AccessControlList) local, this); - } - return new ServerAccessControlPolicy(local, this); - } - - public RemoteAccessControlPolicy[] getRemoteAccessControlPolicy( - final AccessControlPolicy[] local) throws RemoteException { - RemoteAccessControlPolicy[] remote = new RemoteAccessControlPolicy[local.length]; - for (int i = 0; i < remote.length; i++) { - remote[i] = getRemoteAccessControlPolicy(local[i]); - } - return remote; - } - - /** - * Creates a {@link ServerNodeIterator} instance. {@inheritDoc} - */ - public RemoteIterator getRemoteAccessControlPolicyIterator( - AccessControlPolicyIterator iterator) throws RemoteException { - return optimizeIterator(new ServerAccessControlPolicyIterator(iterator, - this, bufferSize)); - } - - public RemoteAccessControlEntry getRemoteAccessControlEntry( - final AccessControlEntry local) throws RemoteException { - return new ServerAccessControlEntry(local, this); - } - - public RemoteAccessControlEntry[] getRemoteAccessControlEntry( - final AccessControlEntry[] local) throws RemoteException { - RemoteAccessControlEntry[] remote = new RemoteAccessControlEntry[local.length]; - for (int i = 0; i < remote.length; i++) { - remote[i] = getRemoteAccessControlEntry(local[i]); - } - return remote; - } - - public RemotePrincipal getRemotePrincipal(final Principal principal) throws RemoteException { - if (ServerGroup.isGroup(principal)) { - return new ServerGroup(principal, this); - } - - return new ServerPrincipal(principal, this); - } - - public RemoteIterator getRemotePrincipalIterator( - Iterator principals) throws RemoteException { - return optimizeIterator(new ServerPrincipalIterator(principals, this, - bufferSize)); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerEventCollection.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerEventCollection.java deleted file mode 100644 index c242f62765d..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerEventCollection.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; -import java.util.Map; - -import javax.jcr.RepositoryException; -import javax.jcr.observation.Event; - -import org.apache.jackrabbit.rmi.remote.RemoteEventCollection; - -/** - * The ServerEventCollection class implements the - * {@link org.apache.jackrabbit.rmi.remote.RemoteEventCollection}event to - * actually sent the server-side event to the client. - *

- * This class does not directly relate to any JCR class because beside the list - * of events the unique identifier of the client-side listener has to be - * provided such that the receiving listener may be identified on the - * client-side. - */ -public class ServerEventCollection extends ServerObject implements - RemoteEventCollection { - - /** The unique identifier of the receiving listener */ - private final long listenerId; - - /** - * The list of - * {@link org.apache.jackrabbit.rmi.remote.RemoteEventCollection.RemoteEvent}. - */ - private final RemoteEvent[] events; - - /** - * Creates an instance of this class. - * - * @param listenerId The unique identifier of the client-side listener to - * which the events should be sent. - * @param events The list of {@link RemoteEvent remote events}. - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - ServerEventCollection( - long listenerId, RemoteEvent[] events, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - - this.listenerId = listenerId; - this.events = events; - } - - /** {@inheritDoc} */ - public long getListenerId() { - return listenerId; - } - - /** {@inheritDoc} */ - public RemoteEvent[] getEvents() { - return events; - } - - /** - * Server side implementation of the {@link RemoteEvent} interface. - * - * {@inheritDoc} - */ - public static class ServerEvent extends ServerObject implements RemoteEvent { - - /** The adapted local event. */ - private Event event; - - /** - * Creates an instance of this class. - * @param type The event type. - * @param path The absolute path to the underlying item. - * @param userId The userID of the originating session. - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - ServerEvent(Event event, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.event = event; - } - - /** {@inheritDoc} */ - public String getPath() throws RepositoryException { - return event.getPath(); - } - - /** {@inheritDoc} */ - public int getType() { - return event.getType(); - } - - /** {@inheritDoc} */ - public String getUserID() { - return event.getUserID(); - } - - /** {@inheritDoc} */ - public String getIdentifier() throws RepositoryException, - RemoteException { - return event.getIdentifier(); - } - - /** {@inheritDoc} */ - public Map getInfo() throws RepositoryException, RemoteException { - return event.getInfo(); - } - - /** {@inheritDoc} */ - public String getUserData() throws RepositoryException, RemoteException { - return event.getUserData(); - } - - /** {@inheritDoc} */ - public long getDate() throws RepositoryException, RemoteException { - return event.getDate(); - } - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerItem.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerItem.java deleted file mode 100644 index 2ced6414a1a..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerItem.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.Item; -import javax.jcr.RepositoryException; - -import org.apache.jackrabbit.rmi.remote.RemoteItem; -import org.apache.jackrabbit.rmi.remote.RemoteNode; - -/** - * Remote adapter for the JCR {@link javax.jcr.Item Item} interface. - * This class makes a local item available as an RMI service using - * the {@link org.apache.jackrabbit.rmi.remote.RemoteItem RemoteItem} - * interface. Used mainly as the base class for the - * {@link org.apache.jackrabbit.rmi.server.ServerProperty ServerProperty} - * and {@link org.apache.jackrabbit.rmi.server.ServerNode ServerNode} - * adapters. - * - * @see javax.jcr.Item - * @see org.apache.jackrabbit.rmi.remote.RemoteItem - */ -public class ServerItem extends ServerObject implements RemoteItem { - - /** The adapted local item. */ - private Item item; - - /** - * Creates a remote adapter for the given local item. - * - * @param item local item to be adapted - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerItem(Item item, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.item = item; - } - - /** {@inheritDoc} */ - public String getPath() throws RepositoryException, RemoteException { - try { - return item.getPath(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getName() throws RepositoryException, RemoteException { - try { - return item.getName(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void save() throws RepositoryException, RemoteException { - try { - item.save(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteItem getAncestor(int level) - throws RepositoryException, RemoteException { - try { - return getRemoteItem(item.getAncestor(level)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public int getDepth() throws RepositoryException, RemoteException { - try { - return item.getDepth(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNode getParent() throws RepositoryException, RemoteException { - try { - return getRemoteNode(item.getParent()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isModified() throws RemoteException { - return item.isModified(); - } - - /** {@inheritDoc} */ - public boolean isNew() throws RemoteException { - return item.isNew(); - } - - /** {@inheritDoc} */ - public void refresh(boolean keepChanges) - throws RepositoryException, RemoteException { - try { - item.refresh(keepChanges); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void remove() throws RepositoryException, RemoteException { - try { - item.remove(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerItemDefinition.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerItemDefinition.java deleted file mode 100644 index 486fc925d83..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerItemDefinition.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.nodetype.ItemDefinition; -import javax.jcr.nodetype.NodeType; - -import org.apache.jackrabbit.rmi.remote.RemoteItemDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; - -/** - * Remote adapter for the JCR {@link javax.jcr.nodetype.ItemDefinition ItemDefinition} - * interface. This class makes a local item definition available as an - * RMI service using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteItemDefinition RemoteItemDefinition} - * interface. Used mainly as the base class for the - * {@link org.apache.jackrabbit.rmi.server.ServerPropertyDefinition ServerPropertyDefinition} - * and - * {@link org.apache.jackrabbit.rmi.server.ServerNodeDefinition ServerNodeDefinition} - * adapters. - * - * @see javax.jcr.nodetype.ItemDefinition - * @see org.apache.jackrabbit.rmi.remote.RemoteItemDefinition - */ -public class ServerItemDefinition extends ServerObject implements RemoteItemDefinition { - - /** The adapted local item definition. */ - private ItemDefinition def; - - /** - * Creates a remote adapter for the given local item definition. - * - * @param def local item definition - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerItemDefinition(ItemDefinition def, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.def = def; - } - - /** {@inheritDoc} */ - public RemoteNodeType getDeclaringNodeType() throws RemoteException { - NodeType nt = def.getDeclaringNodeType(); - if (nt == null) { - return null; - } else { - return getFactory().getRemoteNodeType(nt); - } - } - - /** {@inheritDoc} */ - public String getName() throws RemoteException { - return def.getName(); - } - - /** {@inheritDoc} */ - public boolean isAutoCreated() throws RemoteException { - return def.isAutoCreated(); - } - - /** {@inheritDoc} */ - public boolean isMandatory() throws RemoteException { - return def.isMandatory(); - } - - /** {@inheritDoc} */ - public int getOnParentVersion() throws RemoteException { - return def.getOnParentVersion(); - } - - /** {@inheritDoc} */ - public boolean isProtected() throws RemoteException { - return def.isProtected(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerLock.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerLock.java deleted file mode 100644 index af268afec43..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerLock.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.lock.Lock; - -import org.apache.jackrabbit.rmi.remote.RemoteLock; -import org.apache.jackrabbit.rmi.remote.RemoteNode; - -/** - * Remote adapter for the JCR {@link javax.jcr.lock.Lock Lock} interface. - * This class makes a local lock available as an RMI service using - * the {@link org.apache.jackrabbit.rmi.remote.RemoteLock RemoteLock} - * interface. - * - * @see javax.jcr.lock.Lock - * @see org.apache.jackrabbit.rmi.remote.RemoteLock - */ -public class ServerLock extends ServerObject implements RemoteLock { - - /** The adapted local lock. */ - private Lock lock; - - /** - * Creates a remote adapter for the given local lock. - * - * @param lock local lock - * @throws RemoteException on RMI errors - */ - public ServerLock(Lock lock, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.lock = lock; - } - - /** {@inheritDoc} */ - public RemoteNode getNode() throws RemoteException { - return getRemoteNode(lock.getNode()); - } - - /** {@inheritDoc} */ - public String getLockOwner() throws RemoteException { - return lock.getLockOwner(); - } - - /** {@inheritDoc} */ - public boolean isDeep() throws RemoteException { - return lock.isDeep(); - } - - /** {@inheritDoc} */ - public String getLockToken() throws RemoteException { - return lock.getLockToken(); - } - - /** {@inheritDoc} */ - public boolean isLive() throws RepositoryException, RemoteException { - return lock.isLive(); - } - - /** {@inheritDoc} */ - public void refresh() throws RepositoryException, RemoteException { - lock.refresh(); - } - - /** {@inheritDoc} */ - public boolean isSessionScoped() throws RemoteException { - return lock.isSessionScoped(); - } - - /** {@inheritDoc} */ - public long getSecondsRemaining() throws RepositoryException, RemoteException { - return lock.getSecondsRemaining(); - } - - /** {@inheritDoc} */ - public boolean isLockOwningSession() throws RemoteException { - return lock.isLockOwningSession(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerLockManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerLockManager.java deleted file mode 100644 index 1708b10527f..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerLockManager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.lock.LockManager; - -import org.apache.jackrabbit.rmi.remote.RemoteLock; -import org.apache.jackrabbit.rmi.remote.RemoteLockManager; - -public class ServerLockManager extends ServerObject - implements RemoteLockManager { - - /** The adapted local lock manager. */ - private LockManager manager; - - public ServerLockManager(LockManager manager, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.manager = manager; - } - - public String[] getLockTokens() throws RepositoryException { - try { - return manager.getLockTokens(); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public void addLockToken(String lockToken) throws RepositoryException { - try { - manager.addLockToken(lockToken); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public void removeLockToken(String lockToken) throws RepositoryException { - try { - manager.removeLockToken(lockToken); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public boolean isLocked(String absPath) throws RepositoryException { - try { - return manager.isLocked(absPath); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public boolean holdsLock(String absPath) throws RepositoryException { - try { - return manager.holdsLock(absPath); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public RemoteLock getLock(String absPath) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteLock(manager.getLock(absPath)); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public RemoteLock lock( - String absPath, boolean isDeep, boolean isSessionScoped, - long timeoutHint, String ownerInfo) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteLock(manager.lock( - absPath, isDeep, isSessionScoped, timeoutHint, ownerInfo)); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public void unlock(String absPath) throws RepositoryException { - try { - manager.unlock(absPath); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java deleted file mode 100644 index 8ddea6ca2b9..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.NamespaceRegistry; -import javax.jcr.RepositoryException; - -import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry; - -/** - * Remote adapter for the JCR - * {@link javax.jcr.NamespaceRegistry NamespaceRegistry} interface. - * This class makes a local namespace registry available as an RMI service - * using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry RemoteNamespaceRegistry} - * interface. - * - * @see javax.jcr.NamespaceRegistry - * @see org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry - */ -public class ServerNamespaceRegistry extends ServerObject implements - RemoteNamespaceRegistry { - - /** The adapted local namespace registry. */ - private NamespaceRegistry registry; - - /** - * Creates a remote adapter for the given local namespace registry. - * - * @param registry local namespace registry - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerNamespaceRegistry( - NamespaceRegistry registry, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.registry = registry; - } - - /** {@inheritDoc} */ - public void registerNamespace(String prefix, String uri) - throws RepositoryException, RemoteException { - try { - registry.registerNamespace(prefix, uri); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void unregisterNamespace(String prefix) - throws RepositoryException, RemoteException { - try { - registry.unregisterNamespace(prefix); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getPrefixes() throws RepositoryException, RemoteException { - try { - return registry.getPrefixes(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getURIs() throws RepositoryException, RemoteException { - try { - return registry.getURIs(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getURI(String prefix) - throws RepositoryException, RemoteException { - try { - return registry.getURI(prefix); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getPrefix(String uri) - throws RepositoryException, RemoteException { - try { - return registry.getPrefix(uri); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNode.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNode.java deleted file mode 100644 index b611d4278b7..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNode.java +++ /dev/null @@ -1,686 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.Node; -import javax.jcr.NodeIterator; -import javax.jcr.Property; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.Value; -import javax.jcr.lock.Lock; -import javax.jcr.version.Version; - -import org.apache.jackrabbit.rmi.remote.RemoteItem; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteLock; -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; -import org.apache.jackrabbit.rmi.remote.RemoteProperty; -import org.apache.jackrabbit.rmi.remote.RemoteVersion; -import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory; - -/** - * Remote adapter for the JCR {@link javax.jcr.Node Node} interface. - * This class makes a local node available as an RMI service using - * the {@link org.apache.jackrabbit.rmi.remote.RemoteNode RemoteNode} - * interface. - * - * @see javax.jcr.Node - * @see org.apache.jackrabbit.rmi.remote.RemoteNode - */ -public class ServerNode extends ServerItem implements RemoteNode { - - /** The adapted local node. */ - private Node node; - - /** - * Creates a remote adapter for the given local node. - * - * @param node local node - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerNode(Node node, RemoteAdapterFactory factory) - throws RemoteException { - super(node, factory); - this.node = node; - } - - /** {@inheritDoc} */ - public RemoteNode addNode(String path) - throws RepositoryException, RemoteException { - try { - return getRemoteNode(node.addNode(path)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNode addNode(String path, String type) - throws RepositoryException, RemoteException { - try { - return getRemoteNode(node.addNode(path, type)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteProperty getProperty(String path) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteProperty(node.getProperty(path)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getProperties() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemotePropertyIterator(node.getProperties()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteItem getPrimaryItem() - throws RepositoryException, RemoteException { - try { - return getRemoteItem(node.getPrimaryItem()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getProperties(String pattern) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemotePropertyIterator(node.getProperties(pattern)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getProperties(String[] globs) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemotePropertyIterator(node.getProperties(globs)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getReferences() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemotePropertyIterator(node.getReferences()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getReferences(String name) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemotePropertyIterator(node.getReferences(name)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getIdentifier() throws RepositoryException, RemoteException { - try { - return node.getIdentifier(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - @SuppressWarnings("deprecation") - public String getUUID() throws RepositoryException, RemoteException { - try { - return node.getUUID(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasNodes() throws RepositoryException, RemoteException { - try { - return node.hasNodes(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasProperties() throws RepositoryException, RemoteException { - try { - return node.hasProperties(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasProperty(String path) - throws RepositoryException, RemoteException { - try { - return node.hasProperty(path); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNodeType[] getMixinNodeTypes() - throws RepositoryException, RemoteException { - try { - return getRemoteNodeTypeArray(node.getMixinNodeTypes()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNodeType getPrimaryNodeType() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeType(node.getPrimaryNodeType()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isNodeType(String type) - throws RepositoryException, RemoteException { - try { - return node.isNodeType(type); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getNodes() throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeIterator(node.getNodes()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getNodes(String pattern) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeIterator(node.getNodes(pattern)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getNodes(String[] globs) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeIterator(node.getNodes(globs)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNode getNode(String path) - throws RepositoryException, RemoteException { - try { - return getRemoteNode(node.getNode(path)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasNode(String path) - throws RepositoryException, RemoteException { - try { - return node.hasNode(path); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteProperty setProperty(String name, Value value) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteProperty(node.setProperty(name, value)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteProperty setProperty(String name, Value value, int type) - throws RepositoryException, RemoteException { - try { - Property property = node.setProperty(name, value, type); - if (property == null) { - return null; - } else { - return getFactory().getRemoteProperty(property); - } - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void addMixin(String name) - throws RepositoryException, RemoteException { - try { - node.addMixin(name); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean canAddMixin(String name) - throws RepositoryException, RemoteException { - try { - return node.canAddMixin(name); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeMixin(String name) - throws RepositoryException, RemoteException { - try { - node.removeMixin(name); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void orderBefore(String src, String dst) - throws RepositoryException, RemoteException { - try { - node.orderBefore(src, dst); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteProperty setProperty(String name, Value[] values) - throws RepositoryException, RemoteException { - try { - Property property = node.setProperty(name, values); - if (property == null) { - return null; - } else { - return getFactory().getRemoteProperty(property); - } - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNodeDefinition getDefinition() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeDefinition(node.getDefinition()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteVersion checkin() throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteVersion(node.checkin()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void checkout() throws RepositoryException, RemoteException { - try { - node.checkout(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getCorrespondingNodePath(String workspace) - throws RepositoryException, RemoteException { - try { - return node.getCorrespondingNodePath(workspace); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public int getIndex() throws RepositoryException, RemoteException { - try { - return node.getIndex(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator merge(String workspace, boolean bestEffort) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeIterator(node.merge(workspace, bestEffort)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void cancelMerge(String versionUUID) - throws RepositoryException, RemoteException { - try { - node.cancelMerge(getVersionByUUID(versionUUID)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void doneMerge(String versionUUID) - throws RepositoryException, RemoteException { - try { - node.doneMerge(getVersionByUUID(versionUUID)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void restore(String version, boolean removeExisting) - throws RepositoryException, RemoteException { - try { - node.restore(version, removeExisting); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void restoreByUUID(String versionUUID, boolean removeExisting) - throws RepositoryException, RemoteException { - try { - node.restore(getVersionByUUID(versionUUID), removeExisting); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void restore(String versionUUID, String path, boolean removeExisting) - throws RepositoryException, RemoteException { - try { - node.restore(getVersionByUUID(versionUUID), path, removeExisting); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void restoreByLabel(String label, boolean removeExisting) - throws RepositoryException, RemoteException { - try { - node.restoreByLabel(label, removeExisting); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void update(String workspace) - throws RepositoryException, RemoteException { - try { - node.update(workspace); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean holdsLock() throws RepositoryException, RemoteException { - try { - return node.holdsLock(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isCheckedOut() throws RepositoryException, RemoteException { - try { - return node.isCheckedOut(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteVersionHistory getVersionHistory() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteVersionHistory(node.getVersionHistory()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteVersion getBaseVersion() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteVersion(node.getBaseVersion()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean isLocked() throws RepositoryException, RemoteException { - try { - return node.isLocked(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteProperty setProperty(String name, Value[] values, int type) - throws RepositoryException, RemoteException { - try { - Property property = node.setProperty(name, values, type); - return getFactory().getRemoteProperty(property); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void unlock() throws RepositoryException, RemoteException { - try { - node.unlock(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteLock getLock() throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteLock(node.getLock()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteLock lock(boolean isDeep, boolean isSessionScoped) - throws RepositoryException, RemoteException { - try { - Lock lock = node.lock(isDeep, isSessionScoped); - return getFactory().getRemoteLock(lock); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getSharedSet() - throws RepositoryException, RemoteException { - try { - NodeIterator sharedSet = node.getSharedSet(); - return getFactory().getRemoteNodeIterator(sharedSet); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void followLifecycleTransition(String transition) - throws RepositoryException, RemoteException { - try { - node.followLifecycleTransition(transition); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getAllowedLifecycleTransistions() - throws RepositoryException, RemoteException { - try { - return node.getAllowedLifecycleTransistions(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getWeakReferences() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemotePropertyIterator(node.getWeakReferences()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getWeakReferences(String name) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemotePropertyIterator(node.getWeakReferences(name)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeShare() throws RepositoryException, RemoteException { - try { - node.removeShare(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeSharedSet() throws RepositoryException, RemoteException { - try { - node.removeSharedSet(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void setPrimaryType(String nodeTypeName) - throws RepositoryException, RemoteException { - try { - node.setPrimaryType(nodeTypeName); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - //---------- Implementation helper ----------------------------------------- - - /** - * Returns the {@link Version} instance for the given UUID. - * - * @param versionUUID The UUID of the version. - * - * @return The version node. - * - * @throws RepositoryException if an error occurrs accessing the version - * node or if the UUID does not denote a version. - */ - protected Version getVersionByUUID(String versionUUID) - throws RepositoryException { - - // get the version node by its UUID from the version history's session - Session session = node.getSession(); - Node versionNode = session.getNodeByUUID(versionUUID); - - // check whether the node is a session, which it should be according - // to the spec (methods returning nodes should automatically return - // the correct type). - if (versionNode instanceof Version) { - return (Version) versionNode; - } - - // otherwise fail - throw new RepositoryException("Cannot find version " + versionUUID); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNodeDefinition.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNodeDefinition.java deleted file mode 100644 index eab72362eac..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNodeDefinition.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.nodetype.NodeDefinition; -import javax.jcr.nodetype.NodeType; - -import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; - -/** - * Remote adapter for the JCR {@link javax.jcr.nodetype.NodeDefinition NodeDefinition} - * interface. This class makes a local node definition available as an - * RMI service using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition RemoteNodeDefinition} - * interface. - * - * @see javax.jcr.nodetype.NodeDefinition - * @see org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition - */ -public class ServerNodeDefinition extends ServerItemDefinition implements RemoteNodeDefinition { - - /** The adapted node definition. */ - private NodeDefinition def; - - /** - * Creates a remote adapter for the given local node definition. - * - * @param def local node definition - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerNodeDefinition(NodeDefinition def, RemoteAdapterFactory factory) - throws RemoteException { - super(def, factory); - this.def = def; - } - - /** {@inheritDoc} */ - public RemoteNodeType[] getRequiredPrimaryTypes() throws RemoteException { - return getRemoteNodeTypeArray(def.getRequiredPrimaryTypes()); - } - - /** {@inheritDoc} */ - public RemoteNodeType getDefaultPrimaryType() throws RemoteException { - NodeType nt = def.getDefaultPrimaryType(); - if (nt == null) { - return null; - } else { - return getFactory().getRemoteNodeType(def.getDefaultPrimaryType()); - } - } - - /** {@inheritDoc} */ - public boolean allowsSameNameSiblings() throws RemoteException { - return def.allowsSameNameSiblings(); - } - - /** {@inheritDoc} */ - public String getDefaultPrimaryTypeName() throws RemoteException { - return def.getDefaultPrimaryTypeName(); - } - - /** {@inheritDoc} */ - public String[] getRequiredPrimaryTypeNames() throws RemoteException { - return def.getRequiredPrimaryTypeNames(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java deleted file mode 100644 index 918d06f32a2..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.Value; -import javax.jcr.nodetype.NodeDefinition; -import javax.jcr.nodetype.NodeType; -import javax.jcr.nodetype.PropertyDefinition; - -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; -import org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition; - -/** - * Remote adapter for the JCR {@link javax.jcr.nodetype.NodeType NodeType} - * interface. This class makes a local node type available as an RMI service - * using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeType RemoteNodeType} - * interface. - * - * @see javax.jcr.nodetype.NodeType - * @see org.apache.jackrabbit.rmi.remote.RemoteNodeType - */ -public class ServerNodeType extends ServerObject implements RemoteNodeType { - - /** The adapted local node type. */ - private NodeType type; - - /** - * Creates a remote adapter for the given local node type. - * - * @param type local node type - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerNodeType(NodeType type, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.type = type; - } - - /** - * Utility method for creating an array of remote references for - * local node definitions. The remote references are created using the - * remote adapter factory. - *

- * A null input is treated as an empty array. - * - * @param defs local node definition array - * @return remote node definition array - * @throws RemoteException on RMI errors - */ - private RemoteNodeDefinition[] getRemoteNodeDefArray(NodeDefinition[] defs) - throws RemoteException { - if (defs != null) { - RemoteNodeDefinition[] remotes = - new RemoteNodeDefinition[defs.length]; - for (int i = 0; i < defs.length; i++) { - remotes[i] = getFactory().getRemoteNodeDefinition(defs[i]); - } - return remotes; - } else { - return new RemoteNodeDefinition[0]; // for safety - } - } - - /** - * Utility method for creating an array of remote references for - * local property definitions. The remote references are created using the - * remote adapter factory. - *

- * A null input is treated as an empty array. - * - * @param defs local property definition array - * @return remote property definition array - * @throws RemoteException on RMI errors - */ - private RemotePropertyDefinition[] getRemotePropertyDefArray( - PropertyDefinition[] defs) throws RemoteException { - if (defs != null) { - RemotePropertyDefinition[] remotes = - new RemotePropertyDefinition[defs.length]; - for (int i = 0; i < defs.length; i++) { - remotes[i] = getFactory().getRemotePropertyDefinition(defs[i]); - } - return remotes; - } else { - return new RemotePropertyDefinition[0]; // for safety - } - } - - - /** {@inheritDoc} */ - public String getName() throws RemoteException { - return type.getName(); - } - - /** {@inheritDoc} */ - public boolean isMixin() throws RemoteException { - return type.isMixin(); - } - - /** {@inheritDoc} */ - public boolean isAbstract() throws RemoteException { - return type.isAbstract(); - } - - /** {@inheritDoc} */ - public boolean hasOrderableChildNodes() throws RemoteException { - return type.hasOrderableChildNodes(); - } - - /** {@inheritDoc} */ - public RemoteNodeType[] getSupertypes() throws RemoteException { - return getRemoteNodeTypeArray(type.getSupertypes()); - } - - /** {@inheritDoc} */ - public RemoteNodeType[] getDeclaredSupertypes() throws RemoteException { - return getRemoteNodeTypeArray(type.getDeclaredSupertypes()); - } - - /** {@inheritDoc} */ - public boolean isNodeType(String type) throws RemoteException { - return this.type.isNodeType(type); - } - - /** {@inheritDoc} */ - public RemotePropertyDefinition[] getPropertyDefs() throws RemoteException { - PropertyDefinition[] defs = type.getPropertyDefinitions(); - return getRemotePropertyDefArray(defs); - } - - /** {@inheritDoc} */ - public RemotePropertyDefinition[] getDeclaredPropertyDefs() - throws RemoteException { - PropertyDefinition[] defs = type.getDeclaredPropertyDefinitions(); - return getRemotePropertyDefArray(defs); - } - - /** {@inheritDoc} */ - public RemoteNodeDefinition[] getChildNodeDefs() throws RemoteException { - return getRemoteNodeDefArray(type.getChildNodeDefinitions()); - } - - /** {@inheritDoc} */ - public RemoteNodeDefinition[] getDeclaredChildNodeDefs() throws RemoteException { - return getRemoteNodeDefArray(type.getDeclaredChildNodeDefinitions()); - } - - /** {@inheritDoc} */ - public boolean canSetProperty(String name, Value value) - throws RemoteException { - return type.canSetProperty(name, value); - } - - /** {@inheritDoc} */ - public boolean canSetProperty(String name, Value[] values) - throws RemoteException { - return type.canSetProperty(name, values); - } - - /** {@inheritDoc} */ - public boolean canAddChildNode(String name) throws RemoteException { - return type.canAddChildNode(name); - } - - /** {@inheritDoc} */ - public boolean canAddChildNode(String name, String type) - throws RemoteException { - return this.type.canAddChildNode(name, type); - } - - /** {@inheritDoc} */ - public boolean canRemoveItem(String name) throws RemoteException { - return type.canRemoveItem(name); - } - - /** {@inheritDoc} */ - public String getPrimaryItemName() throws RemoteException { - return type.getPrimaryItemName(); - } - - /** {@inheritDoc} */ - public boolean canRemoveNode(String nodeName) { - return type.canRemoveNode(nodeName); - } - - /** {@inheritDoc} */ - public boolean canRemoveProperty(String propertyName) { - return type.canRemoveProperty(propertyName); - } - - /** {@inheritDoc} */ - public String[] getDeclaredSupertypeNames() { - return type.getDeclaredSupertypeNames(); - } - - /** {@inheritDoc} */ - public boolean isQueryable() { - return type.isQueryable(); - } - - /** {@inheritDoc} */ - public RemoteIterator getDeclaredSubtypes() throws RemoteException { - return getFactory().getRemoteNodeTypeIterator(type.getDeclaredSubtypes()); - } - - /** {@inheritDoc} */ - public RemoteIterator getSubtypes() throws RemoteException { - return getFactory().getRemoteNodeTypeIterator(type.getSubtypes()); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java deleted file mode 100644 index bb3fba80908..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.nodetype.NodeTypeManager; - -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; -import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager; - -/** - * Remote adapter for the JCR - * {@link javax.jcr.nodetype.NodeTypeManager NodeTypeManager} - * interface. This class makes a local node type manager available as an - * RMI service using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager RemoteNodeTypeManager} - * interface. - * - * @see javax.jcr.nodetype.NodeTypeManager - * @see org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager - */ -public class ServerNodeTypeManager extends ServerObject - implements RemoteNodeTypeManager { - - /** The adapted local node type manager. */ - private NodeTypeManager manager; - - /** - * Creates a remote adapter for the given local node type manager. - * - * @param manager local node type manager - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerNodeTypeManager( - NodeTypeManager manager, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.manager = manager; - } - - /** {@inheritDoc} */ - public RemoteNodeType getNodeType(String name) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeType(manager.getNodeType(name)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getAllNodeTypes() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeTypeIterator( - manager.getAllNodeTypes()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getPrimaryNodeTypes() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeTypeIterator( - manager.getPrimaryNodeTypes()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getMixinNodeTypes() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeTypeIterator( - manager.getMixinNodeTypes()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - public boolean hasNodeType(String name) - throws RepositoryException, RemoteException { - try { - return manager.hasNodeType(name); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - public void unregisterNodeTypes(String[] names) - throws RepositoryException, RemoteException { - try { - manager.unregisterNodeTypes(names); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java deleted file mode 100644 index e5be43c2498..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.io.Serializable; -import java.rmi.RemoteException; -import java.rmi.server.UnicastRemoteObject; -import java.util.ArrayList; -import java.util.List; - -import javax.jcr.AccessDeniedException; -import javax.jcr.InvalidItemStateException; -import javax.jcr.InvalidSerializedDataException; -import javax.jcr.Item; -import javax.jcr.ItemExistsException; -import javax.jcr.ItemNotFoundException; -import javax.jcr.LoginException; -import javax.jcr.MergeException; -import javax.jcr.NamespaceException; -import javax.jcr.NoSuchWorkspaceException; -import javax.jcr.Node; -import javax.jcr.PathNotFoundException; -import javax.jcr.Property; -import javax.jcr.ReferentialIntegrityException; -import javax.jcr.RepositoryException; -import javax.jcr.UnsupportedRepositoryOperationException; -import javax.jcr.Value; -import javax.jcr.ValueFormatException; -import javax.jcr.lock.LockException; -import javax.jcr.nodetype.ConstraintViolationException; -import javax.jcr.nodetype.NoSuchNodeTypeException; -import javax.jcr.nodetype.NodeType; -import javax.jcr.query.InvalidQueryException; -import javax.jcr.security.AccessControlException; -import javax.jcr.version.Version; -import javax.jcr.version.VersionException; -import javax.jcr.version.VersionHistory; - -import org.apache.jackrabbit.rmi.remote.RemoteItem; -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteNodeType; -import org.apache.jackrabbit.rmi.value.SerialValueFactory; - -/** - * Base class for remote adapters. The purpose of this class is to - * centralize the handling of the RemoteAdapterFactory instance used - * to instantiate new server adapters. - */ -public class ServerObject extends UnicastRemoteObject { - - /** Factory for creating server adapters. */ - private RemoteAdapterFactory factory; - - /** - * Creates a basic server adapter that uses the given factory - * to create new adapters. - * - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - protected ServerObject(RemoteAdapterFactory factory) - throws RemoteException { - super(factory.getPortNumber()); - this.factory = factory; - } - - /** - * Returns the remote adapter factory used to create new adapters. - * - * @return remote adapter factory - */ - protected RemoteAdapterFactory getFactory() { - return factory; - } - - /** - * Returns a cleaned version of the given exception. In some cases - * the underlying repository implementation may throw exceptions - * that are either unserializable, use exception subclasses that are - * only locally available, contain references to unserializable or - * only locally available classes. This method returns a cleaned - * version of such an exception. The returned exception contains only - * the message string from the original exception, and uses the public - * JCR exception class that most specifically matches the original - * exception. - * - * @param ex the original exception - * @return clean exception - */ - protected RepositoryException getRepositoryException( - RepositoryException ex) { - if (ex instanceof AccessDeniedException) { - return new AccessDeniedException(ex.getMessage()); - } else if (ex instanceof ConstraintViolationException) { - return new ConstraintViolationException(ex.getMessage()); - } else if (ex instanceof InvalidItemStateException) { - return new InvalidItemStateException(ex.getMessage()); - } else if (ex instanceof InvalidQueryException) { - return new InvalidQueryException(ex.getMessage()); - } else if (ex instanceof InvalidSerializedDataException) { - return new InvalidSerializedDataException(ex.getMessage()); - } else if (ex instanceof ItemExistsException) { - return new ItemExistsException(ex.getMessage()); - } else if (ex instanceof ItemNotFoundException) { - return new ItemNotFoundException(ex.getMessage()); - } else if (ex instanceof LockException) { - return new LockException(ex.getMessage()); - } else if (ex instanceof LoginException) { - return new LoginException(ex.getMessage()); - } else if (ex instanceof MergeException) { - return new MergeException(ex.getMessage()); - } else if (ex instanceof NamespaceException) { - return new NamespaceException(ex.getMessage()); - } else if (ex instanceof NoSuchNodeTypeException) { - return new NoSuchNodeTypeException(ex.getMessage()); - } else if (ex instanceof NoSuchWorkspaceException) { - return new NoSuchWorkspaceException(ex.getMessage()); - } else if (ex instanceof PathNotFoundException) { - return new PathNotFoundException(ex.getMessage()); - } else if (ex instanceof ReferentialIntegrityException) { - return new ReferentialIntegrityException(ex.getMessage()); - } else if (ex instanceof UnsupportedRepositoryOperationException) { - return new UnsupportedRepositoryOperationException(ex.getMessage()); - } else if (ex instanceof ValueFormatException) { - return new ValueFormatException(ex.getMessage()); - } else if (ex instanceof VersionException) { - return new VersionException(ex.getMessage()); - } else if (ex instanceof AccessControlException) { - return new AccessControlException(ex.getMessage()); - } else { - return new RepositoryException(ex.getMessage()); - } - } - - /** - * Utility method for creating a remote reference for a local item. - * Unlike the factory method for creating remote item references, this - * method introspects the type of the local item and returns the - * corresponding node, property, or item remote reference using the - * remote adapter factory. - *

- * If the item, this method calls the - * {@link #getRemoteNode(Node)} to return the correct remote type. - * - * @param item local node, property, or item - * @return remote node, property, or item reference - * @throws RemoteException on RMI errors - */ - protected RemoteItem getRemoteItem(Item item) throws RemoteException { - if (item instanceof Property) { - return factory.getRemoteProperty((Property) item); - } else if (item instanceof Node) { - return getRemoteNode((Node) item); - } else { - return factory.getRemoteItem(item); - } - } - - /** - * Utility method for creating a remote reference for a local node. - * Unlike the factory method for creating remote node references, this - * method introspects the type of the local node and returns the - * corresponding node, version, or version history remote reference using - * the remote adapter factory. - * - * @param node local version, versionhistory, or normal node - * @return remote node, property, or item reference - * @throws RemoteException on RMI errors - */ - protected RemoteNode getRemoteNode(Node node) throws RemoteException { - if (node instanceof Version) { - return factory.getRemoteVersion((Version) node); - } else if (node instanceof VersionHistory) { - return factory.getRemoteVersionHistory((VersionHistory) node); - } else { - return factory.getRemoteNode(node); - } - } - - /** - * Utility method for creating an array of remote references for - * local node types. The remote references are created using the - * remote adapter factory. - *

- * A null input is treated as an empty array. - * - * @param types local node type array - * @return remote node type array - * @throws RemoteException on RMI errors - */ - protected RemoteNodeType[] getRemoteNodeTypeArray(NodeType[] types) - throws RemoteException { - if (types != null) { - RemoteNodeType[] remotes = new RemoteNodeType[types.length]; - for (int i = 0; i < types.length; i++) { - remotes[i] = factory.getRemoteNodeType(types[i]); - } - return remotes; - } else { - return new RemoteNodeType[0]; // for safety - } - } - - /** - * Utility method for preparing an array of values for serialization. - * The returned array will contain serializable versions of all the - * given values. - *

- * If the given array is null, then an empty array is - * returned. - * - * @param values the values to be decorated - * @return array of decorated values - * @throws RepositoryException if the values can not be serialized - */ - protected Value[] getSerialValues(Value[] values) - throws RepositoryException { - List serials = new ArrayList(); - if (values != null) { - for (Value value : values) { - if (value != null) { - serials.add(getSerialValue(value)); - } - } - } - return serials.toArray(new Value[serials.size()]); - } - - /** - * Utility method for decorating a value. Note that the contents of the - * original values will only be copied when the decorators are serialized. - * Null referenced and already serializable values are passed as-is. - * - * @param value the value to be decorated, or null - * @return the decorated value, or null - * @throws RepositoryException if the value can not be serialized - */ - protected Value getSerialValue(Value value) throws RepositoryException { - // if the value is null or already serializable, just return it - if (value == null || value instanceof Serializable) { - return value; - } else { - return SerialValueFactory.makeSerialValue(value); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObservationManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObservationManager.java deleted file mode 100644 index a382e03f400..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObservationManager.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; -import java.util.HashMap; -import java.util.Map; - -import javax.jcr.RepositoryException; -import javax.jcr.observation.ObservationManager; - -import org.apache.jackrabbit.rmi.observation.Queue; -import org.apache.jackrabbit.rmi.observation.ServerEventListenerProxy; -import org.apache.jackrabbit.rmi.remote.RemoteEventCollection; -import org.apache.jackrabbit.rmi.remote.RemoteObservationManager; - -/** - * Remote adapter for the JCR - * {@link javax.jcr.observation.ObservationManager ObservationManager} interface. - * This class makes a local item available as an RMI service using - * the {@link org.apache.jackrabbit.rmi.remote.RemoteObservationManager RemoteObservationManager} - * interface. - *

- * This class works in conjunction with the - * {@link org.apache.jackrabbit.rmi.client.ClientObservationManager} class to - * implement the distributed the event listener registration described in - * observation package - * comment. - * - * @see javax.jcr.observation.ObservationManager - * @see org.apache.jackrabbit.rmi.remote.RemoteObservationManager - */ -public class ServerObservationManager extends ServerObject implements - RemoteObservationManager { - - /** The adapted local observation manager. */ - private ObservationManager observationManager; - - /** - * The map of event listener proxies indexed by the unique identifier. - */ - private Map proxyMap; - - /** - * The queue to which event listener proxies post events to be reported - * by the {@link #getNextEvent(long)} method. - */ - private Queue queue; - - /** - * Creates a remote adapter for the given local workspace. - * - * @param observationManager local observation manager - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerObservationManager(ObservationManager observationManager, - RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.observationManager = observationManager; - } - - /** {@inheritDoc} */ - public void addEventListener(long listenerId, int eventTypes, - String absPath, boolean isDeep, String[] uuid, String[] nodeTypeName, - boolean noLocal) throws RepositoryException, RemoteException { - - // find the proxy or create one - ServerEventListenerProxy proxy; - synchronized (this) { - if (proxyMap == null) { - proxyMap = new HashMap(); - } - - Long id = Long.valueOf(listenerId); - proxy = proxyMap.get(id); - if (proxy == null) { - proxy = new ServerEventListenerProxy(getFactory(), listenerId, - getQueue()); - proxyMap.put(id, proxy); - } - } - - // register the proxy with the observation manager - observationManager.addEventListener(proxy, eventTypes, absPath, - isDeep, uuid, nodeTypeName, noLocal); - } - - /** {@inheritDoc} */ - public void removeEventListener(long listenerId) - throws RepositoryException, RemoteException { - - // try to find the proxy in the map - ServerEventListenerProxy proxy; - synchronized (this) { - if (proxyMap == null) { - return; - } - - Long id = new Long(listenerId); - proxy = (ServerEventListenerProxy) proxyMap.remove(id); - if (proxy == null) { - return; - } - } - - // register the proxy with the observation manager - observationManager.removeEventListener(proxy); - } - - /** {@inheritDoc} */ - public RemoteEventCollection getNextEvent(long timeout) throws RemoteException { - // need the queue - checkQueue(); - - try { - if (timeout < 0) { - timeout = 0; - } - return (RemoteEventCollection) queue.get(timeout); - } catch (InterruptedException ie) { - // don't retry, but log - } - - // did not get anything, fall back to nothing - return null; - } - - //---------- internal ------------------------------------------------------ - - /** - * Makes sure, the {@link #queue} field is assigned a value. - */ - private synchronized void checkQueue() { - if (queue == null) { - queue = new Queue(); - } - } - - /** - * Returns the Channel allocating it if required. - * - * @return queue - */ - private Queue getQueue() { - checkQueue(); - return queue; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerProperty.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerProperty.java deleted file mode 100644 index f4806ed6a31..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerProperty.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.Property; -import javax.jcr.RepositoryException; -import javax.jcr.Value; - -import org.apache.jackrabbit.rmi.remote.RemoteProperty; -import org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition; -import org.apache.jackrabbit.rmi.value.SerialValueFactory; - -/** - * Remote adapter for the JCR {@link javax.jcr.Property Property} - * interface. This class makes a local property available as an RMI service - * using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteProperty RemoteProperty} - * interface. - * - * @see javax.jcr.Property - * @see org.apache.jackrabbit.rmi.remote.RemoteProperty - */ -public class ServerProperty extends ServerItem implements RemoteProperty { - - /** The adapted local property. */ - private Property property; - - /** - * Creates a remote adapter for the given local property. - * - * @param property local property - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerProperty(Property property, RemoteAdapterFactory factory) - throws RemoteException { - super(property, factory); - this.property = property; - } - - /** {@inheritDoc} */ - public Value getValue() throws RepositoryException, RemoteException { - try { - return SerialValueFactory.makeSerialValue(property.getValue()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Value[] getValues() throws RepositoryException, RemoteException { - try { - return getSerialValues(property.getValues()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void setValue(Value value) - throws RepositoryException, RemoteException { - try { - property.setValue(value); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void setValue(Value[] values) - throws RepositoryException, RemoteException { - try { - property.setValue(values); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public long getLength() throws RepositoryException, RemoteException { - try { - return property.getLength(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public long[] getLengths() throws RepositoryException, RemoteException { - try { - return property.getLengths(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemotePropertyDefinition getDefinition() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemotePropertyDefinition(property.getDefinition()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public int getType() throws RepositoryException, RemoteException { - try { - return property.getType(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerPropertyDefinition.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerPropertyDefinition.java deleted file mode 100644 index 42655a2d366..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerPropertyDefinition.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.Value; -import javax.jcr.nodetype.PropertyDefinition; - -import org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition; - -/** - * Remote adapter for the JCR - * {@link javax.jcr.nodetype.PropertyDefinition PropertyDefinition} interface. This - * class makes a local property definition available as an RMI service - * using the - * {@link org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition RemotePropertyDefinition} - * interface. - * - * @see javax.jcr.nodetype.PropertyDefinition - * @see org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition - */ -public class ServerPropertyDefinition extends ServerItemDefinition - implements RemotePropertyDefinition { - - /** The adapted local property definition. */ - private PropertyDefinition def; - - /** - * Creates a remote adapter for the given local property definition. - * - * @param def local property definition - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerPropertyDefinition(PropertyDefinition def, RemoteAdapterFactory factory) - throws RemoteException { - super(def, factory); - this.def = def; - } - - /** {@inheritDoc} */ - public int getRequiredType() throws RemoteException { - return def.getRequiredType(); - } - - /** {@inheritDoc} */ - public String[] getValueConstraints() throws RemoteException { - return def.getValueConstraints(); - } - - /** {@inheritDoc} */ - public Value[] getDefaultValues() throws RemoteException { - try { - return getSerialValues(def.getDefaultValues()); - } catch (RepositoryException e) { - throw new RemoteException("Unable to serialize default values"); - } - } - - /** {@inheritDoc} */ - public boolean isMultiple() throws RemoteException { - return def.isMultiple(); - } - - /** {@inheritDoc} */ - public String[] getAvailableQueryOperators() throws RemoteException { - return def.getAvailableQueryOperators(); - } - - /** {@inheritDoc} */ - public boolean isFullTextSearchable() throws RemoteException { - return def.isFullTextSearchable(); - } - - /** {@inheritDoc} */ - public boolean isQueryOrderable() throws RemoteException { - return def.isQueryOrderable(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerQuery.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerQuery.java deleted file mode 100644 index 8aeec951d89..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerQuery.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.Value; -import javax.jcr.query.Query; - -import org.apache.jackrabbit.rmi.remote.RemoteQuery; -import org.apache.jackrabbit.rmi.remote.RemoteQueryResult; -import org.apache.jackrabbit.rmi.remote.RemoteNode; - -/** - * Remote adapter for the JCR {@link javax.jcr.query.Query Query} interface. - * This class makes a local session available as an RMI service using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteQuery RemoteQuery} - * interface. - * - * @see javax.jcr.query.Query - * @see org.apache.jackrabbit.rmi.remote.RemoteQuery - */ -public class ServerQuery extends ServerObject implements RemoteQuery { - - /** The adapted local query manager. */ - private Query query; - - /** - * Creates a remote adapter for the given local Query. - * - * @param query local Query - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerQuery(Query query, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.query = query; - } - - /** {@inheritDoc} */ - public RemoteQueryResult execute() - throws RepositoryException, RemoteException { - return getFactory().getRemoteQueryResult(query.execute()); - } - - /** {@inheritDoc} */ - public String getStatement() throws RemoteException { - return query.getStatement(); - } - - /** {@inheritDoc} */ - public String getLanguage() throws RemoteException { - return query.getLanguage(); - } - - /** {@inheritDoc} */ - public String getStoredQueryPath() - throws RepositoryException, RemoteException { - return query.getStoredQueryPath(); - } - - /** {@inheritDoc} */ - public RemoteNode storeAsNode(String absPath) - throws RepositoryException, RemoteException { - return getRemoteNode(query.storeAsNode(absPath)); - } - - /** {@inheritDoc} */ - public void bindValue(String varName, Value value) - throws RepositoryException, RemoteException { - query.bindValue(varName, value); - } - - /** {@inheritDoc} */ - public String[] getBindVariableNames() - throws RepositoryException, RemoteException { - try { - return query.getBindVariableNames(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void setLimit(long limit) throws RemoteException { - query.setLimit(limit); - } - - /** {@inheritDoc} */ - public void setOffset(long offset) throws RemoteException { - query.setOffset(offset); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerQueryManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerQueryManager.java deleted file mode 100644 index c70904ee21e..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerQueryManager.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.Item; -import javax.jcr.Node; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.query.InvalidQueryException; -import javax.jcr.query.Query; -import javax.jcr.query.QueryManager; - -import org.apache.jackrabbit.rmi.remote.RemoteQuery; -import org.apache.jackrabbit.rmi.remote.RemoteQueryManager; - -/** - * Remote adapter for the JCR {@link javax.jcr.query.QueryManager QueryManager} - * interface. This class makes a local query manager available as an RMI - * service using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteQueryManager RemoteQueryManager} - * interface. - * - * @see javax.jcr.query.QueryManager - * @see org.apache.jackrabbit.rmi.remote.RemoteQueryManager - */ -public class ServerQueryManager extends ServerObject - implements RemoteQueryManager { - - /** The current session. */ - private Session session; - - /** The adapted local query manager. */ - private QueryManager manager; - - /** - * Creates a remote adapter for the given local query manager. - * - * @param session current session - * @param manager local query manager - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerQueryManager( - Session session, QueryManager manager, ServerAdapterFactory factory) - throws RemoteException { - super(factory); - this.session = session; - this.manager = manager; - } - - /** {@inheritDoc} */ - public RemoteQuery createQuery(String statement, String language) - throws RepositoryException, RemoteException { - try { - Query query = manager.createQuery(statement, language); - return getFactory().getRemoteQuery(query); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteQuery getQuery(String absPath) - throws RepositoryException, RemoteException { - try { - Item item = session.getItem(absPath); - if (!item.isNode()) { - throw new InvalidQueryException("Not a query node: " + absPath); - } - return getFactory().getRemoteQuery(manager.getQuery((Node) item)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getSupportedQueryLanguages() - throws RepositoryException, RemoteException { - try { - return manager.getSupportedQueryLanguages(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerQueryResult.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerQueryResult.java deleted file mode 100644 index 36535e9867c..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerQueryResult.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.query.QueryResult; - -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteQueryResult; - -/** - * Remote adapter for the JCR {@link javax.jcr.query.QueryResult QueryResult} interface. - * This class makes a local session available as an RMI service using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteQueryResult RemoteQueryResult} - * interface. - * - * @see javax.jcr.query.QueryResult - * @see org.apache.jackrabbit.rmi.remote.RemoteQueryResult - */ -public class ServerQueryResult extends ServerObject - implements RemoteQueryResult { - - /** The adapted local query result. */ - private QueryResult result; - - /** - * Creates a remote adapter for the given local QueryResult. - * - * @param result local QueryResult - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerQueryResult(QueryResult result, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.result = result; - } - - /** {@inheritDoc} */ - public String[] getColumnNames() - throws RepositoryException, RemoteException { - return result.getColumnNames(); - } - - /** {@inheritDoc} */ - public RemoteIterator getRows() throws RepositoryException, RemoteException { - return getFactory().getRemoteRowIterator(result.getRows()); - } - - /** {@inheritDoc} */ - public RemoteIterator getNodes() throws RepositoryException, RemoteException { - return getFactory().getRemoteNodeIterator(result.getNodes()); - } - - /** {@inheritDoc} */ - public String[] getSelectorNames() throws RepositoryException, RemoteException { - return result.getSelectorNames(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerRepository.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerRepository.java deleted file mode 100644 index 75d764376db..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerRepository.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.Credentials; -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.Value; - -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.remote.RemoteSession; -import org.apache.jackrabbit.rmi.value.SerialValueFactory; - -/** - * Remote adapter for the JCR {@link javax.jcr.Repository Repository} - * interface. This class makes a local repository available as an RMI service - * using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteRepository RemoteRepository} - * interface. - * - * @see javax.jcr.Repository - * @see org.apache.jackrabbit.rmi.remote.RemoteRepository - */ -public class ServerRepository extends ServerObject implements RemoteRepository { - - /** The adapted local repository. */ - private Repository repository; - - /** - * Creates a remote adapter for the given local repository. - * - * @param repository local repository - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerRepository( - Repository repository, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.repository = repository; - } - - /** {@inheritDoc} */ - public String getDescriptor(String name) throws RemoteException { - return repository.getDescriptor(name); - } - - /** {@inheritDoc} */ - public String[] getDescriptorKeys() throws RemoteException { - return repository.getDescriptorKeys(); - } - - /** {@inheritDoc} */ - public RemoteSession login() throws RepositoryException, RemoteException { - try { - Session session = repository.login(); - return getFactory().getRemoteSession(session); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteSession login(String workspace) - throws RepositoryException, RemoteException { - try { - Session session = repository.login(workspace); - return getFactory().getRemoteSession(session); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteSession login(Credentials credentials) - throws RepositoryException, RemoteException { - try { - Session session = repository.login(credentials); - return getFactory().getRemoteSession(session); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteSession login(Credentials credentials, String workspace) - throws RepositoryException, RemoteException { - try { - Session session = repository.login(credentials, workspace); - return getFactory().getRemoteSession(session); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Value getDescriptorValue(String key) throws RemoteException { - try { - return SerialValueFactory.makeSerialValue(repository.getDescriptorValue(key)); - } catch (RepositoryException ex) { - throw new RemoteException(ex.getMessage(), ex); - } - } - - /** {@inheritDoc} */ - public Value[] getDescriptorValues(String key) throws RemoteException { - try { - return SerialValueFactory.makeSerialValueArray(repository.getDescriptorValues(key)); - } catch (RepositoryException ex) { - throw new RemoteException(ex.getMessage(), ex); - } - } - - /** {@inheritDoc} */ - public boolean isSingleValueDescriptor(String key) throws RemoteException { - return repository.isSingleValueDescriptor(key); - } - - /** {@inheritDoc} */ - public boolean isStandardDescriptor(String key) throws RemoteException { - return repository.isStandardDescriptor(key); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerRow.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerRow.java deleted file mode 100644 index f14283f6891..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerRow.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.Value; -import javax.jcr.query.Row; - -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteRow; -import org.apache.jackrabbit.rmi.value.SerialValueFactory; - -/** - * Remote adapter for the JCR {@link javax.jcr.query.Row Row} interface. - * This class makes a local session available as an RMI service using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteRow RemoteRow} - * interface. - * - * @see javax.jcr.query.Row - * @see org.apache.jackrabbit.rmi.remote.RemoteRow - */ -public class ServerRow extends ServerObject implements RemoteRow { - - /** The adapted local row. */ - private Row row; - - /** - * Creates a remote adapter for the given local query row. - * - * @param row local query row - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerRow(Row row, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.row = row; - } - - /** {@inheritDoc} */ - public Value[] getValues() throws RepositoryException, RemoteException { - try { - return getSerialValues(row.getValues()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Value getValue(String propertyName) - throws RepositoryException, RemoteException { - try { - return SerialValueFactory.makeSerialValue(row.getValue(propertyName)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNode getNode() - throws RepositoryException, RemoteException { - try { - return getRemoteNode(row.getNode()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNode getNode(String selectorName) - throws RepositoryException, RemoteException { - try { - return getRemoteNode(row.getNode(selectorName)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getPath() - throws RepositoryException, RemoteException { - try { - return row.getPath(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getPath(String selectorName) - throws RepositoryException, RemoteException { - try { - return row.getPath(selectorName); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public double getScore() - throws RepositoryException, RemoteException { - try { - return row.getScore(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public double getScore(String selectorName) - throws RepositoryException, RemoteException { - try { - return row.getScore(selectorName); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java deleted file mode 100644 index 0ec4e164f89..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java +++ /dev/null @@ -1,351 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.rmi.RemoteException; - -import javax.jcr.Credentials; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.UnsupportedRepositoryOperationException; - -import org.apache.jackrabbit.rmi.remote.RemoteItem; -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteProperty; -import org.apache.jackrabbit.rmi.remote.RemoteSession; -import org.apache.jackrabbit.rmi.remote.RemoteWorkspace; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager; - -/** - * Remote adapter for the JCR {@link javax.jcr.Session Session} interface. - * This class makes a local session available as an RMI service using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteSession RemoteSession} - * interface. - * - * @see javax.jcr.Session - * @see org.apache.jackrabbit.rmi.remote.RemoteSession - */ -public class ServerSession extends ServerObject implements RemoteSession { - - /** The adapted local session. */ - private Session session; - - /** - * The server workspace for this session. This field is assigned on demand - * by the first call to {@link #getWorkspace()}. The assumption is that - * there is only one workspace instance per session and that each call to - * the Session.getWorkspace() method of a single session will - * allways return the same object. - */ - private RemoteWorkspace remoteWorkspace; - - /** - * Creates a remote adapter for the given local session. - * - * @param session local session - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerSession(Session session, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.session = session; - } - - /** {@inheritDoc} */ - public String getUserID() throws RemoteException { - return session.getUserID(); - } - - /** {@inheritDoc} */ - public Object getAttribute(String name) throws RemoteException { - return session.getAttribute(name); - } - - /** {@inheritDoc} */ - public String[] getAttributeNames() throws RemoteException { - return session.getAttributeNames(); - } - - /** {@inheritDoc} */ - public RemoteSession impersonate(Credentials credentials) - throws RepositoryException, RemoteException { - try { - Session newSession = session.impersonate(credentials); - return getFactory().getRemoteSession(newSession); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteWorkspace getWorkspace() throws RemoteException { - if (remoteWorkspace == null) { - remoteWorkspace = - getFactory().getRemoteWorkspace(session.getWorkspace()); - } - - return remoteWorkspace; - } - - /** {@inheritDoc} */ - public boolean hasPermission(String path, String actions) - throws RepositoryException, RemoteException { - return session.hasPermission(path, actions); - } - - /** {@inheritDoc} */ - public String getNamespacePrefix(String uri) - throws RepositoryException, RemoteException { - try { - return session.getNamespacePrefix(uri); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getNamespacePrefixes() - throws RepositoryException, RemoteException { - try { - return session.getNamespacePrefixes(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getNamespaceURI(String prefix) - throws RepositoryException, RemoteException { - try { - return session.getNamespaceURI(prefix); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void setNamespacePrefix(String prefix, String uri) - throws RepositoryException, RemoteException { - try { - session.setNamespacePrefix(prefix, uri); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean itemExists(String path) throws RepositoryException, RemoteException { - return session.itemExists(path); - } - - /** {@inheritDoc} */ - public boolean nodeExists(String path) throws RepositoryException, RemoteException { - return session.nodeExists(path); - } - - /** {@inheritDoc} */ - public boolean propertyExists(String path) throws RepositoryException, RemoteException { - return session.propertyExists(path); - } - - /** {@inheritDoc} */ - public RemoteNode getNodeByIdentifier(String id) - throws RepositoryException, RemoteException { - try { - return getRemoteNode(session.getNodeByIdentifier(id)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - @SuppressWarnings("deprecation") - public RemoteNode getNodeByUUID(String uuid) - throws RepositoryException, RemoteException { - try { - return getRemoteNode(session.getNodeByUUID(uuid)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNode getRootNode() - throws RepositoryException, RemoteException { - try { - return getRemoteNode(session.getRootNode()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteItem getItem(String path) - throws RepositoryException, RemoteException { - try { - return getRemoteItem(session.getItem(path)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNode getNode(String path) - throws RepositoryException, RemoteException { - try { - return getRemoteNode(session.getNode(path)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteProperty getProperty(String path) - throws RepositoryException, RemoteException { - try { - return (RemoteProperty) getRemoteItem(session.getProperty(path)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasPendingChanges() - throws RepositoryException, RemoteException { - try { - return session.hasPendingChanges(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeItem(String path) - throws RepositoryException, RemoteException { - try { - session.removeItem(path); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void move(String from, String to) - throws RepositoryException, RemoteException { - try { - session.move(from, to); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void save() throws RepositoryException, RemoteException { - try { - session.save(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void refresh(boolean keepChanges) - throws RepositoryException, RemoteException { - try { - session.refresh(keepChanges); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void logout() throws RemoteException { - session.logout(); - } - - /** {@inheritDoc} */ - public boolean isLive() throws RemoteException { - return session.isLive(); - } - - /** {@inheritDoc} */ - public void importXML(String path, byte[] xml, int mode) - throws IOException, RepositoryException, RemoteException { - try { - session.importXML(path, new ByteArrayInputStream(xml), mode); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void addLockToken(String token) throws RemoteException { - session.addLockToken(token); - } - - /** {@inheritDoc} */ - public String[] getLockTokens() throws RemoteException { - return session.getLockTokens(); - } - - /** {@inheritDoc} */ - public void removeLockToken(String token) throws RemoteException { - session.removeLockToken(token); - } - - /** {@inheritDoc} */ - public byte[] exportDocumentView( - String path, boolean binaryAsLink, boolean noRecurse) - throws IOException, RepositoryException, RemoteException { - try { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - session.exportDocumentView(path, buffer, binaryAsLink, noRecurse); - return buffer.toByteArray(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public byte[] exportSystemView( - String path, boolean binaryAsLink, boolean noRecurse) - throws IOException, RepositoryException, RemoteException { - try { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - session.exportSystemView(path, buffer, binaryAsLink, noRecurse); - return buffer.toByteArray(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteAccessControlManager getAccessControlManager() - throws UnsupportedRepositoryOperationException, - RepositoryException, RemoteException { - try { - return getFactory().getRemoteAccessControlManager( - session.getAccessControlManager()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerVersion.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerVersion.java deleted file mode 100644 index 581a9d0359c..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerVersion.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; -import java.util.Calendar; - -import javax.jcr.RepositoryException; -import javax.jcr.version.Version; - -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteVersion; -import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory; - -/** - * Remote adapter for the JCR {@link javax.jcr.version.Version Version} interface. - * This class makes a local version available as an RMI service using - * the {@link org.apache.jackrabbit.rmi.remote.RemoteVersion RemoteVersion} - * interface. - * - * @see javax.jcr.version.Version - * @see org.apache.jackrabbit.rmi.remote.RemoteVersion - */ -public class ServerVersion extends ServerNode implements RemoteVersion { - - /** The adapted local version. */ - private Version version; - - /** - * Creates a remote adapter for the given local version. - * - * @param version local version - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerVersion(Version version, RemoteAdapterFactory factory) - throws RemoteException { - super(version, factory); - this.version = version; - } - - /** - * Utility method for creating an array of remote references for - * local versions. The remote references are created using the - * remote adapter factory. - *

- * A null input is treated as an empty array. - * - * @param versions local version array - * @return remote version array - * @throws RemoteException on RMI errors - */ - private RemoteVersion[] getRemoteVersionArray(Version[] versions) - throws RemoteException { - if (versions != null) { - RemoteVersion[] remotes = new RemoteVersion[versions.length]; - for (int i = 0; i < remotes.length; i++) { - remotes[i] = getFactory().getRemoteVersion(versions[i]); - } - return remotes; - } else { - return new RemoteVersion[0]; // for safety - } - } - - /** {@inheritDoc} */ - public RemoteVersionHistory getContainingHistory() throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteVersionHistory(version.getContainingHistory()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public Calendar getCreated() throws RepositoryException { - try { - return version.getCreated(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteVersion getLinearSuccessor() throws RepositoryException, - RemoteException { - try { - Version linearSuccessor = version.getLinearSuccessor(); - if (linearSuccessor == null) { - return null; - } else { - return getFactory().getRemoteVersion(linearSuccessor); - } - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteVersion[] getSuccessors() throws RepositoryException, RemoteException { - try { - return getRemoteVersionArray(version.getSuccessors()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteVersion getLinearPredecessor() throws RepositoryException, - RemoteException { - try { - Version linearPredecessor = version.getLinearPredecessor(); - if (linearPredecessor == null) { - return null; - } else { - return getFactory().getRemoteVersion(linearPredecessor); - } - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteVersion[] getPredecessors() throws RepositoryException, RemoteException { - try { - return getRemoteVersionArray(version.getPredecessors()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNode getFrozenNode() throws RepositoryException, - RemoteException { - try { - return getFactory().getRemoteNode(version.getFrozenNode()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerVersionHistory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerVersionHistory.java deleted file mode 100644 index 466a496fb1d..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerVersionHistory.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.version.Version; -import javax.jcr.version.VersionHistory; - -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteVersion; -import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory; - -/** - * Remote adapter for the JCR {@link javax.jcr.version.VersionHistory VersionHistory} - * interface. This class makes a local version history available as an RMI - * service using the - * {@link org.apache.jackrabbit.rmi.remote.RemoteVersionHistory RemoteVersionHistory} - * interface. - * - * @see javax.jcr.version.VersionHistory - * @see org.apache.jackrabbit.rmi.remote.RemoteVersionHistory - */ -public class ServerVersionHistory extends ServerNode - implements RemoteVersionHistory { - - /** The adapted local version history. */ - private VersionHistory versionHistory; - - /** - * Creates a remote adapter for the given local version history. - * - * @param versionHistory local version history - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerVersionHistory(VersionHistory versionHistory, - RemoteAdapterFactory factory) throws RemoteException { - super(versionHistory, factory); - this.versionHistory = versionHistory; - } - - /** {@inheritDoc} */ - public String getVersionableIdentifier() throws RepositoryException, - RemoteException { - try { - return versionHistory.getVersionableIdentifier(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteVersion getRootVersion() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteVersion(versionHistory.getRootVersion()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getAllLinearVersions() throws RepositoryException, - RemoteException { - try { - return getFactory().getRemoteVersionIterator( - versionHistory.getAllLinearVersions()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getAllVersions() - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteVersionIterator( - versionHistory.getAllVersions()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getAllLinearFrozenNodes() throws RepositoryException, - RemoteException { - try { - return getFactory().getRemoteNodeIterator( - versionHistory.getAllLinearFrozenNodes()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteIterator getAllFrozenNodes() throws RepositoryException, - RemoteException { - try { - return getFactory().getRemoteNodeIterator( - versionHistory.getAllFrozenNodes()); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteVersion getVersion(String versionName) - throws RepositoryException, RemoteException { - try { - Version version = versionHistory.getVersion(versionName); - return getFactory().getRemoteVersion(version); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteVersion getVersionByLabel(String label) - throws RepositoryException, RemoteException { - try { - Version version = versionHistory.getVersionByLabel(label); - return getFactory().getRemoteVersion(version); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void addVersionLabel(String versionName, String label, - boolean moveLabel) throws RepositoryException, RemoteException { - try { - versionHistory.addVersionLabel(versionName, label, moveLabel); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeVersionLabel(String label) throws RepositoryException, - RemoteException { - try { - versionHistory.removeVersionLabel(label); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public boolean hasVersionLabel(String label) throws RepositoryException, RemoteException { - return versionHistory.hasVersionLabel(label); - } - - /** {@inheritDoc} */ - public boolean hasVersionLabel(String versionUUID, String label) - throws RepositoryException, RemoteException { - try { - Version version = getVersionByUUID(versionUUID); - return versionHistory.hasVersionLabel(version, label); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getVersionLabels() throws RepositoryException, RemoteException { - return versionHistory.getVersionLabels(); - } - - /** {@inheritDoc} */ - public String[] getVersionLabels(String versionUUID) - throws RepositoryException, RemoteException { - try { - Version version = getVersionByUUID(versionUUID); - return versionHistory.getVersionLabels(version); - } catch (ClassCastException cce) { - // we do not expect this here as nodes should be returned correctly - throw getRepositoryException(new RepositoryException(cce)); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void removeVersion(String versionName) - throws RepositoryException, RemoteException { - try { - versionHistory.removeVersion(versionName); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String getVersionableUUID() throws RepositoryException, RemoteException { - return versionHistory.getVersionableUUID(); - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerVersionManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerVersionManager.java deleted file mode 100644 index d8766af3a35..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerVersionManager.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.Node; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.version.Version; -import javax.jcr.version.VersionManager; - -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.RemoteNode; -import org.apache.jackrabbit.rmi.remote.RemoteVersion; -import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory; -import org.apache.jackrabbit.rmi.remote.RemoteVersionManager; - -public class ServerVersionManager extends ServerObject - implements RemoteVersionManager { - - private final Session session; - - private final VersionManager manager; - - public ServerVersionManager(Session session, - VersionManager manager, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.session = session; - this.manager = manager; - } - - public RemoteVersion checkin(String absPath) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteVersion(manager.checkin(absPath)); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public void checkout(String absPath) throws RepositoryException { - try { - manager.checkout(absPath); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public RemoteVersion checkpoint(String absPath) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteVersion(manager.checkpoint(absPath)); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public RemoteNode createActivity(String title) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNode(manager.createActivity(title)); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public RemoteNode createConfiguration(String absPath) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNode( - manager.createConfiguration(absPath)); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public RemoteNode getActivity() - throws RepositoryException, RemoteException { - try { - Node activity = manager.getActivity(); - if (activity == null) { - return null; - } else { - return getFactory().getRemoteNode(activity); - } - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public RemoteVersion getBaseVersion(String absPath) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteVersion( - manager.getBaseVersion(absPath)); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public RemoteVersionHistory getVersionHistory(String absPath) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteVersionHistory( - manager.getVersionHistory(absPath)); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public boolean isCheckedOut(String absPath) - throws RepositoryException { - try { - return manager.isCheckedOut(absPath); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public RemoteIterator merge( - String absPath, String srcWorkspace, boolean bestEffort) - throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeIterator( - manager.merge(absPath, srcWorkspace, bestEffort)); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public RemoteIterator merge( - String absPath, String srcWorkspace, boolean bestEffort, - boolean isShallow) throws RepositoryException, RemoteException { - try { - return getFactory().getRemoteNodeIterator( - manager.merge(absPath, srcWorkspace, bestEffort, isShallow)); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public void restore( - String absPath, String versionName, boolean removeExisting) - throws RepositoryException { - try { - manager.restore(absPath, versionName, removeExisting); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public void restoreByLabel( - String absPath, String versionLabel, boolean removeExisting) - throws RepositoryException { - try { - manager.restoreByLabel(absPath, versionLabel, removeExisting); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public void cancelMerge(String absPath, String versionIdentifier) - throws RepositoryException, RemoteException { - try { - Version version = (Version) session.getNodeByIdentifier(versionIdentifier); - manager.cancelMerge(absPath, version); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - public void doneMerge(String absPath, String versionIdentifier) - throws RepositoryException, RemoteException { - try { - Version version = (Version) session.getNodeByIdentifier(versionIdentifier); - manager.doneMerge(absPath, version); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - @Override - public void restore(String[] versionIdentifiers, boolean removeExisting) - throws RepositoryException, RemoteException { - try { - Version[] versions = new Version[versionIdentifiers.length]; - for (int i = 0; i < versions.length; i++) { - Version version = (Version) session.getNodeByIdentifier(versionIdentifiers[i]); - versions[i] = version; - } - manager.restore(versions, removeExisting); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - @Override - public void restore(String versionIdentifier, boolean removeExisting) - throws RepositoryException, RemoteException { - try { - Version version = (Version) session.getNodeByIdentifier(versionIdentifier); - manager.restore(version, removeExisting); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - @Override - public RemoteNode setActivity(String activityNodeIdentifier) - throws RepositoryException, RemoteException { - try { - Node newActivityNode; - if (activityNodeIdentifier == null) { - newActivityNode = null; - } else { - newActivityNode = session.getNodeByIdentifier(activityNodeIdentifier); - } - Node oldActivityNode = manager.setActivity(newActivityNode); - if (oldActivityNode == null) { - return null; - } else { - return getFactory().getRemoteNode(oldActivityNode); - } - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - @Override - public void removeActivity(String activityNodeIdentifier) - throws RepositoryException, RemoteException { - try { - Node activityNode = session.getNodeByIdentifier(activityNodeIdentifier); - manager.removeActivity(activityNode); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - @Override - public RemoteIterator merge(String activityNodeIdentifier) - throws RepositoryException, RemoteException { - try { - Node activityNode = session.getNodeByIdentifier(activityNodeIdentifier); - return getFactory().getRemoteNodeIterator(manager.merge(activityNode)); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - - @Override - public void restoreVI(String absPath, String versionIdentifier, - boolean removeExisting) throws RepositoryException, RemoteException { - try { - Version version = (Version) session.getNodeByIdentifier(versionIdentifier); - manager.restore(absPath, version, removeExisting); - } catch (RepositoryException e) { - throw getRepositoryException(e); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java deleted file mode 100644 index 664adbaf5db..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.rmi.RemoteException; - -import javax.jcr.NamespaceRegistry; -import javax.jcr.RepositoryException; -import javax.jcr.Workspace; -import javax.jcr.lock.LockManager; -import javax.jcr.nodetype.NodeTypeManager; -import javax.jcr.observation.ObservationManager; -import javax.jcr.query.QueryManager; -import javax.jcr.version.VersionManager; - -import org.apache.jackrabbit.rmi.remote.RemoteLockManager; -import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry; -import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager; -import org.apache.jackrabbit.rmi.remote.RemoteObservationManager; -import org.apache.jackrabbit.rmi.remote.RemoteQueryManager; -import org.apache.jackrabbit.rmi.remote.RemoteVersionManager; -import org.apache.jackrabbit.rmi.remote.RemoteWorkspace; - -/** - * Remote adapter for the JCR {@link Workspace Workspace} interface. - * This class makes a local workspace available as an RMI service using the - * {@link RemoteWorkspace RemoteWorkspace} interface. - * - * @see Workspace - * @see RemoteWorkspace - */ -public class ServerWorkspace extends ServerObject implements RemoteWorkspace { - - /** The adapted local workspace. */ - private Workspace workspace; - - /** - * The remote observation manager for this workspace. This field is assigned - * on demand by the first call to {@link #getObservationManager()}. The - * assumption is that there is only one observation manager instance per - * workspace and that each call to the - * Workspace.getObservationManager() method of a single - * workspace will allways return the same object. - */ - private RemoteObservationManager remoteObservationManager; - - private RemoteLockManager remoteLockManager; - - private RemoteVersionManager remoteVersionManager; - - /** - * Creates a remote adapter for the given local workspace. - * - * @param workspace local workspace - * @param factory remote adapter factory - * @throws RemoteException on RMI errors - */ - public ServerWorkspace(Workspace workspace, RemoteAdapterFactory factory) - throws RemoteException { - super(factory); - this.workspace = workspace; - } - - /** {@inheritDoc} */ - public String getName() throws RemoteException { - return workspace.getName(); - } - - /** {@inheritDoc} */ - public void copy(String from, String to) - throws RepositoryException, RemoteException { - try { - workspace.copy(from, to); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void copy(String workspace, String from, String to) - throws RepositoryException, RemoteException { - try { - this.workspace.copy(workspace, from, to); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void clone( - String workspace, String from, String to, boolean removeExisting) - throws RepositoryException, RemoteException { - try { - this.workspace.clone(workspace, from, to, removeExisting); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void move(String from, String to) - throws RepositoryException, RemoteException { - try { - workspace.move(from, to); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNodeTypeManager getNodeTypeManager() - throws RepositoryException, RemoteException { - try { - NodeTypeManager manager = workspace.getNodeTypeManager(); - return getFactory().getRemoteNodeTypeManager(manager); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteNamespaceRegistry getNamespaceRegistry() - throws RepositoryException, RemoteException { - try { - NamespaceRegistry registry = workspace.getNamespaceRegistry(); - return getFactory().getRemoteNamespaceRegistry(registry); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteQueryManager getQueryManager() - throws RepositoryException, RemoteException { - try { - QueryManager queryManager = workspace.getQueryManager(); - return getFactory().getRemoteQueryManager( - workspace.getSession(), queryManager); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public RemoteObservationManager getObservationManager() - throws RepositoryException, RemoteException { - try { - if (remoteObservationManager == null) { - ObservationManager observationManager = - workspace.getObservationManager(); - remoteObservationManager = - getFactory().getRemoteObservationManager(observationManager); - } - return remoteObservationManager; - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public String[] getAccessibleWorkspaceNames() - throws RepositoryException, RemoteException { - try { - return workspace.getAccessibleWorkspaceNames(); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - /** {@inheritDoc} */ - public void importXML(String path, byte[] xml, int uuidBehaviour) - throws IOException, RepositoryException, RemoteException { - try { - workspace.importXML( - path, new ByteArrayInputStream(xml), uuidBehaviour); - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - public void createWorkspace(String name, String source) - throws RepositoryException, RemoteException { - if (source != null) { - workspace.createWorkspace(name, source); - } else { - workspace.createWorkspace(name); - } - } - - public void deleteWorkspace(String name) - throws RepositoryException, RemoteException { - workspace.deleteWorkspace(name); - } - - /** {@inheritDoc} */ - public RemoteLockManager getLockManager() - throws RepositoryException, RemoteException { - try { - if (remoteLockManager == null) { - LockManager lockManager = workspace.getLockManager(); - remoteLockManager = - getFactory().getRemoteLockManager(lockManager); - } - return remoteLockManager; - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - - public RemoteVersionManager getVersionManager() - throws RepositoryException, RemoteException { - try { - if (remoteVersionManager == null) { - VersionManager versionManager = workspace.getVersionManager(); - remoteVersionManager = - getFactory().getRemoteVersionManager(workspace.getSession(), versionManager); - } - return remoteVersionManager; - } catch (RepositoryException ex) { - throw getRepositoryException(ex); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerXASession.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerXASession.java deleted file mode 100644 index 8d792973ea9..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerXASession.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server; - -import java.rmi.RemoteException; - -import javax.jcr.Session; -import javax.transaction.xa.XAException; -import javax.transaction.xa.XAResource; -import javax.transaction.xa.Xid; - -import org.apache.jackrabbit.rmi.remote.RemoteXASession; -import org.apache.jackrabbit.rmi.remote.SerializableXid; - -/** - * Remote adapter for XA-enabled sessions. - * - * @since 1.4 - */ -public class ServerXASession extends ServerSession implements RemoteXASession { - - /** - * The adapted local XA resource - */ - private final XAResource resource; - - /** - * Creates a remote adapter for the given local, transaction enabled, - * session. - */ - public ServerXASession( - Session session, XAResource resource, RemoteAdapterFactory factory) - throws RemoteException { - super(session, factory); - this.resource = resource; - } - - private static XAException getXAException(XAException e) { - return new XAException(e.getMessage()); - } - - public void commit(Xid xid, boolean onePhase) throws XAException { - try { - resource.commit(xid, onePhase); - } catch (XAException e) { - throw getXAException(e); - } - } - - public void end(Xid xid, int flags) throws XAException { - try { - resource.end(xid, flags); - } catch (XAException e) { - throw getXAException(e); - } - } - - public void forget(Xid xid) throws XAException { - try { - resource.forget(xid); - } catch (XAException e) { - throw getXAException(e); - } - } - - public int getTransactionTimeout() throws XAException { - try { - return resource.getTransactionTimeout(); - } catch (XAException e) { - throw getXAException(e); - } - } - - public int prepare(Xid xid) throws XAException { - try { - return resource.prepare(xid); - } catch (XAException e) { - throw getXAException(e); - } - } - - public Xid[] recover(int flag) throws XAException { - try { - Xid[] xids = resource.recover(flag); - for (int i = 0; i < xids.length; i++) { - xids[i] = new SerializableXid(xids[i]); - } - return xids; - } catch (XAException e) { - throw getXAException(e); - } - } - - public void rollback(Xid xid) throws XAException { - try { - resource.rollback(xid); - } catch (XAException e) { - throw getXAException(e); - } - } - - public boolean setTransactionTimeout(int seconds) throws XAException { - try { - return resource.setTransactionTimeout(seconds); - } catch (XAException e) { - throw getXAException(e); - } - } - - public void start(Xid xid, int flags) throws XAException { - try { - resource.start(xid, flags); - } catch (XAException e) { - throw getXAException(e); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java deleted file mode 100644 index 775d1059377..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.iterator; - -import java.rmi.RemoteException; -import java.util.ArrayList; -import java.util.NoSuchElementException; - -import javax.jcr.RangeIterator; - -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.ServerObject; - - -/** - * Remote adapter for the JCR {@link RangeIterator} interface. This - * class makes a local iterator available as an RMI service using the - * {@link RemoteIterator} interface. - */ -public abstract class ServerIterator extends ServerObject - implements RemoteIterator { - - /** The adapted local iterator. */ - private final RangeIterator iterator; - - /** The maximum number of elements to send per request. */ - private final int maxBufferSize; - - /** - * The cached number of elements in the iterator, -1 if the iterator - * size is unknown, or -2 if the size has not been retrieved from the - * adapted local iterator. This variable is useful in cases when the - * underlying iterator does not know its sizes (getSize() returns -1) - * but we reach the end of the iterator in a nextObjects() call and - * can thus determine the size of the iterator. - */ - private long size; - - /** - * Creates a remote adapter for the given local item. - * - * @param iterator local iterator to be adapted - * @param factory remote adapter factory - * @param maxBufferSize maximum buffer size - * @throws RemoteException on RMI errors - */ - public ServerIterator( - RangeIterator iterator, RemoteAdapterFactory factory, - int maxBufferSize) throws RemoteException { - super(factory); - this.iterator = iterator; - this.maxBufferSize = maxBufferSize; - this.size = -2; - } - - /** - * Returns the size of the iterator. The size is cached by invoking the - * adapted local iterator when this method is first called or by - * determining the size from an end-of-iterator condition in nextObjects(). - * - * @return size of the iterator - * @throws RemoteException on RMI errors - */ - @Override - public long getSize() throws RemoteException { - if (size == -2) { - size = iterator.getSize(); - } - return size; - } - - /** - * Skips the given number of elements. - * - * @param items number of elements to skip - * @throws NoSuchElementException if skipped past the last element - * @throws RemoteException on RMI errors - */ - @Override - public void skip(long items) - throws NoSuchElementException, RemoteException { - try { - iterator.skip(items); - } catch (NoSuchElementException e) { - throw new NoSuchElementException(e.getMessage()); - } - } - - /** - * Returns a remote adapter for the given local object. This abstract - * method is used by {@link #nextObjects()} to convert the local - * objects to remote references to be sent to the client. - *

- * Subclasses should implement this method to use the remote adapter - * factory to create remote adapters of the specific element type. - * - * @param object local object - * @return remote adapter - * @throws RemoteException on RMI errors - */ - protected abstract Object getRemoteObject(Object object) - throws RemoteException; - - /** - * Returns an array of remote references to the next elements in this - * iteration. - * - * @return array of remote references, or null - * @throws RemoteException on RMI errors - */ - @Override - public Object[] nextObjects() throws RemoteException { - ArrayList items = new ArrayList(); - while (items.size() < maxBufferSize && iterator.hasNext()) { - items.add(getRemoteObject(iterator.next())); - } - if (items.size() > 0) { - return items.toArray(new Object[items.size()]); - } else { - size = iterator.getPosition(); - return null; - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeIterator.java deleted file mode 100644 index 83dd0e39b99..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeIterator.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.iterator; - -import java.rmi.RemoteException; - -import javax.jcr.Node; -import javax.jcr.NodeIterator; - -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; - -/** - * A ServerIterator for iterating nodes. - */ -public class ServerNodeIterator extends ServerIterator { - - /** - * Creates a ServerNodeIterator instance. - * - * @param iterator local node iterator - * @param factory remote adapter factory - * @param maxBufferSize maximum size of the element buffer - * @throws RemoteException on RMI errors - */ - public ServerNodeIterator( - NodeIterator iterator, RemoteAdapterFactory factory, - int maxBufferSize) throws RemoteException { - super(iterator, factory, maxBufferSize); - } - - /** - * Creates and returns a remote adapter for the given node. - * - * @param object local object - * @return remote adapter - * @throws RemoteException on RMI errors - * @see ServerIterator#getRemoteObject(Object) - */ - protected Object getRemoteObject(Object object) throws RemoteException { - return getRemoteNode((Node) object); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeTypeIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeTypeIterator.java deleted file mode 100644 index dd153d7a732..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeTypeIterator.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.iterator; - -import java.rmi.RemoteException; - -import javax.jcr.nodetype.NodeType; -import javax.jcr.nodetype.NodeTypeIterator; - -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; - -/** - * A ServerIterator for iterating node types. - */ -public class ServerNodeTypeIterator extends ServerIterator { - - /** - * Creates a ServerNodeTypeIterator instance. - * - * @param iterator local node type iterator - * @param factory remote adapter factory - * @param maxBufferSize maximum size of the element buffer - * @throws RemoteException on RMI errors - */ - public ServerNodeTypeIterator( - NodeTypeIterator iterator, RemoteAdapterFactory factory, - int maxBufferSize) throws RemoteException { - super(iterator, factory, maxBufferSize); - } - - /** - * Creates and returns a remote adapter for the given node type. - * - * @param object local object - * @return remote adapter - * @throws RemoteException on RMI errors - * @see ServerIterator#getRemoteObject(Object) - */ - protected Object getRemoteObject(Object object) throws RemoteException { - return getFactory().getRemoteNodeType((NodeType) object); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerPropertyIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerPropertyIterator.java deleted file mode 100644 index 8709bd90a86..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerPropertyIterator.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.iterator; - -import java.rmi.RemoteException; - -import javax.jcr.Property; -import javax.jcr.PropertyIterator; - -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; - -/** - * A ServerIterator for iterating properties. - */ -public class ServerPropertyIterator extends ServerIterator { - - /** - * Creates a ServerPropertyIterator instance. - * - * @param iterator local property iterator - * @param factory remote adapter factory - * @param maxBufferSize maximum size of the element buffer - * @throws RemoteException on RMI errors - */ - public ServerPropertyIterator( - PropertyIterator iterator, RemoteAdapterFactory factory, - int maxBufferSize) throws RemoteException { - super(iterator, factory, maxBufferSize); - } - - /** - * Creates and returns a remote adapter for the given property. - * - * @param object local object - * @return remote adapter - * @throws RemoteException on RMI errors - * @see ServerIterator#getRemoteObject(Object) - */ - protected Object getRemoteObject(Object object) throws RemoteException { - return getFactory().getRemoteProperty((Property) object); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerRowIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerRowIterator.java deleted file mode 100644 index 5b77ef43bbf..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerRowIterator.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.iterator; - -import java.rmi.RemoteException; - -import javax.jcr.query.Row; -import javax.jcr.query.RowIterator; - -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; - -/** - * A ServerIterator for iterating rows. - */ -public class ServerRowIterator extends ServerIterator { - - /** - * Creates a ServerRowIterator instance. - * - * @param iterator local row iterator - * @param factory remote adapter factory - * @param maxBufferSize maximum size of the element buffer - * @throws RemoteException on RMI errors - */ - public ServerRowIterator( - RowIterator iterator, RemoteAdapterFactory factory, - int maxBufferSize) throws RemoteException { - super(iterator, factory, maxBufferSize); - } - - /** - * Creates and returns a remote adapter for the given row. - * - * @param object local object - * @return remote adapter - * @throws RemoteException on RMI errors - * @see ServerIterator#getRemoteObject(Object) - */ - protected Object getRemoteObject(Object object) throws RemoteException { - return getFactory().getRemoteRow((Row) object); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerVersionIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerVersionIterator.java deleted file mode 100644 index 39675d595c0..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerVersionIterator.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.iterator; - -import java.rmi.RemoteException; - -import javax.jcr.version.Version; -import javax.jcr.version.VersionIterator; - -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; - -/** - * A ServerIterator for iterating versions. - */ -public class ServerVersionIterator extends ServerIterator { - - /** - * Creates a ServerVersionIterator instance. - * - * @param iterator local version iterator - * @param factory remote adapter factory - * @param maxBufferSize maximum size of the element buffer - * @throws RemoteException on RMI errors - */ - public ServerVersionIterator( - VersionIterator iterator, RemoteAdapterFactory factory, - int maxBufferSize) throws RemoteException { - super(iterator, factory, maxBufferSize); - } - - /** - * Creates and returns a remote adapter for the given version.. - * - * @param object local object - * @return remote adapter - * @throws RemoteException on RMI errors - * @see ServerIterator#getRemoteObject(Object) - */ - protected Object getRemoteObject(Object object) throws RemoteException { - return getFactory().getRemoteVersion((Version) object); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/package-info.java deleted file mode 100755 index a6b11fd475a..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.server.iterator; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/jmx/JCRServer.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/jmx/JCRServer.java deleted file mode 100644 index ec9a31c3c90..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/jmx/JCRServer.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.jmx; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.Properties; - -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.SimpleCredentials; -import javax.naming.InitialContext; - -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.ServerAdapterFactory; - -/** - * MBean that registers a JCR RMI server through JNDI. - */ -public class JCRServer implements JCRServerMBean { - - /** - * local repository address - */ - private String localAddress; - - /** - * remote repository address - */ - private String remoteAddress; - - /** - * Optional local JNDI environment properties - */ - private String localEnvironment; - - /** - * Optional remote JNDI environment properties - */ - private String remoteEnvironment; - - /** - * Remote repository instance - */ - RemoteRepository remote; - - /** - * Local repository instance - */ - private Repository localRepository; - - public void start() throws Exception { - - if (this.localAddress == null) { - throw new IllegalStateException("local repository address is null"); - } - - if (this.remoteAddress == null) { - throw new IllegalStateException("remote repository address is null"); - } - - // local repository - InitialContext localContext = createInitialContext(localEnvironment); - localRepository = (Repository) localContext.lookup(this.localAddress); - if (localRepository == null) { - throw new IllegalArgumentException("local repository not found at " - + this.localAddress); - } - - // remote repository - InitialContext remoteContext = createInitialContext(remoteEnvironment); - RemoteAdapterFactory factory = new ServerAdapterFactory(); - remote = factory.getRemoteRepository(localRepository); - - // bind remote server - remoteContext.bind(this.remoteAddress, remote); - } - - /** - * - * @param jndiProps - * jndi environment properties - * @return an InitialContext for the given environment properties - * @throws Exception - * if any error occurs - */ - private InitialContext createInitialContext(String jndiProps) - throws Exception { - InitialContext initialContext = null; - if (jndiProps != null) { - InputStream is = new ByteArrayInputStream(jndiProps.getBytes()); - Properties props = new Properties(); - props.load(is); - initialContext = new InitialContext(props); - } else { - initialContext = new InitialContext(); - } - return initialContext; - } - - public void stop() throws Exception { - // unbind remote server - InitialContext ctx = new InitialContext(); - ctx.unbind(this.remoteAddress); - remote = null; - } - - public void createWorkspace( - String username, String password, String name) - throws RepositoryException { - Session session = localRepository.login( - new SimpleCredentials(username, password.toCharArray())); - try { - session.getWorkspace().createWorkspace(name); - } finally { - session.logout(); - } - } - - public String getLocalAddress() { - return localAddress; - } - - public void setLocalAddress(String localAddress) { - this.localAddress = localAddress; - } - - public String getRemoteAddress() { - return remoteAddress; - } - - public void setRemoteAddress(String remoteAddress) { - this.remoteAddress = remoteAddress; - } - - public String getLocalEnvironment() { - return localEnvironment; - } - - public void setLocalEnvironment(String localEnvironment) { - this.localEnvironment = localEnvironment; - } - - public String getRemoteEnvironment() { - return remoteEnvironment; - } - - public void setRemoteEnvironment(String remoteEnvironment) { - this.remoteEnvironment = remoteEnvironment; - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/jmx/JCRServerMBean.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/jmx/JCRServerMBean.java deleted file mode 100644 index 8884577e921..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/jmx/JCRServerMBean.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.jmx; - -import javax.jcr.RepositoryException; - -public interface JCRServerMBean { - - void start() throws Exception; - - void stop() throws Exception; - - /** - * Creates a workspace in the managed repository. - * - * @param username administrator username - * @param password administrator password - * @param workspace name of the workspace to create - * @throws RepositoryException if the workspace could not be created - */ - void createWorkspace(String username, String password, String workspace) - throws RepositoryException; - - String getLocalAddress(); - - void setLocalAddress(String address); - - String getRemoteAddress(); - - void setRemoteAddress(String address); - - String getRemoteEnvironment(); - - void setRemoteEnvironment(String remoteEnvironment); - - String getLocalEnvironment(); - - void setLocalEnvironment(String localEnvironment); - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/jmx/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/jmx/package-info.java deleted file mode 100755 index 26c77efd422..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/jmx/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.server.jmx; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/package-info.java deleted file mode 100755 index 99ee18d2327..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.server; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerGroup.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerGroup.java deleted file mode 100644 index 2c140dcadf5..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerGroup.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.principal; - -import java.rmi.RemoteException; -import java.security.Principal; -import java.util.Collections; -import java.util.Enumeration; -import java.util.Iterator; - -import org.apache.jackrabbit.api.security.principal.GroupPrincipal; -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.principal.RemoteGroup; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; - -public class ServerGroup extends ServerPrincipal implements RemoteGroup { - - public ServerGroup(final GroupPrincipal principal, final RemoteAdapterFactory factory) - throws RemoteException { - super(principal, factory); - } - - public ServerGroup(final Principal principal, final RemoteAdapterFactory factory) - throws RemoteException { - super(principal, factory); - } - - public boolean isMember(String member) { - return isMember(member, getPrincipal()); - } - - public RemoteIterator members() throws RemoteException { - Iterator members = new Iterator() { - final Enumeration base = members(getPrincipal()); - - public boolean hasNext() { - return base.hasMoreElements(); - } - - public Principal next() { - return base.nextElement(); - } - - public void remove() { - throw new UnsupportedOperationException("remove"); - } - }; - return getFactory().getRemotePrincipalIterator(members); - } - - private static boolean isMember(final String memberName, final Principal group) { - Enumeration pe = members(group); - while (pe.hasMoreElements()) { - Principal p = pe.nextElement(); - if (memberName.equals(p.getName())) { - return true; - } - - if (isGroup(p) && isMember(memberName, p)) { - return true; - } - } - return false; - } - - public static boolean isGroup(Principal principal) { - return principal instanceof GroupPrincipal; - } - - private static Enumeration members(Principal principal) { - if (principal instanceof GroupPrincipal) { - return ((GroupPrincipal) principal).members(); - } - return Collections.emptyEnumeration(); - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipal.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipal.java deleted file mode 100644 index 378742f0020..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipal.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.principal; - -import java.rmi.RemoteException; -import java.security.Principal; - -import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.ServerObject; - -public class ServerPrincipal extends ServerObject implements RemotePrincipal { - - private final Principal principal; - - public ServerPrincipal(final Principal principal, - final RemoteAdapterFactory factory) throws RemoteException { - super(factory); - this.principal = principal; - } - - public String getName() { - return principal.getName(); - } - - /** - * Returns the {@link Principal} encapsulated in this instance. - *

- * NOTE: This method is intended to only be used in the JCR RMI - * implementation to be able to "send back" remote principals to the server - * for implementation of the remote JCR API. - * - * @return the {@link Principal} encapsulated in this instance. - */ - public Principal getPrincipal() { - return principal; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipalIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipalIterator.java deleted file mode 100644 index b3114a9acc8..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipalIterator.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.principal; - -import java.rmi.RemoteException; -import java.security.Principal; -import java.util.Iterator; -import org.apache.jackrabbit.commons.iterator.RangeIteratorAdapter; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.iterator.ServerIterator; - -public class ServerPrincipalIterator extends ServerIterator { - - public ServerPrincipalIterator(Iterator iterator, - RemoteAdapterFactory factory, int maxBufferSize) - throws RemoteException { - super(new RangeIteratorAdapter(iterator), factory, maxBufferSize); - } - - /** - * {@inheritDoc} - */ - protected Object getRemoteObject(Object object) throws RemoteException { - return getFactory().getRemotePrincipal((Principal) object); - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/package-info.java deleted file mode 100755 index a51fb001028..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("4.0.0") -package org.apache.jackrabbit.rmi.server.principal; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlEntry.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlEntry.java deleted file mode 100644 index f19470aa818..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlEntry.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.security; - -import java.rmi.RemoteException; - -import javax.jcr.security.AccessControlEntry; - -import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry; -import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.ServerObject; - -public class ServerAccessControlEntry extends ServerObject implements - RemoteAccessControlEntry { - - private final AccessControlEntry ace; - - public ServerAccessControlEntry(final AccessControlEntry ace, - final RemoteAdapterFactory factory) throws RemoteException { - super(factory); - this.ace = ace; - } - - public RemotePrincipal getPrincipal() throws RemoteException { - return getFactory().getRemotePrincipal(ace.getPrincipal()); - } - - public RemotePrivilege[] getPrivileges() throws RemoteException { - return getFactory().getRemotePrivilege(ace.getPrivileges()); - } - - AccessControlEntry getAccessControlEntry() { - return ace; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlList.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlList.java deleted file mode 100644 index 5b6b237315c..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlList.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.security; - -import java.rmi.RemoteException; -import java.security.Principal; - -import javax.jcr.RepositoryException; -import javax.jcr.security.AccessControlEntry; -import javax.jcr.security.AccessControlList; -import javax.jcr.security.Privilege; - -import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlList; -import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.principal.ServerPrincipal; - -public class ServerAccessControlList extends ServerAccessControlPolicy - implements RemoteAccessControlList { - - public ServerAccessControlList(final AccessControlList acl, - final RemoteAdapterFactory factory) throws RemoteException { - super(acl, factory); - } - - public RemoteAccessControlEntry[] getAccessControlEntries() - throws RepositoryException, RemoteException { - return getFactory().getRemoteAccessControlEntry( - ((AccessControlList) getAccessControlPolicy()).getAccessControlEntries()); - } - - public boolean addAccessControlEntry(RemotePrincipal principal, - RemotePrivilege[] privileges) throws RepositoryException { - - Principal p = null; - if (principal instanceof ServerPrincipal) { - p = ((ServerPrincipal) principal).getPrincipal(); - } - Privilege[] privs = new Privilege[privileges.length]; - for (int i = 0; privs != null && i < privs.length; i++) { - if (privileges[i] instanceof ServerPrivilege) { - privs[i] = ((ServerPrivilege) privileges[i]).getPrivilege(); - } else { - // not a compatible remote privilege, abort - privs = null; - } - } - - if (p != null && privs != null) { - return ((AccessControlList) getAccessControlPolicy()).addAccessControlEntry( - p, privs); - } - - throw new RepositoryException("Unsupported Remote types"); - } - - public void removeAccessControlEntry(RemoteAccessControlEntry ace) - throws RepositoryException { - if (ace instanceof ServerAccessControlEntry) { - AccessControlEntry lace = ((ServerAccessControlEntry) ace).getAccessControlEntry(); - ((AccessControlList) getAccessControlPolicy()).removeAccessControlEntry(lace); - } else { - throw new RepositoryException( - "Unsupported RemoteAccessControlEntry type " + ace.getClass()); - } - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlManager.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlManager.java deleted file mode 100644 index 45ded92f5e1..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlManager.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.security; - -import java.rmi.RemoteException; - -import javax.jcr.RepositoryException; -import javax.jcr.security.AccessControlManager; -import javax.jcr.security.Privilege; - -import org.apache.jackrabbit.rmi.remote.RemoteIterator; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager; -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy; -import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.ServerObject; - -public class ServerAccessControlManager extends ServerObject implements - RemoteAccessControlManager { - - private final AccessControlManager acm; - - public ServerAccessControlManager(AccessControlManager acm, - RemoteAdapterFactory factory) throws RemoteException { - super(factory); - this.acm = acm; - } - - public RemoteIterator getApplicablePolicies(String absPath) - throws RepositoryException, RemoteException { - return getFactory().getRemoteAccessControlPolicyIterator( - acm.getApplicablePolicies(absPath)); - } - - public RemoteAccessControlPolicy[] getEffectivePolicies(String absPath) - throws RepositoryException, RemoteException { - return getFactory().getRemoteAccessControlPolicy( - acm.getEffectivePolicies(absPath)); - } - - public RemoteAccessControlPolicy[] getPolicies(String absPath) - throws RepositoryException, RemoteException { - return getFactory().getRemoteAccessControlPolicy( - acm.getPolicies(absPath)); - } - - public RemotePrivilege[] getPrivileges(String absPath) - throws RepositoryException, RemoteException { - return getFactory().getRemotePrivilege(acm.getPrivileges(absPath)); - } - - public RemotePrivilege[] getSupportedPrivileges(String absPath) - throws RepositoryException, RemoteException { - return getFactory().getRemotePrivilege( - acm.getSupportedPrivileges(absPath)); - } - - public boolean hasPrivileges(String absPath, String[] privileges) - throws RepositoryException { - Privilege[] privs = new Privilege[privileges.length]; - for (int i = 0; i < privs.length; i++) { - privs[i] = acm.privilegeFromName(privileges[i]); - } - - return acm.hasPrivileges(absPath, privs); - } - - public RemotePrivilege privilegeFromName(String privilegeName) - throws RepositoryException, RemoteException { - return getFactory().getRemotePrivilege( - acm.privilegeFromName(privilegeName)); - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicy.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicy.java deleted file mode 100644 index 33703d24354..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicy.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.security; - -import java.rmi.RemoteException; - -import javax.jcr.security.AccessControlPolicy; - -import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.ServerObject; - -public class ServerAccessControlPolicy extends ServerObject implements - RemoteAccessControlPolicy { - - private final AccessControlPolicy acp; - - public ServerAccessControlPolicy(final AccessControlPolicy acp, - final RemoteAdapterFactory factory) - - throws RemoteException { - super(factory); - this.acp = acp; - } - - AccessControlPolicy getAccessControlPolicy() { - return acp; - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicyIterator.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicyIterator.java deleted file mode 100644 index 507866d9d08..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicyIterator.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.security; - -import java.rmi.RemoteException; - -import javax.jcr.security.AccessControlPolicy; -import javax.jcr.security.AccessControlPolicyIterator; - -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.iterator.ServerIterator; - -/** - * A ServerIterator for iterating rows. - */ -public class ServerAccessControlPolicyIterator extends ServerIterator { - - /** - * Creates a ServerRowIterator instance. - * - * @param iterator local row iterator - * @param factory remote adapter factory - * @param maxBufferSize maximum size of the element buffer - * @throws RemoteException on RMI errors - */ - public ServerAccessControlPolicyIterator( - AccessControlPolicyIterator iterator, RemoteAdapterFactory factory, - int maxBufferSize) throws RemoteException { - super(iterator, factory, maxBufferSize); - } - - /** - * Creates and returns a remote adapter for the given row. - * - * @param object local object - * @return remote adapter - * @throws RemoteException on RMI errors - * @see ServerIterator#getRemoteObject(Object) - */ - protected Object getRemoteObject(Object object) throws RemoteException { - return getFactory().getRemoteAccessControlPolicy( - (AccessControlPolicy) object); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerPrivilege.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerPrivilege.java deleted file mode 100644 index 1c01436ff3b..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerPrivilege.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.server.security; - -import java.rmi.RemoteException; -import java.rmi.server.RemoteStub; - -import javax.jcr.security.Privilege; - -import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.ServerObject; - -public class ServerPrivilege extends ServerObject implements RemotePrivilege { - - private final Privilege privilege; - - public ServerPrivilege(final Privilege privilege, - final RemoteAdapterFactory factory) throws RemoteException { - super(factory); - this.privilege = privilege; - } - - public RemotePrivilege[] getAggregatePrivileges() throws RemoteException { - return getFactory().getRemotePrivilege( - privilege.getAggregatePrivileges()); - } - - public RemotePrivilege[] getDeclaredAggregatePrivileges() - throws RemoteException { - return getFactory().getRemotePrivilege( - privilege.getDeclaredAggregatePrivileges()); - } - - public String getName() { - return privilege.getName(); - } - - public boolean isAbstract() { - return privilege.isAbstract(); - } - - public boolean isAggregate() { - return privilege.isAggregate(); - } - - Privilege getPrivilege() { - return privilege; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/package-info.java deleted file mode 100755 index ebf25621192..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.server.security; diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/AbstractValue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/AbstractValue.java deleted file mode 100644 index 786528e0ed3..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/AbstractValue.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.FilterInputStream; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.nio.charset.StandardCharsets; -import java.util.Calendar; - -import javax.jcr.Binary; -import javax.jcr.PropertyType; -import javax.jcr.RepositoryException; -import javax.jcr.Value; -import javax.jcr.ValueFormatException; - -/** - * Abstract base class for {@link Value} implementations. This class - * implements all {@link Value} methods except getString and - * getType. - *

- * Most of the default value getters always throw {@link ValueFormatException}s - * and expect type-specific subclasses to override that behaviour with the - * appropriate value conversions. - *

- * The {@link #getBinary()} method is implemented based on the abstract - * {@link #getString()} method, but subclasses can override that default - * implementation. - *

- * The {@link #getStream()} method uses {@link #getBinary()} to implement - * the deprecated JCR 1.0 behaviour. This method must not be overridden. - */ -abstract class AbstractValue implements Value, Serializable { - - /** - * Serial version UID - */ - private static final long serialVersionUID = -1989277354799918598L; - - /** - * The stream instance returned by {@link #getStream()}. Note that - * the stream is not included when serializing the value. - */ - private transient InputStream stream = null; - - /** - * Returns the stream representation of this value. This method implements - * the deprecated JCR 1.0 behaviour of always returning the same stream - * instance. The stream is retrieved from a {@link Binary} instance - * returned by {@link #getBinary()}. - * - * @return stream representation of this value - * @throws RepositoryException if the stream can not be created - */ - public synchronized final InputStream getStream() - throws RepositoryException { - if (stream == null) { - final Binary binary = getBinary(); - try { - stream = new FilterInputStream(binary.getStream()) { - @Override - public void close() throws IOException { - super.close(); - binary.dispose(); - } - }; - } finally { - // Proper cleanup also when binary.getStream() fails - if (stream == null) { - binary.dispose(); - } - } - } - return stream; - } - - /** - * Returns the binary representation of this value. The default - * implementation uses the UTF-8 serialization of the string returned - * by {@link #getString()}. Subclasses - */ - public Binary getBinary() throws RepositoryException { - final byte[] value = getString().getBytes(StandardCharsets.UTF_8); - return new Binary() { - public int read(byte[] b, long position) { - if (position >= value.length) { - return -1; - } else { - int p = (int) position; - int n = Math.min(b.length, value.length - p); - System.arraycopy(value, p, b, 0, n); - return n; - } - } - public InputStream getStream() { - return new ByteArrayInputStream(value); - } - public long getSize() { - return value.length; - } - public void dispose() { - } - }; - } - - /** - * Always throws a ValueFormatException. Implementations should - * overwrite if conversion to boolean is supported. - * - * @return nothing - * @throws ValueFormatException If the value cannot be converted to a - * boolean. - */ - public boolean getBoolean() throws ValueFormatException { - throw getValueFormatException(PropertyType.TYPENAME_BOOLEAN); - } - - /** - * Always throws a ValueFormatException. Implementations should - * overwrite if conversion to Calender is supported. - * - * @return nothing - * @throws ValueFormatException If the value cannot be converted to a - * Calendar instance. - */ - public Calendar getDate() throws ValueFormatException { - throw getValueFormatException(PropertyType.TYPENAME_DATE); - } - - /** - * Always throws a ValueFormatException. Implementations should - * overwrite if conversion to a {@link BigDecimal} is supported. - * - * @return nothing - * @throws ValueFormatException If the value cannot be converted to a - * {@link BigDecimal}. - */ - public BigDecimal getDecimal() throws RepositoryException { - throw getValueFormatException(PropertyType.TYPENAME_DECIMAL); - } - - /** - * Always throws a ValueFormatException. Implementations should - * overwrite if conversion to double is supported. - * - * @return nothing - * @throws ValueFormatException If the value cannot be converted to a - * double. - */ - public double getDouble() throws ValueFormatException { - throw getValueFormatException(PropertyType.TYPENAME_DOUBLE); - } - - /** - * Always throws a ValueFormatException. Implementations should - * overwrite if conversion to long is supported. - * - * @return nothing - * @throws ValueFormatException If the value cannot be converted to a - * long. - */ - public long getLong() throws ValueFormatException { - throw getValueFormatException(PropertyType.TYPENAME_LONG); - } - - /** - * Returns a ValueFormatException with a message indicating - * what kind of type conversion is not supported. - * - * @return nothing - * @param destType The name of the value type to which this value cannot - * be converted. - */ - protected ValueFormatException getValueFormatException(String destType) { - return new ValueFormatException( - "Cannot convert value \"" + this + "\" of type " - + PropertyType.nameFromValue(getType()) + " to " + destType); - } - - //--------------------------------------------------------------< Object > - - /** - * Compares values as defined in the JCR specification. - * - * @param object value for comparison - * @return true if the values are equal, - * false otherwise - * @see JCRRMI-16 - */ - public boolean equals(Object object) { - try { - return (object instanceof Value) - && getType() == ((Value) object).getType() - && getString().equals(((Value) object).getString()); - } catch (RepositoryException e) { - return false; - } - } - - /** - * Returns a hash code that's in line with how the {@link #equals(Object)} - * method is implemented. - * - * @return hash code of this value - */ - public int hashCode() { - try { - return getType() + getString().hashCode(); - } catch (RepositoryException e) { - return getType(); - } - } - - /** - * Returns a string representation of this value. - * - * @return value string - */ - public String toString() { - try { - return getString(); - } catch (RepositoryException e) { - return PropertyType.nameFromValue(getType()); - } - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/BinaryValue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/BinaryValue.java deleted file mode 100644 index d4b224a25c3..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/BinaryValue.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.Serializable; -import java.math.BigDecimal; -import java.nio.charset.StandardCharsets; -import java.util.Calendar; - -import javax.jcr.Binary; -import javax.jcr.PropertyType; -import javax.jcr.RepositoryException; -import javax.jcr.Value; - -/** - * Binary value. - */ -class BinaryValue implements Value, Serializable { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = 1719020811685971215L; - - /** - * The binary value - */ - private final Binary value; - - /** - * The stream instance returned by {@link #getStream()}. Note that - * the stream is not included when serializing the value. - */ - private transient InputStream stream = null; - - /** - * Creates a binary value. - */ - public BinaryValue(Binary value) { - this.value = value; - } - - /** - * Returns {@link PropertyType#BINARY}. - */ - public int getType() { - return PropertyType.BINARY; - } - - public Binary getBinary() { - return value; - } - - public String getString() throws RepositoryException { - try { - InputStream stream = value.getStream(); - try { - Reader reader = new InputStreamReader(stream, StandardCharsets.UTF_8); - StringBuilder builder = new StringBuilder(); - char[] buffer = new char[1024]; - int n = reader.read(buffer); - while (n != -1) { - builder.append(buffer, 0, n); - n = reader.read(buffer); - } - return builder.toString(); - } finally { - stream.close(); - } - } catch (IOException e) { - throw new RepositoryException("Unable to read the binary value", e); - } - } - - public synchronized InputStream getStream() throws RepositoryException { - if (stream == null) { - stream = value.getStream(); - } - return stream; - } - - public boolean getBoolean() throws RepositoryException { - return new StringValue(getString()).getBoolean(); - } - - public Calendar getDate() throws RepositoryException { - return new StringValue(getString()).getDate(); - } - - public BigDecimal getDecimal() throws RepositoryException { - return new StringValue(getString()).getDecimal(); - } - - public double getDouble() throws RepositoryException { - return new StringValue(getString()).getDouble(); - } - - public long getLong() throws RepositoryException { - return new StringValue(getString()).getLong(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/BooleanValue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/BooleanValue.java deleted file mode 100644 index 1fa3926869f..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/BooleanValue.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import javax.jcr.PropertyType; - -/** - * Boolean value. - */ -class BooleanValue extends AbstractValue { - - /** - * Serial version UID - */ - private static final long serialVersionUID = 5266937874230536517L; - - /** - * The boolean value - */ - private final boolean value; - - /** - * Creates an instance for the given boolean value. - */ - public BooleanValue(boolean value) { - this.value = value; - } - - /** - * Returns {@link PropertyType#BOOLEAN}. - */ - public int getType() { - return PropertyType.BOOLEAN; - } - - /** - * Returns the boolean value. - */ - @Override - public boolean getBoolean() { - return value; - } - - /** - * The boolean is converted using {@link Boolean#toString()}. - */ - public String getString() { - return Boolean.toString(value); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/DateValue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/DateValue.java deleted file mode 100644 index 2e748375599..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/DateValue.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import java.math.BigDecimal; -import java.text.DecimalFormat; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -import javax.jcr.PropertyType; -import javax.jcr.ValueFormatException; - -/** - * Date value. - */ -class DateValue extends AbstractValue { - - /** - * Serial version UID - */ - private static final long serialVersionUID = -2382837055824423966L; - - // misc. numeric formats used in formatting - private static final DecimalFormat XX_FORMAT = new DecimalFormat("00"); - private static final DecimalFormat XXX_FORMAT = new DecimalFormat("000"); - private static final DecimalFormat XXXX_FORMAT = new DecimalFormat("0000"); - - /** - * The date value - */ - private final Calendar value; - - /** - * Creates an instance for the given date value. - * - * @param value the date value - */ - public DateValue(Calendar value) { - this.value = value; - } - - /** - * Returns {@link PropertyType#DATE}. - */ - public int getType() { - return PropertyType.DATE; - } - - /** - * Returns a copy of this Calendar value. Modifying the - * returned Calendar does not change the value of this - * instance. - */ - @Override - public Calendar getDate() { - return (Calendar) value.clone(); - } - - /** - * The date is converted to the number of milliseconds since - * 00:00 (UTC) 1 January 1970 (1970-01-01T00:00:00.000Z). - */ - @Override - public BigDecimal getDecimal() { - return new BigDecimal(value.getTimeInMillis()); - } - - /** - * The date is converted to the number of milliseconds since - * 00:00 (UTC) 1 January 1970 (1970-01-01T00:00:00.000Z). If this number - * is out-of-range for a double, a ValueFormatException is thrown. - */ - @Override - public double getDouble() { - return value.getTimeInMillis(); - } - - /** - * The date is converted to the number of milliseconds since - * 00:00 (UTC) 1 January 1970 (1970-01-01T00:00:00.000Z). If this number - * is out-of-range for a long, a ValueFormatException is thrown. - */ - @Override - public long getLong() { - return value.getTimeInMillis(); - } - - /** - * The date is converted to the following format: - * sYYYY-MM-DDThh:mm:ss.sssTZD - * where: - *

- *
sYYYY
- *
- * Four-digit year with optional leading positive (‘+’) or - * negative (‘-’) sign. 0000 , -0000 and +0000 all indicate - * the year 1 BCE. –YYYY where YYYY is the number y indicates - * the year (y+1) BCE. The absence of a sign or the presence - * of a positive sign indicates a year CE. For example, -0054 - * would indicate the year 55 BCE, while +1969 and 1969 - * indicate the year 1969 CE. - *
- *
MM
- *
- * Two-digit month (01 = January, etc.) - *
- *
DD
- *
- * Two-digit day of month (01 through 31) - *
- *
hh
- *
- * Two digits of hour (00 through 23, or 24 if mm is 00 and - * ss.sss is 00.000) - *
- *
mm
- *
- * Two digits of minute (00 through 59) - *
- *
ss.sss
- *
- * Seconds, to three decimal places (00.000 through 59.999 or - * 60.999 in the case of leap seconds) - *
- *
TZD
- *
- * Time zone designator (either Z for Zulu, i.e. UTC, or +hh:mm or - * -hh:mm, i.e. an offset from UTC) - *
- *
- *

- * Note that the “T” separating the date from the time and the - * separators “-”and “:” appear literally in the string. - *

- * This format is a subset of the format defined by ISO 8601:2004. - * If the DATE value cannot be represented in this format a - * {@link ValueFormatException} is thrown. - */ - public String getString() { - // determine era and adjust year if necessary - int year = value.get(Calendar.YEAR); - if (value.isSet(Calendar.ERA) - && value.get(Calendar.ERA) == GregorianCalendar.BC) { - // calculate year using astronomical system: - // year n BCE => astronomical year - n + 1 - year = 0 - year + 1; - } - - // note that we cannot use java.text.SimpleDateFormat for - // formatting because it can't handle years <= 0 and TZD's - StringBuilder buf = new StringBuilder(32); - - // year ([-]YYYY) - buf.append(XXXX_FORMAT.format(year)); - buf.append('-'); - // month (MM) - buf.append(XX_FORMAT.format(value.get(Calendar.MONTH) + 1)); - buf.append('-'); - // day (DD) - buf.append(XX_FORMAT.format(value.get(Calendar.DAY_OF_MONTH))); - buf.append('T'); - // hour (hh) - buf.append(XX_FORMAT.format(value.get(Calendar.HOUR_OF_DAY))); - buf.append(':'); - // minute (mm) - buf.append(XX_FORMAT.format(value.get(Calendar.MINUTE))); - buf.append(':'); - // second (ss) - buf.append(XX_FORMAT.format(value.get(Calendar.SECOND))); - buf.append('.'); - // millisecond (SSS) - buf.append(XXX_FORMAT.format(value.get(Calendar.MILLISECOND))); - - // time zone designator (Z or +00:00 or -00:00) - TimeZone tz = value.getTimeZone(); - // time zone offset (in minutes) from UTC (including daylight saving) - int offset = tz.getOffset(value.getTimeInMillis()) / 1000 / 60; - if (offset != 0) { - int hours = Math.abs(offset / 60); - int minutes = Math.abs(offset % 60); - buf.append(offset < 0 ? '-' : '+'); - buf.append(XX_FORMAT.format(hours)); - buf.append(':'); - buf.append(XX_FORMAT.format(minutes)); - } else { - buf.append('Z'); - } - - return buf.toString(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/DecimalValue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/DecimalValue.java deleted file mode 100644 index 1f2f8e3ed26..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/DecimalValue.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import java.math.BigDecimal; -import java.util.Calendar; - -import javax.jcr.PropertyType; -import javax.jcr.ValueFormatException; - -/** - * Decimal value. - */ -class DecimalValue extends AbstractValue { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = 2077767642124007133L; - - /** - * The minimum value for date conversion. - */ - private static final BigDecimal MIN_DATE = - BigDecimal.valueOf(Long.MIN_VALUE); - - /** - * The maximum value for date conversion. - */ - private static final BigDecimal MAX_DATE = - BigDecimal.valueOf(Long.MAX_VALUE); - - /** - * The decimal value. - */ - private final BigDecimal value; - - /** - * Creates an instance for the given decimal value. - */ - public DecimalValue(BigDecimal value) { - this.value = value; - } - - /** - * Returns {@link PropertyType#DECIMAL}. - */ - public int getType() { - return PropertyType.DECIMAL; - } - - /** - * The decimal is converted to a long and interpreted as the number of - * milliseconds since 00:00 (UTC) 1 January 1970 (1970-01-01T00:00:00.000Z). - * If the resulting value is out of range for a date, - * a {@link ValueFormatException} is thrown. - */ - @Override - public Calendar getDate() throws ValueFormatException { - if (value.compareTo(MIN_DATE) >= 0 && value.compareTo(MAX_DATE) <= 0) { - Calendar date = Calendar.getInstance(); - date.setTimeInMillis(getLong()); - return date; - } else { - throw new ValueFormatException( - "Decimal value is outside the date range: " + value); - } - } - - /** - * Returns the decimal value. - */ - @Override - public BigDecimal getDecimal() { - return value; - } - - /** - * The decimal is converted using {@link BigDecimal#doubleValue()}. - */ - @Override - public double getDouble() { - return value.doubleValue(); - } - - /** - * The decimal is converted using {@link BigDecimal#longValue()}. - */ - @Override - public long getLong() { - return value.longValue(); - } - - /** - * The decimal is converted using {@link BigDecimal#toString()}. - */ - public String getString() { - return value.toString(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/DoubleValue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/DoubleValue.java deleted file mode 100644 index ae151d13f1e..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/DoubleValue.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import java.math.BigDecimal; -import java.util.Calendar; - -import javax.jcr.PropertyType; -import javax.jcr.ValueFormatException; - -/** - * Double value. - */ -class DoubleValue extends AbstractValue { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = -2767063038068929611L; - - /** - * The double value. - */ - private final double value; - - /** - * Creates an instance for the given double value. - */ - public DoubleValue(double value) { - this.value = value; - } - - /** - * Returns {@link PropertyType#DOUBLE}. - */ - public int getType() { - return PropertyType.DOUBLE; - } - - /** - * Returns a Calendar instance interpreting the double as the - * time in milliseconds since the epoch (1.1.1970, 0:00, UTC). If the - * resulting value is out of range for a date, - * a {@link ValueFormatException} is thrown. - */ - @Override - public Calendar getDate() throws ValueFormatException { - if (Long.MIN_VALUE <= value && value <= Long.MAX_VALUE) { - Calendar date = Calendar.getInstance(); - date.setTimeInMillis((long) value); - return date; - } else { - throw new ValueFormatException( - "Double value is outside the date range: " + value); - } - } - - /** - * The double is converted using the constructor - * {@link BigDecimal#BigDecimal(double)}. - */ - @Override - public BigDecimal getDecimal() { - return new BigDecimal(value); - } - - /** - * Returns the double value. - */ - @Override - public double getDouble() { - return value; - } - - /** - * Standard Java type coercion is used. - */ - @Override - public long getLong() { - return (long) value; - } - - /** - * The double is converted using {@link Double#toString(double)}. - */ - public String getString() { - return Double.toString(value); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/LongValue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/LongValue.java deleted file mode 100644 index 75ac27e27fc..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/LongValue.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import java.math.BigDecimal; -import java.util.Calendar; - -import javax.jcr.PropertyType; - -/** - * Long value. - */ -class LongValue extends AbstractValue { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = -5983072186237752887L; - - /** The long value */ - private final long value; - - /** - * Creates an instance for the given long value. - */ - public LongValue(long value) { - this.value = value; - } - - /** - * Returns PropertyType.LONG. - */ - public int getType() { - return PropertyType.LONG; - } - - /** - * The long is interpreted as the number of milliseconds since - * 00:00 (UTC) 1 January 1970 (1970-01-01T00:00:00.000Z). - */ - @Override - public Calendar getDate() { - Calendar date = Calendar.getInstance(); - date.setTimeInMillis(value); - return date; - } - - /** - * The long is converted using the method {@link BigDecimal#valueOf(long)}. - */ - @Override - public BigDecimal getDecimal() { - return BigDecimal.valueOf(value); - } - - /** - * Standard Java type coercion is used. - */ - @Override - public double getDouble() { - return value; - } - - /** - * Returns the long value. - */ - @Override - public long getLong() { - return value; - } - - /** - * The long is converted using {@link Long#toString(long)}. - */ - public String getString() { - return Long.toString(value); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/NameValue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/NameValue.java deleted file mode 100644 index 90c5e831f8a..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/NameValue.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import javax.jcr.PropertyType; -import javax.jcr.RepositoryException; -import javax.jcr.ValueFormatException; - -/** - * The NameValue class implements the committed value state for - * Name values as a part of the State design pattern (Gof) used by this package. - * - * @since 0.16.4.1 - */ -public class NameValue extends AbstractValue { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = 4598175360244278453L; - - /** The name value. */ - private final String value; - - /** - * Creates an instance for the given name value. - */ - protected NameValue(String value) throws ValueFormatException { - // TODO: Check name format - this.value = value; - } - - /** - * Returns PropertyType.NAME. - */ - public int getType() { - return PropertyType.NAME; - } - - /** - * Returns the string representation of the Name value. - */ - public String getString() throws RepositoryException { - return value; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/PathValue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/PathValue.java deleted file mode 100644 index 0657637de34..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/PathValue.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import javax.jcr.PropertyType; -import javax.jcr.RepositoryException; -import javax.jcr.ValueFormatException; - -/** - * The PathValue class implements the committed value state for - * Path values as a part of the State design pattern (Gof) used by this package. - * - * @since 0.16.4.1 - */ -public class PathValue extends AbstractValue { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = 6233090249008329224L; - - /** The path value. */ - private final String value; - - /** - * Creates an instance for the given path value. - */ - protected PathValue(String value) throws ValueFormatException { - // TODO: Check path format - this.value = value; - } - - /** - * Returns PropertyType.PATH. - */ - public int getType() { - return PropertyType.PATH; - } - - /** - * Returns the string representation of the path value. - */ - public String getString() throws ValueFormatException, RepositoryException { - return value; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/ReferenceValue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/ReferenceValue.java deleted file mode 100644 index 65cf752b5b8..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/ReferenceValue.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import javax.jcr.PropertyType; -import javax.jcr.RepositoryException; -import javax.jcr.ValueFormatException; - -/** - * The ReferenceValue class implements the committed value state - * for Reference values as a part of the State design pattern (Gof) used by - * this package. - * - * @since 0.16.4.1 - */ -public class ReferenceValue extends AbstractValue { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = 5245358709465803351L; - - /** The reference value */ - private final String value; - - /** - * Creates an instance for the given reference value. - */ - protected ReferenceValue(String value) throws ValueFormatException { - // TODO: check syntax - this.value = value; - } - - /** - * Returns PropertyType.REFERENCE. - */ - public int getType() { - return PropertyType.REFERENCE; - } - - /** - * Returns the string representation of the reference value. - */ - public String getString() throws ValueFormatException, RepositoryException { - return value; - } -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerialValueFactory.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerialValueFactory.java deleted file mode 100644 index 0a548447a77..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerialValueFactory.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; - -import javax.jcr.Binary; -import javax.jcr.Node; -import javax.jcr.PropertyType; -import javax.jcr.RepositoryException; -import javax.jcr.Value; -import javax.jcr.ValueFactory; -import javax.jcr.ValueFormatException; - -/** - * The SerialValueFactory class is used in the RMI infrastructure - * to create serializable Value instances on the client side. - *

- * This class works in conjunction with the implementations of the - * javax.jcr.Value interface found in this package. - *

- * This class may be extended to overwrite any of the - * createXXXValue methods to create instances of the respective - * type of {@link Value} implementation. The - * methods of the ValueFactory interface are declared final to - * guard against breaking the rules. - */ -public class SerialValueFactory implements ValueFactory { - - /** The singleton value factory instance */ - private static final SerialValueFactory INSTANCE = new SerialValueFactory(); - - /** - * Returns the ValueFactory instance, which currently is a - * singleton instance of this class. - *

- * Future revisions will support some kind of configuration to specify - * which concrete class should be used. - */ - public static final SerialValueFactory getInstance() { - return INSTANCE; - } - - /** - * Utility method for decorating an array of values. The returned array will - * contain serializable value decorators for all the given values. Note that - * the contents of the original values will only be copied when the - * decorators are serialized. - *

- * If the given array is null, then an empty array is - * returned. - * - * @param values the values to be decorated - * @return array of decorated values - * @throws RepositoryException if the values can not be serialized - */ - public static Value[] makeSerialValueArray(Value[] values) - throws RepositoryException { - List serials = new ArrayList(); - if (values != null) { - for (Value value : values) { - if (value != null) { - serials.add(makeSerialValue(value)); - } - } - } - return serials.toArray(new Value[serials.size()]); - } - - /** - * Utility method for decorating a value. Note that the contents of the - * original values will only be copied when the decorators are serialized. - * Null referenced and already serializable values are passed as-is. - * - * @param value the value to be decorated, or null - * @return the decorated value, or null - * @throws RepositoryException if the value can not be serialized - */ - public static Value makeSerialValue(Value value) throws RepositoryException { - // if the value is null or already serializable, just return it - if (value == null || value instanceof Serializable) { - return value; - } else { - return INSTANCE.createValue(value); - } - } - - /** - * Utility method for converting an array of strings to serializable - * string values. - *

- * If the given array is null, then an empty array is - * returned. - * - * @param values the string array - * @return array of string values - */ - public static Value[] makeSerialValueArray(String[] values) { - List serials = new ArrayList(); - if (values != null) { - for (String value : values) { - if (value != null) { - serials.add(INSTANCE.createValue(value)); - } - } - } - return serials.toArray(new Value[serials.size()]); - } - - /** - * Default constructor only visible to extensions of this class. See - * class comments for details. - */ - protected SerialValueFactory() { - } - - /** {@inheritDoc} */ - public Value createValue(String value) { - return new StringValue(value); - } - - /** {@inheritDoc} */ - public final Value createValue(String value, int type) - throws ValueFormatException { - try { - return createValue(new StringValue(value), type); - } catch (ValueFormatException e) { - throw e; - } catch (RepositoryException e) { - throw new ValueFormatException( - "Unexpected error when creating value: " + value, e); - } - } - - private Value createValue(Value value) throws RepositoryException { - return createValue(value, value.getType()); - } - - private Value createValue(Value value, int type) - throws RepositoryException { - switch (type) { - case PropertyType.BINARY: - Binary binary = value.getBinary(); - try { - return createValue(binary.getStream()); - } finally { - binary.dispose(); - } - case PropertyType.BOOLEAN: - return createValue(value.getBoolean()); - case PropertyType.DATE: - return createValue(value.getDate()); - case PropertyType.DECIMAL: - return createValue(value.getDecimal()); - case PropertyType.DOUBLE: - return createValue(value.getDouble()); - case PropertyType.LONG: - return createValue(value.getLong()); - case PropertyType.NAME: - return new NameValue(value.getString()); - case PropertyType.PATH: - return new PathValue(value.getString()); - case PropertyType.REFERENCE: - return new ReferenceValue(value.getString()); - case PropertyType.STRING: - return createValue(value.getString()); - default: - throw new ValueFormatException("Unknown value type " + type); - } - } - - /** {@inheritDoc} */ - public final Value createValue(long value) { - return new LongValue(value); - } - - /** {@inheritDoc} */ - public final Value createValue(double value) { - return new DoubleValue(value); - } - - /** {@inheritDoc} */ - public final Value createValue(boolean value) { - return new BooleanValue(value); - } - - /** {@inheritDoc} */ - public Value createValue(BigDecimal value) { - return new DecimalValue(value); - } - - /** {@inheritDoc} */ - public final Value createValue(Calendar value) { - return new DateValue(value); - } - - /** {@inheritDoc} */ - public final Value createValue(InputStream value) { - try { - return createValue(createBinary(value)); - } catch (RepositoryException e) { - throw new RuntimeException("Unable to create a binary value", e); - } - } - - /** {@inheritDoc} */ - public final Value createValue(Node value) throws RepositoryException { - return createValue(value.getUUID(), PropertyType.REFERENCE); - } - - public Binary createBinary(InputStream stream) throws RepositoryException { - try { - try { - return new SerializableBinary(stream); - } finally { - stream.close(); - } - } catch (IOException e) { - throw new RepositoryException("Unable to read binary stream", e); - } - } - - public Value createValue(Binary value) { - return new BinaryValue(value); - } - - public Value createValue(Node value, boolean weak) - throws RepositoryException { - return new ReferenceValue(value.getUUID()); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerializableBinary.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerializableBinary.java deleted file mode 100644 index 03ffb6e19f7..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/SerializableBinary.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.io.RandomAccessFile; -import java.io.Serializable; - -import javax.jcr.Binary; -import javax.jcr.RepositoryException; - -/** - * Serializable binary. - */ -class SerializableBinary implements Binary, Serializable { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = -7742179594834275853L; - - private static final int BUFFER_SIZE = 64 * 1024; - - private transient long length; - - private transient byte[] data; - - private transient File file; - - /** - * Creates a binary from the given stream. The stream is not closed. - * - * @param stream binary stream - */ - public SerializableBinary(InputStream stream) throws IOException { - length = 0; - data = null; - file = null; - - OutputStream output = null; - try { - byte[] buffer = new byte[BUFFER_SIZE]; - int n = stream.read(buffer); - while (n != -1) { - length += n; - if (length < buffer.length) { - n = stream.read( - buffer, (int) length, buffer.length - (int) length); - } else { - if (file == null) { - file = File.createTempFile("jackrabbit-jcr-rmi-", null); - output = new FileOutputStream(file); - output.write(buffer); - } else { - output.write(buffer, 0, n); - } - n = stream.read(buffer); - } - } - if (file == null) { - data = new byte[(int) length]; - System.arraycopy(buffer, 0, data, 0, (int) length); - } - } finally { - if (output != null) { - output.close(); - } - } - } - - public synchronized int read(byte[] b, long position) - throws RepositoryException { - if (position < 0 || position >= length) { - return -1; - } else if (data != null) { - int n = Math.min(b.length, data.length - (int) position); - System.arraycopy(data, (int) position, b, 0, n); - return n; - } else if (file != null) { - try { - RandomAccessFile random = new RandomAccessFile(file, "r"); - try { - random.seek(position); - return random.read(b); - } finally { - random.close(); - } - } catch (FileNotFoundException e) { - throw new RepositoryException("Binary file is missing", e); - } catch (IOException e) { - throw new RepositoryException("Unable to read the binary", e); - } - } else { - throw new IllegalStateException("This binary has been disposed"); - } - } - - public synchronized InputStream getStream() throws RepositoryException { - if (data != null) { - return new ByteArrayInputStream(data); - } else if (file != null) { - try { - return new FileInputStream(file); - } catch (FileNotFoundException e) { - throw new RepositoryException("Binary file is missing", e); - } - } else { - throw new IllegalStateException("This binary has been disposed"); - } - } - - public long getSize() { - return length; - } - - public synchronized void dispose() { - data = null; - if (file != null) { - file.delete(); - file = null; - } - } - - private synchronized void writeObject(ObjectOutputStream stream) - throws IOException { - stream.writeLong(length); - if (data != null) { - stream.write(data); - } else if (file != null) { - InputStream input = new FileInputStream(file); - try { - byte[] buffer = new byte[BUFFER_SIZE]; - int n = input.read(buffer); - while (n != -1) { - stream.write(buffer, 0, n); - n = input.read(buffer); - } - } finally { - input.close(); - } - } else { - throw new IllegalStateException("This binary has been disposed"); - } - } - - private void readObject(ObjectInputStream stream) - throws IOException { - length = stream.readLong(); - if (length <= BUFFER_SIZE) { - data = new byte[(int) length]; - stream.readFully(data); - file = null; - } else { - data = null; - file = File.createTempFile("jackrabbit-jcr-rmi-", null); - OutputStream output = new FileOutputStream(file); - try { - byte[] buffer = new byte[BUFFER_SIZE]; - long count = 0; - int n = stream.read(buffer); - while (n != -1 && count < length) { - output.write(buffer, 0, n); - count += n; - n = stream.read(buffer, 0, Math.min( - buffer.length, (int) (length - count))); - } - } finally { - output.close(); - } - } - } - - public void finalize() { - dispose(); - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/StringValue.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/StringValue.java deleted file mode 100644 index d4c45e9e6f9..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/StringValue.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi.value; - -import java.math.BigDecimal; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -import javax.jcr.PropertyType; -import javax.jcr.ValueFormatException; - -/** - * String value. - */ -class StringValue extends AbstractValue { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = 220963478492833703L; - - /** The string value */ - private final String value; - - /** - * Creates an instance for the given string value. - */ - public StringValue(String value) { - this.value = value; - } - - /** - * Returns {@link PropertyType#STRING}. - */ - public int getType() { - return PropertyType.STRING; - } - - /** - * The string is converted using {@link Boolean#valueOf(String)}. - */ - @Override - public boolean getBoolean() { - return Boolean.valueOf(value); - } - - /** - * If the string is in the format described in - * {@link DateValue#getString()}, it is converted directly, otherwise - * a {@link ValueFormatException} is thrown. - */ - @Override - public Calendar getDate() throws ValueFormatException { - // check optional leading sign - char sign = '+'; - int start = 0; - if (value.startsWith("-")) { - sign = '-'; - start = 1; - } else if (value.startsWith("+")) { - sign = '+'; - start = 1; - } - - // note that we cannot use java.text.SimpleDateFormat for - // parsing because it can't handle years <= 0 and TZD's - int year, month, day, hour, min, sec, ms; - String tzID; - try { - // year (YYYY) - year = Integer.parseInt(value.substring(start, start + 4)); - start += 4; - // delimiter '-' - if (value.charAt(start) != '-') { - throw new ValueFormatException("Not a date: " + value); - } - start++; - // month (MM) - month = Integer.parseInt(value.substring(start, start + 2)); - start += 2; - // delimiter '-' - if (value.charAt(start) != '-') { - throw new ValueFormatException("Not a date: " + value); - } - start++; - // day (DD) - day = Integer.parseInt(value.substring(start, start + 2)); - start += 2; - // delimiter 'T' - if (value.charAt(start) != 'T') { - throw new ValueFormatException("Not a date: " + value); - } - start++; - // hour (hh) - hour = Integer.parseInt(value.substring(start, start + 2)); - start += 2; - // delimiter ':' - if (value.charAt(start) != ':') { - throw new ValueFormatException("Not a date: " + value); - } - start++; - // minute (mm) - min = Integer.parseInt(value.substring(start, start + 2)); - start += 2; - // delimiter ':' - if (value.charAt(start) != ':') { - throw new ValueFormatException("Not a date: " + value); - } - start++; - // second (ss) - sec = Integer.parseInt(value.substring(start, start + 2)); - start += 2; - // delimiter '.' - if (value.charAt(start) != '.') { - throw new ValueFormatException("Not a date: " + value); - } - start++; - // millisecond (SSS) - ms = Integer.parseInt(value.substring(start, start + 3)); - start += 3; - // time zone designator (Z or +00:00 or -00:00) - if (value.charAt(start) == '+' || value.charAt(start) == '-') { - // offset to UTC specified in the format +00:00/-00:00 - tzID = "GMT" + value.substring(start); - } else if (value.substring(start).equals("Z")) { - tzID = "GMT"; - } else { - throw new ValueFormatException( - "Invalid time zone in a date: " + value); - } - } catch (IndexOutOfBoundsException e) { - throw new ValueFormatException("Not a date: " + value, e); - } catch (NumberFormatException e) { - throw new ValueFormatException("Not a date: " + value, e); - } - - TimeZone tz = TimeZone.getTimeZone(tzID); - // verify id of returned time zone (getTimeZone defaults to "GMT") - if (!tz.getID().equals(tzID)) { - throw new ValueFormatException( - "Invalid time zone in a date: " + value); - } - - // initialize Calendar object - Calendar cal = Calendar.getInstance(tz); - cal.setLenient(false); - // year and era - if (sign == '-' || year == 0) { - // not CE, need to set era (BCE) and adjust year - cal.set(Calendar.YEAR, year + 1); - cal.set(Calendar.ERA, GregorianCalendar.BC); - } else { - cal.set(Calendar.YEAR, year); - cal.set(Calendar.ERA, GregorianCalendar.AD); - } - // month (0-based!) - cal.set(Calendar.MONTH, month - 1); - // day of month - cal.set(Calendar.DAY_OF_MONTH, day); - // hour - cal.set(Calendar.HOUR_OF_DAY, hour); - // minute - cal.set(Calendar.MINUTE, min); - // second - cal.set(Calendar.SECOND, sec); - // millisecond - cal.set(Calendar.MILLISECOND, ms); - - try { - // the following call will trigger an IllegalArgumentException - // if any of the set values are illegal or out of range - cal.getTime(); - } catch (IllegalArgumentException e) { - throw new ValueFormatException("Not a date: " + value, e); - } - - return cal; - } - - /** - * The string is converted using the constructor - * {@link BigDecimal#BigDecimal(String)}. - */ - @Override - public BigDecimal getDecimal() throws ValueFormatException { - try { - return new BigDecimal(value); - } catch (NumberFormatException e) { - throw new ValueFormatException("Not a decimal value: " + value, e); - } - } - - - /** - * The string is converted using {@link Double#valueOf(String)}. - */ - @Override - public double getDouble() throws ValueFormatException { - try { - return Double.valueOf(value); - } catch (NumberFormatException e) { - throw new ValueFormatException("Not a double value: " + value, e); - } - } - - /** - * The string is converted using {@link Long#valueOf(String)}. - */ - @Override - public long getLong() throws ValueFormatException { - try { - return Long.valueOf(value); - } catch (NumberFormatException e) { - throw new ValueFormatException("Not a long value: " + value, e); - } - } - - /** - * Returns the string value. - */ - public String getString() { - return value; - } - -} diff --git a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/package-info.java b/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/package-info.java deleted file mode 100755 index 05fc56e6e4c..00000000000 --- a/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/value/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ -@org.osgi.annotation.versioning.Version("3.1.0") -package org.apache.jackrabbit.rmi.value; diff --git a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/client/iterator/package.html b/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/client/iterator/package.html deleted file mode 100644 index 2bcd960b8e1..00000000000 --- a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/client/iterator/package.html +++ /dev/null @@ -1,19 +0,0 @@ - - -Local adapters for remote iterators. - diff --git a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/client/package.html b/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/client/package.html deleted file mode 100644 index bc61b5b85f7..00000000000 --- a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/client/package.html +++ /dev/null @@ -1,76 +0,0 @@ - - -Client implementation of the transparent JCR-RMI layer. -

-This package contains the default client implementation of the -transparent JCR-RMI layer. The classes in this package can be used -to make a remote JCR-RMI service seem like a local JCR repository. -

-The contents of this package is designed using two design patterns, -Factory and Adapter. All the ClientObject subclasses implement the -Adapter pattern to adapt a remote JCR-RMI reference to the corresponding -local JCR interface. The Factory pattern is used to centralize the -creation and configuration of all adapter instances. - -

Looking up a JCR-RMI client

-

-The ClientRepositoryFactory class provides a convenient mechanism for -looking up a remote JCR-RMI repository. The factory can be used either -directly or as a JNDI object factory. -

-The following example shows how to use the ClientRepositoryFactory -directly: - -

-    String name = ...; // The RMI URL of the repository
-    
-    ClientRepositoryFactory factory = new ClientRepositoryFactory();
-    Repository repository = factory.getRepository(name);
-
- -

-The ClientRepositoryFactory can also be used via JNDI. The following -example settings and code demonstrate how to configure and use the -transparent JCR-RMI layer in a Tomcat 5.5 web application: - -

-context.xml:
-    <Resource name="jcr/Repository" auth="Container"
-              type="javax.jcr.Repository"
-              factory="org.apache.jackrabbit.rmi.client.ClientRepositoryFactory"
-              url="..."/>
-              
-web.xml:
-    <resource-env-ref>
-      <description>The external content repository</description>
-      <resource-env-ref-name>jcr/Repository</resource-env-ref-name>
-      <resource-env-ref-type>javac.jcr.Repository</resource-env-ref-type>
-    </resource-env-ref>
-
-...SomeServlet.java:
-    Context initial = new InitialContext();
-    Context context = (Context) initial.lookup("java:comp/env");
-    Repository repository = (Repository) context.lookup("jcr/Repository");
-
- -

-Note that in the example above only the context.xml configuration file -contains a direct references to the JCR-RMI layer. All other parts of the -web application can be implemented using the standard JCR interfaces. - - diff --git a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/iterator/package.html b/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/iterator/package.html deleted file mode 100644 index 00327bdc80e..00000000000 --- a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/iterator/package.html +++ /dev/null @@ -1,26 +0,0 @@ - - -Utility classes for implementing JCR iterators based on static arrays. -

-This package contains array-based implementations of the JCR -{@link javax.jcr.RangeIterator RangeIterator} interfaces. -

-These utility classes were designed for the transparent JCR-RMI layer, -but can easily be used as a part of any JCR repository implementation. -This package depends only on the standard JCR and J2SE APIs. - diff --git a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/observation/package.html b/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/observation/package.html deleted file mode 100644 index 79e5eac5cac..00000000000 --- a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/observation/package.html +++ /dev/null @@ -1,71 +0,0 @@ - - -

-Helper class used by the observation manager classes. -The JCR observation framework defines a notification mechanism where an -EventListener is registered with the observation manager -to receive certain events during the lifetime of the registration. For -the remote case, where the repository and the application run in different -Java VMs on possibly different hosts, there are issues related to the -observation framework. -

-The listener mechanism is a call-back mechanism where the server calls -code in the client application. The client application code most probably -hooks into other parts of that application. Therefore it is not practically -feasible to just require the client listener to be serializable to be sent -to the server for several reasons: -

    -
  • The RMI server cannot call any method on the RMI client. To support such -call-back situations, the client side application would have to register -another server, which the server side would have to call. -
  • When trying to "transfer" the listener to the server side, the listener -class would have to be available to the server side - either locally in the -class path or through RMI class loading mechanisms. -
-

-To circumvent these issues and still be able to register event listeners, -support for observation events is implemented in a manner similar to the Java -Management Extensions Remote API 1.0 (JSR 160) as laid out in Chapter 2.4, -Adding Remote Listeners: -

-The ObservationManager interface is not implemented in the RMI layer like -other interfaces, which just forward calls to the API to the corresponding -remote object by means of the RMI framework. Instead the client-side -ObservationManager manages its own list of registered event listeners. Each -listener registered with an ObservationManager is assigned a unique -identifier. -

-The unique identifier along with the filter configuration (event type, -path, depth flag, uuid list, node type list, local flag) is sent to the -server-side remote observation manager. This latter instantiates a proxy -event listener representing the client side event listener contains the -unique identifier as a ilnk to the client side event listener. The proxy -event listener is the registered to the repository's ObservationManager -with the configuration received from the client side. -

-When an event arrives at the event listener proxy, the proxy creates a -new RemoteEvent instance, which contains the client-side event listener -identifier along with the Event objects from the EventIterator. This -RemoteEvent instance is added to a server-side queue, which may be -retrieved from the client-side. -

-The client-side ObservationManager has a helper class ClientEventPoll, -which works in the background asking the server for the RemoteEvents from -the event queue. Each such event is then dispatched to the client-side -event listener by calling the EventListener.onEvent() method. - diff --git a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/remote/package.html b/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/remote/package.html deleted file mode 100644 index 4d971e6eefd..00000000000 --- a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/remote/package.html +++ /dev/null @@ -1,35 +0,0 @@ - - -Remote interfaces of the transparent JCR-RMI layer. -

-This package contains all the interfaces and classes used by both -the client and server sides of the transparent JCR-RMI layer. -The compiled contents of this package should thus be included -in both client and server installations. Note also that RMI stubs and -skeletons need to be generated for all the remote interfaces when using -old JDK versions (stubs for JDK < 1.5, skeletons for JDK < 1.2). -

-The interfaces in this package are remote versions of the -corresponding interfaces in the javax.jcr packages. They are used by -the adapter classes in the .rmi.client and .rmi.server packages. The server -classes adapt local JCR objects to the remote interfaces, and the client -classes adapt the resulting remote references back to the JCR interfaces. -

-The SerialValue class is a decorator utility used by both the client and -server classes to safely pass Value objects over the network. - diff --git a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/server/iterator/package.html b/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/server/iterator/package.html deleted file mode 100644 index 1fd4bb78e1d..00000000000 --- a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/server/iterator/package.html +++ /dev/null @@ -1,19 +0,0 @@ - - -Remote adapters for local iterators. - diff --git a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/server/package.html b/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/server/package.html deleted file mode 100644 index 7ee6b820ccb..00000000000 --- a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/server/package.html +++ /dev/null @@ -1,80 +0,0 @@ - - -Server implementation of the transparent JCR-RMI layer. -

-This package contains the default server implementation of the -transparent JCR-RMI layer. The classes in this package can be used -to make a local JCR repository available as an RMI service. In addition, -this package offers a straightforward mechanism for extending or modifying -the behaviour of the server layer. -

-The contents of this package is designed using two design patterns, -Factory and Adapter. All the remotely accessible ServerObject subclasses -implement the Adapter pattern to adapt a local JCR interface to the -corresponding remote JCR-RMI interface. The Factory pattern is used -to centralize the creation and configuration of all adapter instances. - -

Setting up a JCR-RMI server

-

-Setting up the server part of the JCR-RMI layer is quite straightforward. -After instantiating a local JCR repository you need to wrap it into a -remote adapter and create an RMI binding for the repository. A variation -of the following code is usually all that is needed in addition to the -standard RMI setup (starting rmiregistry, etc.): - -

-    Repository repository = ...; // The local repository
-    String name = ...; // The RMI URL for the repository
-    
-    RemoteAdapterFactory factory = new ServerAdapterFactory();
-    RemoteRepository remote = factory.getRemoteRepository(repository);
-    Naming.bind(name, remote);  // Make the RMI binding using java.rmi.Naming
-
- -

Extending the JCR-RMI server

-

-The Factory pattern used by this package makes it easy to extend -the behaviour of the JCR-RMI server. Such changes in behaviour or policy -can be implemented by modifying or replacing the default -ServerAdapterFactory used in the example above. -

-The following example code adds transparent logging of all session logins -and logouts: - -

-    Repository repository = ...; // The local repository
-    String name = ...; // The RMI URL for the repository
-    
-    RemoteAdapterFactory factory = new ServerAdapterFactory() {
-        public RemoteSession getRemoteSession(Session session)
-                throws RemoteException {
-            System.out.println("LOGIN: " + session.getUserId());
-            return new ServerSession(session, this) {
-                public void logout() {
-                    System.out.println("LOGOUT: " + session.getUserId());
-                    super.logout();
-                }
-            };
-        }
-    };
-
-    RemoteRepository remote = factory.getRemoteRepository(repository);
-    Naming.bind(name, remote);  // Make the RMI binding using java.rmi.Naming
-
- - diff --git a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/value/package.html b/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/value/package.html deleted file mode 100644 index 8dc61302031..00000000000 --- a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/value/package.html +++ /dev/null @@ -1,30 +0,0 @@ - - - -Serializable implementation of the JCR Value interfaces. -

-This package contains a simple in-memory implementation of the JCR -{@link javax.jcr.Value Value} and {@link javax.jcr.ValueFactory ValueFactory} -interfaces. The implementation has no external dependencies and supports -serialization of Value instances. -

-

-Note that the Value instances created by this package are thread safe. -

- - diff --git a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/xml/package.html b/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/xml/package.html deleted file mode 100644 index 9040e137b0e..00000000000 --- a/jackrabbit-jcr-rmi/src/main/javadoc/org/apache/jackrabbit/rmi/xml/package.html +++ /dev/null @@ -1,31 +0,0 @@ - - -Utility classes for importing SAX event streams. -

-The classes in this package can be used for to implement the JCR -{@link javax.jcr.Session#getImportContentHandler(java.lang.String) Session.getImportContentHandler(String)} -and -{@link javax.jcr.Workspace#getImportContentHandler(java.lang.String, int) Workspace.getImportContentHandler(String, int)} -methods in terms of the corresponding importXML() methods. -

-These utility classes were designed for the transparent JCR-RMI layer, -but can easily be used as a part of any JCR repository implementation. -The public interface of this package depends only on the standard JCR and -J2SE APIs. The implementation uses Xerces as an extra dependency to -serialize the SAX event streams. - diff --git a/jackrabbit-jcr-rmi/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory b/jackrabbit-jcr-rmi/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory deleted file mode 100644 index 26b601efd87..00000000000 --- a/jackrabbit-jcr-rmi/src/main/resources/META-INF/services/javax.jcr.RepositoryFactory +++ /dev/null @@ -1,16 +0,0 @@ -# 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. - -org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory diff --git a/jackrabbit-jcr-rmi/src/main/resources/jackrabbit-rmi-service.xml b/jackrabbit-jcr-rmi/src/main/resources/jackrabbit-rmi-service.xml deleted file mode 100644 index 3ef2674f748..00000000000 --- a/jackrabbit-jcr-rmi/src/main/resources/jackrabbit-rmi-service.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - java:jcr/local - jnp://localhost:1099/jcrServer - - - jboss.jca:service=ManagedConnectionFactory,name=jcr/local - - diff --git a/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/ConformanceTest.java b/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/ConformanceTest.java deleted file mode 100644 index f2f59d3e91a..00000000000 --- a/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/ConformanceTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi; - -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.apache.jackrabbit.test.JCRTestSuite; - -/** - * JCR API conformance test suite. - */ -public class ConformanceTest extends TestCase { - - public static TestSuite suite() { - TestSuite suite = new TestSuite(); - if (Boolean.getBoolean("jackrabbit.test.integration")) { - suite.addTest(new JCRTestSuite()); - } - return suite; - } - -} diff --git a/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java b/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java deleted file mode 100644 index 055d4b881c3..00000000000 --- a/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.rmi; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.rmi.server.RemoteObject; -import java.security.Principal; -import java.util.Properties; - -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.SimpleCredentials; - -import org.apache.jackrabbit.core.JackrabbitRepositoryStub; -import org.apache.jackrabbit.core.SessionImpl; -import org.apache.jackrabbit.rmi.client.ClientAdapterFactory; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.ServerAdapterFactory; -import org.apache.jackrabbit.rmi.server.principal.ServerGroup; -import org.apache.jackrabbit.test.RepositoryStubException; - -public class RepositoryStubImpl extends JackrabbitRepositoryStub { - - /** - * A known principal used for access control tests. - */ - private Principal principal; - - private RemoteRepository remote; - - private Repository repository; - - public RepositoryStubImpl(Properties env) { - super(env); - } - - @Override - public synchronized Repository getRepository() - throws RepositoryStubException { - if (repository == null) { - try { - Repository repo = super.getRepository(); - principal = findKnownPrincipal(repo); - - RemoteAdapterFactory raf = new ServerAdapterFactory(); - remote = raf.getRemoteRepository(repo); - - // Make sure that the remote reference survives serialization - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(buffer); - oos.writeObject(RemoteObject.toStub(remote)); - oos.close(); - - ObjectInputStream ois = new ObjectInputStream( - new ByteArrayInputStream(buffer.toByteArray())); - LocalAdapterFactory laf = new ClientAdapterFactory(); - repository = - laf.getRepository((RemoteRepository) ois.readObject()); - } catch (Exception e) { - throw new RepositoryStubException(e); - } - } - return repository; - } - - private static Principal findKnownPrincipal(Repository repo) - throws RepositoryException { - SessionImpl session = (SessionImpl) repo.login( - new SimpleCredentials("admin", "admin".toCharArray())); - try { - for (Principal principal : session.getSubject().getPrincipals()) { - if (!ServerGroup.isGroup(principal)) { - return principal; - } - } - throw new RepositoryException("Known principal not found"); - } finally { - session.logout(); - } - } - - @Override - public Principal getKnownPrincipal(Session ignored) - throws RepositoryException { - return principal; - } - -} diff --git a/jackrabbit-jcr-rmi/src/test/resources/logback-test.xml b/jackrabbit-jcr-rmi/src/test/resources/logback-test.xml deleted file mode 100644 index 15d98f9b73f..00000000000 --- a/jackrabbit-jcr-rmi/src/test/resources/logback-test.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - target/jcr.log - - %date{HH:mm:ss.SSS} %-5level %-40([%thread] %F:%L) %msg%n - - - - - - - - diff --git a/jackrabbit-jcr-rmi/src/test/resources/repositoryStubImpl.properties b/jackrabbit-jcr-rmi/src/test/resources/repositoryStubImpl.properties deleted file mode 100644 index bc101aaba6e..00000000000 --- a/jackrabbit-jcr-rmi/src/test/resources/repositoryStubImpl.properties +++ /dev/null @@ -1,17 +0,0 @@ -# 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. - -# Stub implementation class -javax.jcr.tck.repository_stub_impl=org.apache.jackrabbit.rmi.RepositoryStubImpl diff --git a/jackrabbit-jcr-server-jakarta/pom.xml b/jackrabbit-jcr-server-jakarta/pom.xml index a8144bdceed..30ab1fbfce2 100644 --- a/jackrabbit-jcr-server-jakarta/pom.xml +++ b/jackrabbit-jcr-server-jakarta/pom.xml @@ -20,10 +20,12 @@ org.apache.jackrabbit jackrabbit-jcr-server-project - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-jcr-server-project jackrabbit-jcr-server-jakarta + Jackrabbit JCR Server (Jakarta) + WebDAV server implementations for JCR, using supporting the Jakarta Servlet API 5.0, as transformed from the jackrabbit-jcr-server project. diff --git a/jackrabbit-jcr-server-project/pom.xml b/jackrabbit-jcr-server-project/pom.xml index 1a01ea1b7d8..5bc567161dc 100644 --- a/jackrabbit-jcr-server-project/pom.xml +++ b/jackrabbit-jcr-server-project/pom.xml @@ -20,10 +20,12 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-jcr-server-project + Jackrabbit JCR Server (parent) + Parent project for JCR Server for both legacy Servlet API and Jakarta Servlet API 5.0. pom ../jackrabbit-jcr-server diff --git a/jackrabbit-jcr-server/pom.xml b/jackrabbit-jcr-server/pom.xml index e5b2dcbf29e..a71a6eeb1d4 100644 --- a/jackrabbit-jcr-server/pom.xml +++ b/jackrabbit-jcr-server/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-jcr-server-project - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-jcr-server-project jackrabbit-jcr-server @@ -42,7 +42,6 @@ **/*Test.java - once ${test.opts} @@ -171,15 +170,6 @@ derby.stream.error.file target/derby.log - - known.issues - - - org.apache.jackrabbit.webdav.server.RFC4918IfHeaderTest#testPutIfEtag - - org.apache.jackrabbit.webdav.server.RFC4918IfHeaderTest#testPutIfLockToken - - @@ -199,6 +189,83 @@ javax.servlet-api provided + + + commons-fileupload + commons-fileupload + + + + + org.osgi + org.osgi.compendium + 5.0.0 + provided + + + org.apache.felix + org.apache.felix.scr.annotations + 1.12.0 + provided + + + org.osgi + org.osgi.annotation + provided + + + + junit + junit + test + + + org.easymock + easymock + test + + + org.apache.jackrabbit + jackrabbit-core + ${project.version} + test + + + org.apache.jackrabbit + jackrabbit-jcr-tests + ${project.version} + test + + + org.eclipse.jetty + jetty-server + test + + + org.eclipse.jetty + jetty-servlet + test + + + ch.qos.logback + logback-classic + test + + + org.mockito + mockito-core + test + + + org.apache.derby + derby + test + + + org.apache.derby + derbytools + test + diff --git a/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrValueType.java b/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrValueType.java index 9d941c551d5..5f119377ee1 100644 --- a/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrValueType.java +++ b/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrValueType.java @@ -20,6 +20,7 @@ * * @deprecated As of Jackrabbit 2.2. Please Use {@link org.apache.jackrabbit.commons.webdav.JcrValueType} instead. */ +@Deprecated public final class JcrValueType extends org.apache.jackrabbit.commons.webdav.JcrValueType { } \ No newline at end of file diff --git a/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/property/LengthsProperty.java b/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/property/LengthsProperty.java index fb1ef82a90b..ebd1b9bce12 100644 --- a/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/property/LengthsProperty.java +++ b/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/property/LengthsProperty.java @@ -23,7 +23,7 @@ import org.w3c.dom.Element; /** - * LengthsProperty extends {@link org.apache.jackrabbit.webdav.property.DavProperty} providing + * {@code LengthsProperty} extends {@link org.apache.jackrabbit.webdav.property.DavProperty} providing * utilities to handle the multiple lengths of the property item represented * by this resource. */ @@ -32,7 +32,7 @@ public class LengthsProperty extends AbstractDavProperty implements Item private final long[] value; /** - * Create a new LengthsProperty from the given long array. + * Create a new {@code LengthsProperty} from the given long array. * * @param lengths as retrieved from the JCR property */ @@ -42,10 +42,10 @@ public LengthsProperty(long[] lengths) { } /** - * Returns an array of {@link long}s representing the value of this + * Returns an array of {@code long}s representing the value of this * property. * - * @return an array of {@link long}s + * @return an array of {@code long}s */ public long[] getValue() { return value; diff --git a/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.java b/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.java index f975082d852..a41eb129279 100644 --- a/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.java +++ b/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.java @@ -214,7 +214,7 @@ protected boolean isPreconditionValid(WebdavRequest request, } } - return !resource.exists() || request.matchesIfHeader(resource); + return request.matchesIfHeader(resource); } /** diff --git a/jackrabbit-jcr-servlet-jakarta/pom.xml b/jackrabbit-jcr-servlet-jakarta/pom.xml index 88385c9d81b..a9153d2e157 100644 --- a/jackrabbit-jcr-servlet-jakarta/pom.xml +++ b/jackrabbit-jcr-servlet-jakarta/pom.xml @@ -20,10 +20,12 @@ org.apache.jackrabbit jackrabbit-jcr-servlet-project - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-jcr-servlet-project jackrabbit-jcr-servlet-jakarta + Jackrabbit JCR Servlets (Jakarta) + Servlets and related classes for easy use of JCR content repositories in web applications, supporting the Jakarta Servlet API 5.0, as transformed from the jackrabbit-jcr-servlet project. diff --git a/jackrabbit-jcr-servlet-project/pom.xml b/jackrabbit-jcr-servlet-project/pom.xml index b5eb38a9398..eb5d1f58548 100644 --- a/jackrabbit-jcr-servlet-project/pom.xml +++ b/jackrabbit-jcr-servlet-project/pom.xml @@ -20,12 +20,13 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-jcr-servlet-project pom - Jackrabbit WebDAV Project + Jackrabbit JCR Servlets (parent) + Parent project for JCR servlets for both legacy Servlet API and Jakarta Servlet API 5.0. ../jackrabbit-jcr-servlet ../jackrabbit-jcr-servlet-jakarta @@ -40,12 +41,6 @@ jackrabbit-jcr-commons ${project.version} - - org.apache.jackrabbit - jackrabbit-jcr-rmi - ${project.version} - true - org.apache.jackrabbit jackrabbit-core diff --git a/jackrabbit-jcr-servlet/pom.xml b/jackrabbit-jcr-servlet/pom.xml index 26f1de990e9..df38030b7b4 100644 --- a/jackrabbit-jcr-servlet/pom.xml +++ b/jackrabbit-jcr-servlet/pom.xml @@ -22,7 +22,7 @@ org.apache.jackrabbit jackrabbit-jcr-servlet-project - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-jcr-servlet-project @@ -40,6 +40,17 @@ javax.servlet-api provided + + org.apache.jackrabbit + jackrabbit-jcr-commons + ${project.version} + + + org.apache.jackrabbit + jackrabbit-core + ${project.version} + true + diff --git a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteBindingServlet.java b/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteBindingServlet.java deleted file mode 100644 index 5d21f1d6f89..00000000000 --- a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteBindingServlet.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.servlet.remote; - -import java.util.Enumeration; -import java.util.Hashtable; - -import javax.jcr.Repository; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.servlet.ServletException; - -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; - -/** - * Servlet that binds a repository from a servlet context attribute to JNDI - * as a remote repository reference. - *

- * The initialization parameters of this servlet are: - *

- *
javax.jcr.Repository
- *
- * Name of the servlet context attribute that contains the repository. - * The default value is "javax.jcr.Repository". - *
- *
org.apache.jackrabbit.rmi.server.RemoteAdapterFactory
- *
- * Name of the remote adapter factory class used to create the remote - * repository reference. The configured class should have public - * constructor that takes no arguments. - *
- *
location
- *
- * Location where to bind the repository in the JNDI directory. - * The default value is - * "org/apache/jackrabbit/rmi/remote/RemoteRepository". - *
- *
*
- *
- * All other init parameters are used as the JNDI environment when - * instantiating {@link InitialContext} for binding up the repository. - *
- *
- * - * @since 1.4 - */ -public class JNDIRemoteBindingServlet extends RemoteBindingServlet { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = -7984144838866544543L; - - /** - * JNDI context to which to bind the repository. - */ - private Context context; - - /** - * Location of the repository within the JNDI context. - */ - private String location = - RemoteRepository.class.getName().replace('.', '/'); - - /** - * Binds a repository from the servlet context in the configured RMI URL. - * - * @throws ServletException if the repository could not be bound in RMI - */ - public void init() throws ServletException { - try { - Hashtable environment = new Hashtable(); - Enumeration names = getInitParameterNames(); - while (names.hasMoreElements()) { - String name = (String) names.nextElement(); - if (name.equals("location")) { - location = getInitParameter(name); - } else if (!name.equals(Repository.class.getName()) - && !name.equals(RemoteAdapterFactory.class.getName())) { - environment.put(name, getInitParameter(name)); - } - } - context = new InitialContext(environment); - context.bind(location, getRemoteRepository()); - } catch (NamingException e) { - throw new ServletException( - "Failed to bind remote repository to JNDI: " + location, e); - } - } - - /** - * Unbinds the remote repository from JNDI. - */ - public void destroy() { - try { - context.unbind(location); - } catch (NamingException e) { - log("Failed to unbind remote repository from JNDI: " + location, e); - } - } - -} diff --git a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteRepositoryServlet.java b/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteRepositoryServlet.java deleted file mode 100644 index 0b62965bcfd..00000000000 --- a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteRepositoryServlet.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.servlet.remote; - -import java.util.Enumeration; -import java.util.Hashtable; - -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.servlet.ServletException; - -import org.apache.jackrabbit.commons.repository.RepositoryFactory; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.repository.JNDIRemoteRepositoryFactory; -import org.apache.jackrabbit.servlet.AbstractRepositoryServlet; - -/** - * Servlet that makes a remote repository from JNDI available as an attribute - * in the servlet context. - *

- * The supported initialization parameters of this servlet are: - *

- *
javax.jcr.Repository
- *
- * Name of the servlet context attribute to put the repository in. - * The default value is "javax.jcr.Repository". - *
- *
org.apache.jackrabbit.rmi.client.LocalAdapterFactory
- *
- * Name of the local adapter factory class used to create the local - * adapter for the remote repository. The configured class should have - * public constructor that takes no arguments. - *
- *
location
- *
- * Location of the remote repository in the JNDI directory. - * The default value is - * "org/apache/jackrabbit/rmi/remote/RemoteRepository". - *
- *
*
- *
- * All other init parameters are used as the JNDI environment when - * instantiating {@link InitialContext} for looking up the repository. - *
- *
- *

- * This servlet can also be mapped to the URL space. See - * {@link AbstractRepositoryServlet} for the details. - * - * @since 1.4 - */ -public class JNDIRemoteRepositoryServlet extends RemoteRepositoryServlet { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = 9029928193416404478L; - - /** - * Returns the remote repository in the configured JNDI location. - * - * @return repository - * @throws RepositoryException if the repository could not be accessed - */ - @Override - protected Repository getRepository() throws RepositoryException { - String location = - "//localhost/" + RemoteRepository.class.getName().replace('.', '/'); - try { - Hashtable environment = new Hashtable(); - Enumeration names = getInitParameterNames(); - while (names.hasMoreElements()) { - String name = (String) names.nextElement(); - if (name.equals("location")) { - location = getInitParameter(name); - } else if (!name.equals(Repository.class.getName()) - && !name.equals(LocalAdapterFactory.class.getName())) { - environment.put(name, getInitParameter(name)); - } - } - return new JNDIRemoteRepositoryFactory( - getLocalAdapterFactory(), - new InitialContext(environment), location).getRepository(); - } catch (NamingException e) { - throw new RepositoryException( - "Repository not found: Invalid JNDI context", e); - } - } - -} diff --git a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteBindingServlet.java b/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteBindingServlet.java deleted file mode 100644 index fe591a36a23..00000000000 --- a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteBindingServlet.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.servlet.remote; - -import java.net.MalformedURLException; -import java.rmi.Naming; -import java.rmi.NotBoundException; -import java.rmi.RemoteException; - -import javax.servlet.ServletException; - -/** - * Servlet that binds a repository from a servlet context attribute in RMI. - *

- * The initialization parameters of this servlet are: - *

- *
javax.jcr.Repository
- *
- * Name of the servlet context attribute that contains the repository. - * The default value is "javax.jcr.Repository". - *
- *
org.apache.jackrabbit.rmi.server.RemoteAdapterFactory
- *
- * Name of the remote adapter factory class used to create the remote - * repository reference. The configured class should have public - * constructor that takes no arguments. - *
- *
url
- *
- * RMI URL where to bind the repository in. The default value is - * "//localhost/javax/jcr/Repository". - *
- *
- * - * @since 1.4 - */ -public class RMIRemoteBindingServlet extends RemoteBindingServlet { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = 1627580747678104906L; - - /** - * Location of the repository within the JNDI context. - */ - private String url; - - /** - * Binds a repository from the servlet context in the configured RMI URL. - * - * @throws ServletException if the repository could not be bound in RMI - */ - public void init() throws ServletException { - url = getInitParameter("url"); - if (url == null) { - url = "//localhost/javax/jcr/Repository"; - } - try { - Naming.rebind(url, getRemoteRepository()); - } catch (MalformedURLException e) { - log("Invalid RMI URL: " + url, e); - } catch (RemoteException e) { - log("Failed to bind repository to RMI: " + url, e); - } - } - - /** - * Unbinds the repository from RMI. - */ - public void destroy() { - try { - Naming.unbind(url); - } catch (NotBoundException e) { - // Ignore, perhaps the reference was already manually removed - } catch (MalformedURLException e) { - // Ignore, we already logged a warning about this during init() - } catch (RemoteException e) { - log("Failed to unbind repository from RMI: " + url, e); - } - } - -} diff --git a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteRepositoryServlet.java b/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteRepositoryServlet.java deleted file mode 100644 index 292a0c1d58e..00000000000 --- a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteRepositoryServlet.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.servlet.remote; - -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.servlet.ServletException; - -import org.apache.jackrabbit.rmi.repository.RMIRemoteRepositoryFactory; -import org.apache.jackrabbit.servlet.AbstractRepositoryServlet; - -/** - * Servlet that makes a repository from RMI available as an attribute - * in the servlet context. - *

- * The supported initialization parameters of this servlet are: - *

- *
javax.jcr.Repository
- *
- * Name of the servlet context attribute to put the repository in. - * The default value is "javax.jcr.Repository". - *
- *
org.apache.jackrabbit.rmi.client.LocalAdapterFactory
- *
- * Name of the local adapter factory class used to create the local - * adapter for the remote repository. The configured class should have - * public constructor that takes no arguments. - *
- *
url
- *
- * RMI URL of the remote repository. The default value is - * "//localhost/javax/jcr/Repository". - *
- *
- *

- * This servlet can also be mapped to the URL space. See - * {@link AbstractRepositoryServlet} for the details. - * - * @since 1.4 - */ -public class RMIRemoteRepositoryServlet extends RemoteRepositoryServlet { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = 2410543206806054854L; - - /** - * Creates and returns an RMI repository factory for the configured RMI URL. - * - * @return RMI repository factory - * @throws RepositoryException if the factory could not be created - */ - @Override - protected Repository getRepository() throws RepositoryException { - return new RMIRemoteRepositoryFactory( - getLocalAdapterFactory(), - getInitParameter("url", "//localhost/javax/jcr/Repository") - ).getRepository(); - } - -} diff --git a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteBindingServlet.java b/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteBindingServlet.java deleted file mode 100644 index 77bca0b5d52..00000000000 --- a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteBindingServlet.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.servlet.remote; - -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.rmi.RemoteException; -import java.rmi.server.RemoteObject; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.ServerAdapterFactory; -import org.apache.jackrabbit.servlet.ServletRepository; - -/** - * Servlet that makes a repository in servlet context available as a remote - * repository reference. By default this servlet makes the serialized - * reference available through HTTP GET, but subclasses can extend this - * behavior to bind the remote reference to various locations like JNDI - * or the RMI registry. - *

- * The initialization parameters of this servlet are: - *

- *
javax.jcr.Repository
- *
- * Name of the servlet context attribute that contains the repository. - * The default value is "javax.jcr.Repository". - *
- *
org.apache.jackrabbit.rmi.server.RemoteAdapterFactory
- *
- * Name of the remote adapter factory class used to create the remote - * repository reference. The configured class should have public - * constructor that takes no arguments. - *
- *
- * - * @since 1.4 - */ -public class RemoteBindingServlet extends HttpServlet { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = -162482284843619248L; - - /** - * Remote repository. - */ - private RemoteRepository remote; - - /** - * Returns the configured remote repository reference. The remote - * repository is instantiated and memorized during the first call to - * this method. - * - * @return remote repository - * @throws ServletException if the repository could not be instantiated - */ - protected RemoteRepository getRemoteRepository() throws ServletException { - if (remote == null) { - try { - RemoteAdapterFactory factory = getRemoteAdapterFactory(); - remote = factory.getRemoteRepository(new ServletRepository(this)); - } catch (RemoteException e) { - throw new ServletException( - "Failed to create the remote repository reference", e); - } - } - return remote; - } - - /** - * Instantiates and returns the configured remote adapter factory. - * - * @return remote adapter factory - * @throws ServletException if the factory could not be instantiated - */ - private RemoteAdapterFactory getRemoteAdapterFactory() - throws ServletException { - String name = getInitParameter(RemoteAdapterFactory.class.getName()); - if (name == null) { - return new ServerAdapterFactory(); - } - try { - Class factoryClass = Class.forName(name); - return (RemoteAdapterFactory) factoryClass.newInstance(); - } catch (ClassNotFoundException e) { - throw new ServletException( - "Remote adapter factory class not found: " + name, e); - } catch (InstantiationException e) { - throw new ServletException( - "Failed to instantiate the adapter factory: " + name, e); - } catch (IllegalAccessException e) { - throw new ServletException( - "Adapter factory constructor is not public: " + name, e); - } catch (ClassCastException e) { - throw new ServletException( - "Invalid remote adapter factory class: " + name, e); - } - } - - /** - * Outputs the remote repository reference as a serialized stream. - * - * @param request HTTP request - * @param response HTTP response - * @throws ServletException if the remote reference is not available - * @throws IOException on IO errors - */ - protected void doGet( - HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - response.setContentType("application/octet-stream"); - ObjectOutputStream output = - new ObjectOutputStream(response.getOutputStream()); - output.writeObject(RemoteObject.toStub(getRemoteRepository())); - output.flush(); - } - -} diff --git a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteRepositoryServlet.java b/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteRepositoryServlet.java deleted file mode 100644 index d219cae55cb..00000000000 --- a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteRepositoryServlet.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.servlet.remote; - -import javax.jcr.RepositoryException; - -import org.apache.jackrabbit.rmi.client.ClientAdapterFactory; -import org.apache.jackrabbit.rmi.client.LocalAdapterFactory; -import org.apache.jackrabbit.servlet.AbstractRepositoryServlet; - -/** - * Abstract base class for servlets that make a remote repository available - * locally in the servlet context. - *

- * The supported initialization parameters of this servlet are: - *

- *
javax.jcr.Repository
- *
- * Name of the servlet context attribute to put the repository in. - * The default value is "javax.jcr.Repository". - *
- *
org.apache.jackrabbit.rmi.client.LocalAdapterFactory
- *
- * Name of the local adapter factory class used to create the local - * adapter for the remote repository. The configured class should have - * public constructor that takes no arguments. - *
- *
- *

- * This servlet can also be mapped to the URL space. See - * {@link AbstractRepositoryServlet} for the details. - * - * @since 1.4 - */ -public abstract class RemoteRepositoryServlet - extends AbstractRepositoryServlet { - - /** - * Instantiates and returns the configured local adapter factory. - * - * @return local adapter factory - * @throws RepositoryException if the factory could not be instantiated - */ - protected LocalAdapterFactory getLocalAdapterFactory() - throws RepositoryException { - String name = getInitParameter( - LocalAdapterFactory.class.getName(), - ClientAdapterFactory.class.getName()); - try { - Class factoryClass = Class.forName(name); - return (LocalAdapterFactory) factoryClass.newInstance(); - } catch (ClassNotFoundException e) { - throw new RepositoryException( - "Local adapter factory class not found: " + name, e); - } catch (InstantiationException e) { - throw new RepositoryException( - "Failed to instantiate the adapter factory: " + name, e); - } catch (IllegalAccessException e) { - throw new RepositoryException( - "Adapter factory constructor is not public: " + name, e); - } catch (ClassCastException e) { - throw new RepositoryException( - "Invalid local adapter factory class: " + name, e); - } - } - -} diff --git a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteBindingServlet.java b/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteBindingServlet.java deleted file mode 100644 index 8a3f395d184..00000000000 --- a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteBindingServlet.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.servlet.remote; - -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.net.MalformedURLException; -import java.net.URL; - -import javax.servlet.ServletException; - -/** - * Servlet that writes the remote reference of a repository in the servlet - * context to the configured URL. - *

- * The initialization parameters of this servlet are: - *

- *
javax.jcr.Repository
- *
- * Name of the servlet context attribute that contains the repository. - * The default value is "javax.jcr.Repository". - *
- *
org.apache.jackrabbit.rmi.server.RemoteAdapterFactory
- *
- * Name of the remote adapter factory class used to create the remote - * repository reference. The configured class should have public - * constructor that takes no arguments. - *
- *
url
- *
- * URL where to store the remote repository reference. - *
- *
- * - * @since 1.4 - */ -public class URLRemoteBindingServlet extends RemoteBindingServlet { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = 3187755583290121129L; - - /** - * Writes the remote reference of a repository in the servlet context - * to the configured URL. - * - * @throws ServletException if the URL could not be written to - */ - public void init() throws ServletException { - String url = getInitParameter("url"); - if (url == null) { - throw new ServletException("Missing init parameter: url"); - } - try { - ObjectOutputStream output = new ObjectOutputStream( - new URL(url).openConnection().getOutputStream()); - try { - output.writeObject(getRemoteRepository()); - } finally { - output.close(); - } - } catch (MalformedURLException e) { - throw new ServletException("Malformed URL: " + url, e); - } catch (IOException e) { - throw new ServletException("Failed to write to URL: " + url, e); - } - } - -} diff --git a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteRepositoryServlet.java b/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteRepositoryServlet.java deleted file mode 100644 index d4a6dba535d..00000000000 --- a/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteRepositoryServlet.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.servlet.remote; - -import java.net.MalformedURLException; -import java.net.URL; - -import javax.jcr.Repository; -import javax.jcr.RepositoryException; - -import org.apache.jackrabbit.rmi.repository.URLRemoteRepositoryFactory; -import org.apache.jackrabbit.servlet.AbstractRepositoryServlet; - -/** - * Servlet that makes a remote repository from a ULR available as an attribute - * in the servlet context. - *

- * The supported initialization parameters of this servlet are: - *

- *
javax.jcr.Repository
- *
- * Name of the servlet context attribute to put the repository in. - * The default value is "javax.jcr.Repository". - *
- *
org.apache.jackrabbit.rmi.client.LocalAdapterFactory
- *
- * Name of the local adapter factory class used to create the local - * adapter for the remote repository. The configured class should have - * public constructor that takes no arguments. - *
- *
url
- *
- * URL of the remote repository. - *
- *
- *

- * This servlet can also be mapped to the URL space. See - * {@link AbstractRepositoryServlet} for the details. - * - * @since 1.4 - */ -public class URLRemoteRepositoryServlet extends RemoteRepositoryServlet { - - /** - * Serial version UID. - */ - private static final long serialVersionUID = 6144781813459102448L; - - /** - * Returns the remote repository at the given URL. - * - * @return repository - * @throws RepositoryException if the repository could not be accessed - */ - @Override - protected Repository getRepository() throws RepositoryException { - String url = getInitParameter("url"); - if (url == null) { - throw new RepositoryException("Missing init parameter: url"); - } - - try { - return new URLRemoteRepositoryFactory( - getLocalAdapterFactory(), new URL(url)).getRepository(); - } catch (MalformedURLException e) { - throw new RepositoryException("Invalid repository URL: " + url, e); - } - } - -} diff --git a/jackrabbit-jcr-tests/pom.xml b/jackrabbit-jcr-tests/pom.xml index 8f632c79594..a829311864f 100644 --- a/jackrabbit-jcr-tests/pom.xml +++ b/jackrabbit-jcr-tests/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-jcr-tests diff --git a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/XMLChar.java b/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/XMLChar.java index 7cab3184059..1bccf02d052 100644 --- a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/XMLChar.java +++ b/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/XMLChar.java @@ -5,9 +5,9 @@ * 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. @@ -68,10 +68,10 @@ public class XMLChar { /** Pubid character mask. */ public static final int MASK_PUBID = 0x10; - - /** + + /** * Content character mask. Special characters are those that can - * be considered the start of markup, such as '<' and '&'. + * be considered the start of markup, such as '<' and '&'. * The various newline characters are considered special as well. * All other valid XML characters can be considered content. *

@@ -90,10 +90,10 @@ public class XMLChar { // static { - + // Initializing the Character Flag Array // Code generated by: XMLCharGenerator. - + CHARS[9] = 35; CHARS[10] = 19; CHARS[13] = 19; @@ -897,21 +897,23 @@ public static boolean isPubid(int c) { * @return true if name is a valid Name */ public static boolean isValidName(String name) { - if (name.length() == 0) + final int length = name.length(); + if (length == 0) { return false; + } char ch = name.charAt(0); - if( isNameStart(ch) == false) - return false; - for (int i = 1; i < name.length(); i++ ) { - ch = name.charAt(i); - if( isName( ch ) == false ){ - return false; - } + if (!isNameStart(ch)) { + return false; + } + for (int i = 1; i < length; ++i) { + ch = name.charAt(i); + if (!isName(ch)) { + return false; + } } return true; } // isValidName(String):boolean - - + /* * from the namespace rec * [4] NCName ::= (Letter | '_') (NCNameChar)* @@ -924,16 +926,19 @@ public static boolean isValidName(String name) { * @return true if name is a valid NCName */ public static boolean isValidNCName(String ncName) { - if (ncName.length() == 0) + final int length = ncName.length(); + if (length == 0) { return false; + } char ch = ncName.charAt(0); - if( isNCNameStart(ch) == false) - return false; - for (int i = 1; i < ncName.length(); i++ ) { - ch = ncName.charAt(i); - if( isNCName( ch ) == false ){ - return false; - } + if (!isNCNameStart(ch)) { + return false; + } + for (int i = 1; i < length; ++i) { + ch = ncName.charAt(i); + if (!isNCName(ch)) { + return false; + } } return true; } // isValidNCName(String):boolean @@ -946,16 +951,18 @@ public static boolean isValidNCName(String ncName) { * in the XML 1.0 Recommendation * * @param nmtoken string to check - * @return true if nmtoken is a valid Nmtoken + * @return true if nmtoken is a valid Nmtoken */ public static boolean isValidNmtoken(String nmtoken) { - if (nmtoken.length() == 0) + final int length = nmtoken.length(); + if (length == 0) { return false; - for (int i = 0; i < nmtoken.length(); i++ ) { - char ch = nmtoken.charAt(i); - if( ! isName( ch ) ){ - return false; - } + } + for (int i = 0; i < length; ++i) { + char ch = nmtoken.charAt(i); + if (!isName(ch)) { + return false; + } } return true; } // isValidName(String):boolean diff --git a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java b/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java index 37c7561bd93..883be3b54ba 100644 --- a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java +++ b/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java @@ -16,12 +16,16 @@ */ package org.apache.jackrabbit.test.api; +import static org.junit.Assert.assertNotEquals; + import java.util.Arrays; import java.util.HashSet; +import java.util.Random; import java.util.Set; import javax.jcr.NamespaceException; import javax.jcr.NamespaceRegistry; +import javax.jcr.Node; import javax.jcr.Property; import javax.jcr.RepositoryException; import javax.jcr.Session; @@ -364,6 +368,56 @@ public void testGetNamespacePrefixes() throws RepositoryException { } } + /** + * Tests that, after locally re-assigning a prefix, a previously created + * node continues to work with respect to sameness and consistent naming + * behavior. + */ + public void testPrefixRemapping() throws NamespaceException, RepositoryException { + Random r = new Random(); + int i1 = r.nextInt(); + int i2 = r.nextInt(); + String prefix = getUnusedPrefix(); + String uri1 = "foobar:1-" + i1; + String uri2 = "foobar:2-" + i2; + String testLocalName = "test"; + String expandedTestName ="{" + uri1 + "}" + testLocalName; + + try { + superuser.getWorkspace().getNamespaceRegistry().registerNamespace(prefix, uri1); + + String originalName = prefix + ":" + testLocalName; + Node testNode = superuser.getRootNode().addNode(originalName); + superuser.save(); + + // check that expanded name works + Node n2 = superuser.getRootNode().getNode(expandedTestName); + assertTrue(testNode.isSame(n2)); + + // remap prefix1 to uri2 + superuser.setNamespacePrefix(prefix, uri2); + + // check that expanded name still works + Node n3 = superuser.getRootNode().getNode(expandedTestName); + assertTrue(testNode.isSame(n3)); + + String remappedName = n3.getName(); + assertNotEquals(originalName, remappedName); + + int colon = remappedName.indexOf(':'); + assertTrue("remapped name must contain colon:" + remappedName, colon > 0); + String remappedPrefix = remappedName.substring(0, colon); + assertNotEquals("prefix after mapping must be different", prefix, remappedPrefix); + + assertEquals("remapped prefix need to map to original URI " + uri1, uri1, superuser.getNamespaceURI(remappedPrefix)); + } finally { + try { + superuser.getWorkspace().getNamespaceRegistry().unregisterNamespace(prefix); + } catch (RepositoryException ignored) { + // best effort cleanup + } + } + } /** * Returns a namespace prefix that is not in use. diff --git a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SysViewContentHandler.java b/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SysViewContentHandler.java index ca3e88a1c95..46af661eea4 100644 --- a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SysViewContentHandler.java +++ b/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SysViewContentHandler.java @@ -20,6 +20,7 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.apache.jackrabbit.test.AbstractJCRTest; +import org.junit.Assert; import javax.jcr.nodetype.NodeType; import javax.jcr.Session; @@ -45,8 +46,6 @@ import java.util.Iterator; import java.util.Map; -import junit.framework.Assert; - /** * ContentHandler implementation which checks if the system view export of * a node tree is compliant to the specification. diff --git a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/TreeComparator.java b/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/TreeComparator.java index 590819a6861..0b8daba3328 100644 --- a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/TreeComparator.java +++ b/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/TreeComparator.java @@ -28,12 +28,14 @@ import javax.jcr.Value; import javax.jcr.PathNotFoundException; import javax.jcr.nodetype.NodeTypeManager; + +import org.junit.Assert; + import javax.jcr.nodetype.NodeTypeIterator; import javax.jcr.nodetype.NodeType; import java.util.Calendar; -import java.io.ByteArrayInputStream; -import junit.framework.Assert; +import java.io.ByteArrayInputStream; /** * TreeComparator compares two trees. This allows re-use for diff --git a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/util/ISO9075.java b/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/util/ISO9075.java index b929648feab..17a8c9b364b 100644 --- a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/util/ISO9075.java +++ b/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/util/ISO9075.java @@ -21,6 +21,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.jackrabbit.test.XMLChar; + /** * Implements the encode and decode routines as specified for XML name to SQL * identifier conversion in ISO 9075-14:2003.
diff --git a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/util/XMLChar.java b/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/util/XMLChar.java deleted file mode 100644 index c3aaca2a67a..00000000000 --- a/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/util/XMLChar.java +++ /dev/null @@ -1,1027 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.test.api.util; - -// JCR-714: Class copied from jcr-commons to avoid the extra dependency - -// Note: This file is a copy from org.apache.xerces.util. -// See http://issues.apache.org/jira/browse/JCR-367 - -import java.util.Arrays; - -/** - * This class defines the basic XML character properties. The data - * in this class can be used to verify that a character is a valid - * XML character or if the character is a space, name start, or name - * character. - *

- * A series of convenience methods are supplied to ease the burden - * of the developer. Because inlining the checks can improve per - * character performance, the tables of character properties are - * public. Using the character as an index into the CHARS - * array and applying the appropriate mask flag (e.g. - * MASK_VALID), yields the same results as calling the - * convenience methods. There is one exception: check the comments - * for the isValid method for details. - * - * @author Glenn Marcy, IBM - * @author Andy Clark, IBM - * @author Eric Ye, IBM - * @author Arnaud Le Hors, IBM - * @author Michael Glavassevich, IBM - * @author Rahul Srivastava, Sun Microsystems Inc. - * - * @version $Id: XMLChar.java 776776 2009-05-20 17:33:05Z jukka $ - */ -public class XMLChar { - - // - // Constants - // - - /** Character flags. */ - private static final byte[] CHARS = new byte[1 << 16]; - - /** Valid character mask. */ - public static final int MASK_VALID = 0x01; - - /** Space character mask. */ - public static final int MASK_SPACE = 0x02; - - /** Name start character mask. */ - public static final int MASK_NAME_START = 0x04; - - /** Name character mask. */ - public static final int MASK_NAME = 0x08; - - /** Pubid character mask. */ - public static final int MASK_PUBID = 0x10; - - /** - * Content character mask. Special characters are those that can - * be considered the start of markup, such as '<' and '&'. - * The various newline characters are considered special as well. - * All other valid XML characters can be considered content. - *

- * This is an optimization for the inner loop of character scanning. - */ - public static final int MASK_CONTENT = 0x20; - - /** NCName start character mask. */ - public static final int MASK_NCNAME_START = 0x40; - - /** NCName character mask. */ - public static final int MASK_NCNAME = 0x80; - - // - // Static initialization - // - - static { - - // Initializing the Character Flag Array - // Code generated by: XMLCharGenerator. - - CHARS[9] = 35; - CHARS[10] = 19; - CHARS[13] = 19; - CHARS[32] = 51; - CHARS[33] = 49; - CHARS[34] = 33; - Arrays.fill(CHARS, 35, 38, (byte) 49 ); // Fill 3 of value (byte) 49 - CHARS[38] = 1; - Arrays.fill(CHARS, 39, 45, (byte) 49 ); // Fill 6 of value (byte) 49 - Arrays.fill(CHARS, 45, 47, (byte) -71 ); // Fill 2 of value (byte) -71 - CHARS[47] = 49; - Arrays.fill(CHARS, 48, 58, (byte) -71 ); // Fill 10 of value (byte) -71 - CHARS[58] = 61; - CHARS[59] = 49; - CHARS[60] = 1; - CHARS[61] = 49; - CHARS[62] = 33; - Arrays.fill(CHARS, 63, 65, (byte) 49 ); // Fill 2 of value (byte) 49 - Arrays.fill(CHARS, 65, 91, (byte) -3 ); // Fill 26 of value (byte) -3 - Arrays.fill(CHARS, 91, 93, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[93] = 1; - CHARS[94] = 33; - CHARS[95] = -3; - CHARS[96] = 33; - Arrays.fill(CHARS, 97, 123, (byte) -3 ); // Fill 26 of value (byte) -3 - Arrays.fill(CHARS, 123, 183, (byte) 33 ); // Fill 60 of value (byte) 33 - CHARS[183] = -87; - Arrays.fill(CHARS, 184, 192, (byte) 33 ); // Fill 8 of value (byte) 33 - Arrays.fill(CHARS, 192, 215, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[215] = 33; - Arrays.fill(CHARS, 216, 247, (byte) -19 ); // Fill 31 of value (byte) -19 - CHARS[247] = 33; - Arrays.fill(CHARS, 248, 306, (byte) -19 ); // Fill 58 of value (byte) -19 - Arrays.fill(CHARS, 306, 308, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 308, 319, (byte) -19 ); // Fill 11 of value (byte) -19 - Arrays.fill(CHARS, 319, 321, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 321, 329, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[329] = 33; - Arrays.fill(CHARS, 330, 383, (byte) -19 ); // Fill 53 of value (byte) -19 - CHARS[383] = 33; - Arrays.fill(CHARS, 384, 452, (byte) -19 ); // Fill 68 of value (byte) -19 - Arrays.fill(CHARS, 452, 461, (byte) 33 ); // Fill 9 of value (byte) 33 - Arrays.fill(CHARS, 461, 497, (byte) -19 ); // Fill 36 of value (byte) -19 - Arrays.fill(CHARS, 497, 500, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 500, 502, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 502, 506, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 506, 536, (byte) -19 ); // Fill 30 of value (byte) -19 - Arrays.fill(CHARS, 536, 592, (byte) 33 ); // Fill 56 of value (byte) 33 - Arrays.fill(CHARS, 592, 681, (byte) -19 ); // Fill 89 of value (byte) -19 - Arrays.fill(CHARS, 681, 699, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 699, 706, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 706, 720, (byte) 33 ); // Fill 14 of value (byte) 33 - Arrays.fill(CHARS, 720, 722, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 722, 768, (byte) 33 ); // Fill 46 of value (byte) 33 - Arrays.fill(CHARS, 768, 838, (byte) -87 ); // Fill 70 of value (byte) -87 - Arrays.fill(CHARS, 838, 864, (byte) 33 ); // Fill 26 of value (byte) 33 - Arrays.fill(CHARS, 864, 866, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 866, 902, (byte) 33 ); // Fill 36 of value (byte) 33 - CHARS[902] = -19; - CHARS[903] = -87; - Arrays.fill(CHARS, 904, 907, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[907] = 33; - CHARS[908] = -19; - CHARS[909] = 33; - Arrays.fill(CHARS, 910, 930, (byte) -19 ); // Fill 20 of value (byte) -19 - CHARS[930] = 33; - Arrays.fill(CHARS, 931, 975, (byte) -19 ); // Fill 44 of value (byte) -19 - CHARS[975] = 33; - Arrays.fill(CHARS, 976, 983, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 983, 986, (byte) 33 ); // Fill 3 of value (byte) 33 - CHARS[986] = -19; - CHARS[987] = 33; - CHARS[988] = -19; - CHARS[989] = 33; - CHARS[990] = -19; - CHARS[991] = 33; - CHARS[992] = -19; - CHARS[993] = 33; - Arrays.fill(CHARS, 994, 1012, (byte) -19 ); // Fill 18 of value (byte) -19 - Arrays.fill(CHARS, 1012, 1025, (byte) 33 ); // Fill 13 of value (byte) 33 - Arrays.fill(CHARS, 1025, 1037, (byte) -19 ); // Fill 12 of value (byte) -19 - CHARS[1037] = 33; - Arrays.fill(CHARS, 1038, 1104, (byte) -19 ); // Fill 66 of value (byte) -19 - CHARS[1104] = 33; - Arrays.fill(CHARS, 1105, 1117, (byte) -19 ); // Fill 12 of value (byte) -19 - CHARS[1117] = 33; - Arrays.fill(CHARS, 1118, 1154, (byte) -19 ); // Fill 36 of value (byte) -19 - CHARS[1154] = 33; - Arrays.fill(CHARS, 1155, 1159, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 1159, 1168, (byte) 33 ); // Fill 9 of value (byte) 33 - Arrays.fill(CHARS, 1168, 1221, (byte) -19 ); // Fill 53 of value (byte) -19 - Arrays.fill(CHARS, 1221, 1223, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1223, 1225, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1225, 1227, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1227, 1229, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1229, 1232, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 1232, 1260, (byte) -19 ); // Fill 28 of value (byte) -19 - Arrays.fill(CHARS, 1260, 1262, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1262, 1270, (byte) -19 ); // Fill 8 of value (byte) -19 - Arrays.fill(CHARS, 1270, 1272, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1272, 1274, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1274, 1329, (byte) 33 ); // Fill 55 of value (byte) 33 - Arrays.fill(CHARS, 1329, 1367, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 1367, 1369, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[1369] = -19; - Arrays.fill(CHARS, 1370, 1377, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 1377, 1415, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 1415, 1425, (byte) 33 ); // Fill 10 of value (byte) 33 - Arrays.fill(CHARS, 1425, 1442, (byte) -87 ); // Fill 17 of value (byte) -87 - CHARS[1442] = 33; - Arrays.fill(CHARS, 1443, 1466, (byte) -87 ); // Fill 23 of value (byte) -87 - CHARS[1466] = 33; - Arrays.fill(CHARS, 1467, 1470, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[1470] = 33; - CHARS[1471] = -87; - CHARS[1472] = 33; - Arrays.fill(CHARS, 1473, 1475, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[1475] = 33; - CHARS[1476] = -87; - Arrays.fill(CHARS, 1477, 1488, (byte) 33 ); // Fill 11 of value (byte) 33 - Arrays.fill(CHARS, 1488, 1515, (byte) -19 ); // Fill 27 of value (byte) -19 - Arrays.fill(CHARS, 1515, 1520, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 1520, 1523, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 1523, 1569, (byte) 33 ); // Fill 46 of value (byte) 33 - Arrays.fill(CHARS, 1569, 1595, (byte) -19 ); // Fill 26 of value (byte) -19 - Arrays.fill(CHARS, 1595, 1600, (byte) 33 ); // Fill 5 of value (byte) 33 - CHARS[1600] = -87; - Arrays.fill(CHARS, 1601, 1611, (byte) -19 ); // Fill 10 of value (byte) -19 - Arrays.fill(CHARS, 1611, 1619, (byte) -87 ); // Fill 8 of value (byte) -87 - Arrays.fill(CHARS, 1619, 1632, (byte) 33 ); // Fill 13 of value (byte) 33 - Arrays.fill(CHARS, 1632, 1642, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 1642, 1648, (byte) 33 ); // Fill 6 of value (byte) 33 - CHARS[1648] = -87; - Arrays.fill(CHARS, 1649, 1720, (byte) -19 ); // Fill 71 of value (byte) -19 - Arrays.fill(CHARS, 1720, 1722, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1722, 1727, (byte) -19 ); // Fill 5 of value (byte) -19 - CHARS[1727] = 33; - Arrays.fill(CHARS, 1728, 1743, (byte) -19 ); // Fill 15 of value (byte) -19 - CHARS[1743] = 33; - Arrays.fill(CHARS, 1744, 1748, (byte) -19 ); // Fill 4 of value (byte) -19 - CHARS[1748] = 33; - CHARS[1749] = -19; - Arrays.fill(CHARS, 1750, 1765, (byte) -87 ); // Fill 15 of value (byte) -87 - Arrays.fill(CHARS, 1765, 1767, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1767, 1769, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[1769] = 33; - Arrays.fill(CHARS, 1770, 1774, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 1774, 1776, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1776, 1786, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 1786, 2305, (byte) 33 ); // Fill 519 of value (byte) 33 - Arrays.fill(CHARS, 2305, 2308, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2308] = 33; - Arrays.fill(CHARS, 2309, 2362, (byte) -19 ); // Fill 53 of value (byte) -19 - Arrays.fill(CHARS, 2362, 2364, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2364] = -87; - CHARS[2365] = -19; - Arrays.fill(CHARS, 2366, 2382, (byte) -87 ); // Fill 16 of value (byte) -87 - Arrays.fill(CHARS, 2382, 2385, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2385, 2389, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 2389, 2392, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2392, 2402, (byte) -19 ); // Fill 10 of value (byte) -19 - Arrays.fill(CHARS, 2402, 2404, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2404, 2406, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2406, 2416, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2416, 2433, (byte) 33 ); // Fill 17 of value (byte) 33 - Arrays.fill(CHARS, 2433, 2436, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2436] = 33; - Arrays.fill(CHARS, 2437, 2445, (byte) -19 ); // Fill 8 of value (byte) -19 - Arrays.fill(CHARS, 2445, 2447, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2447, 2449, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2449, 2451, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2451, 2473, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2473] = 33; - Arrays.fill(CHARS, 2474, 2481, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2481] = 33; - CHARS[2482] = -19; - Arrays.fill(CHARS, 2483, 2486, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2486, 2490, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 2490, 2492, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2492] = -87; - CHARS[2493] = 33; - Arrays.fill(CHARS, 2494, 2501, (byte) -87 ); // Fill 7 of value (byte) -87 - Arrays.fill(CHARS, 2501, 2503, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2503, 2505, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2505, 2507, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2507, 2510, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2510, 2519, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[2519] = -87; - Arrays.fill(CHARS, 2520, 2524, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2524, 2526, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2526] = 33; - Arrays.fill(CHARS, 2527, 2530, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2530, 2532, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2532, 2534, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2534, 2544, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2544, 2546, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2546, 2562, (byte) 33 ); // Fill 16 of value (byte) 33 - CHARS[2562] = -87; - Arrays.fill(CHARS, 2563, 2565, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2565, 2571, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 2571, 2575, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2575, 2577, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2577, 2579, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2579, 2601, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2601] = 33; - Arrays.fill(CHARS, 2602, 2609, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2609] = 33; - Arrays.fill(CHARS, 2610, 2612, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2612] = 33; - Arrays.fill(CHARS, 2613, 2615, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2615] = 33; - Arrays.fill(CHARS, 2616, 2618, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2618, 2620, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2620] = -87; - CHARS[2621] = 33; - Arrays.fill(CHARS, 2622, 2627, (byte) -87 ); // Fill 5 of value (byte) -87 - Arrays.fill(CHARS, 2627, 2631, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2631, 2633, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2633, 2635, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2635, 2638, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2638, 2649, (byte) 33 ); // Fill 11 of value (byte) 33 - Arrays.fill(CHARS, 2649, 2653, (byte) -19 ); // Fill 4 of value (byte) -19 - CHARS[2653] = 33; - CHARS[2654] = -19; - Arrays.fill(CHARS, 2655, 2662, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 2662, 2674, (byte) -87 ); // Fill 12 of value (byte) -87 - Arrays.fill(CHARS, 2674, 2677, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2677, 2689, (byte) 33 ); // Fill 12 of value (byte) 33 - Arrays.fill(CHARS, 2689, 2692, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2692] = 33; - Arrays.fill(CHARS, 2693, 2700, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2700] = 33; - CHARS[2701] = -19; - CHARS[2702] = 33; - Arrays.fill(CHARS, 2703, 2706, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[2706] = 33; - Arrays.fill(CHARS, 2707, 2729, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2729] = 33; - Arrays.fill(CHARS, 2730, 2737, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2737] = 33; - Arrays.fill(CHARS, 2738, 2740, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2740] = 33; - Arrays.fill(CHARS, 2741, 2746, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 2746, 2748, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2748] = -87; - CHARS[2749] = -19; - Arrays.fill(CHARS, 2750, 2758, (byte) -87 ); // Fill 8 of value (byte) -87 - CHARS[2758] = 33; - Arrays.fill(CHARS, 2759, 2762, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2762] = 33; - Arrays.fill(CHARS, 2763, 2766, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2766, 2784, (byte) 33 ); // Fill 18 of value (byte) 33 - CHARS[2784] = -19; - Arrays.fill(CHARS, 2785, 2790, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 2790, 2800, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2800, 2817, (byte) 33 ); // Fill 17 of value (byte) 33 - Arrays.fill(CHARS, 2817, 2820, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2820] = 33; - Arrays.fill(CHARS, 2821, 2829, (byte) -19 ); // Fill 8 of value (byte) -19 - Arrays.fill(CHARS, 2829, 2831, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2831, 2833, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2833, 2835, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2835, 2857, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2857] = 33; - Arrays.fill(CHARS, 2858, 2865, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2865] = 33; - Arrays.fill(CHARS, 2866, 2868, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2868, 2870, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2870, 2874, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 2874, 2876, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2876] = -87; - CHARS[2877] = -19; - Arrays.fill(CHARS, 2878, 2884, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 2884, 2887, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2887, 2889, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2889, 2891, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2891, 2894, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2894, 2902, (byte) 33 ); // Fill 8 of value (byte) 33 - Arrays.fill(CHARS, 2902, 2904, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2904, 2908, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2908, 2910, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2910] = 33; - Arrays.fill(CHARS, 2911, 2914, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2914, 2918, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2918, 2928, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2928, 2946, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 2946, 2948, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[2948] = 33; - Arrays.fill(CHARS, 2949, 2955, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 2955, 2958, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2958, 2961, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[2961] = 33; - Arrays.fill(CHARS, 2962, 2966, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 2966, 2969, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2969, 2971, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2971] = 33; - CHARS[2972] = -19; - CHARS[2973] = 33; - Arrays.fill(CHARS, 2974, 2976, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2976, 2979, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2979, 2981, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2981, 2984, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2984, 2987, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2987, 2990, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2990, 2998, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[2998] = 33; - Arrays.fill(CHARS, 2999, 3002, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 3002, 3006, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3006, 3011, (byte) -87 ); // Fill 5 of value (byte) -87 - Arrays.fill(CHARS, 3011, 3014, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 3014, 3017, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3017] = 33; - Arrays.fill(CHARS, 3018, 3022, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3022, 3031, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[3031] = -87; - Arrays.fill(CHARS, 3032, 3047, (byte) 33 ); // Fill 15 of value (byte) 33 - Arrays.fill(CHARS, 3047, 3056, (byte) -87 ); // Fill 9 of value (byte) -87 - Arrays.fill(CHARS, 3056, 3073, (byte) 33 ); // Fill 17 of value (byte) 33 - Arrays.fill(CHARS, 3073, 3076, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3076] = 33; - Arrays.fill(CHARS, 3077, 3085, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3085] = 33; - Arrays.fill(CHARS, 3086, 3089, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3089] = 33; - Arrays.fill(CHARS, 3090, 3113, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[3113] = 33; - Arrays.fill(CHARS, 3114, 3124, (byte) -19 ); // Fill 10 of value (byte) -19 - CHARS[3124] = 33; - Arrays.fill(CHARS, 3125, 3130, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 3130, 3134, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3134, 3141, (byte) -87 ); // Fill 7 of value (byte) -87 - CHARS[3141] = 33; - Arrays.fill(CHARS, 3142, 3145, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3145] = 33; - Arrays.fill(CHARS, 3146, 3150, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3150, 3157, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 3157, 3159, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3159, 3168, (byte) 33 ); // Fill 9 of value (byte) 33 - Arrays.fill(CHARS, 3168, 3170, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3170, 3174, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3174, 3184, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3184, 3202, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 3202, 3204, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[3204] = 33; - Arrays.fill(CHARS, 3205, 3213, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3213] = 33; - Arrays.fill(CHARS, 3214, 3217, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3217] = 33; - Arrays.fill(CHARS, 3218, 3241, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[3241] = 33; - Arrays.fill(CHARS, 3242, 3252, (byte) -19 ); // Fill 10 of value (byte) -19 - CHARS[3252] = 33; - Arrays.fill(CHARS, 3253, 3258, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 3258, 3262, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3262, 3269, (byte) -87 ); // Fill 7 of value (byte) -87 - CHARS[3269] = 33; - Arrays.fill(CHARS, 3270, 3273, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3273] = 33; - Arrays.fill(CHARS, 3274, 3278, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3278, 3285, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 3285, 3287, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3287, 3294, (byte) 33 ); // Fill 7 of value (byte) 33 - CHARS[3294] = -19; - CHARS[3295] = 33; - Arrays.fill(CHARS, 3296, 3298, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3298, 3302, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3302, 3312, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3312, 3330, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 3330, 3332, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[3332] = 33; - Arrays.fill(CHARS, 3333, 3341, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3341] = 33; - Arrays.fill(CHARS, 3342, 3345, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3345] = 33; - Arrays.fill(CHARS, 3346, 3369, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[3369] = 33; - Arrays.fill(CHARS, 3370, 3386, (byte) -19 ); // Fill 16 of value (byte) -19 - Arrays.fill(CHARS, 3386, 3390, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3390, 3396, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 3396, 3398, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3398, 3401, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3401] = 33; - Arrays.fill(CHARS, 3402, 3406, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3406, 3415, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[3415] = -87; - Arrays.fill(CHARS, 3416, 3424, (byte) 33 ); // Fill 8 of value (byte) 33 - Arrays.fill(CHARS, 3424, 3426, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3426, 3430, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3430, 3440, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3440, 3585, (byte) 33 ); // Fill 145 of value (byte) 33 - Arrays.fill(CHARS, 3585, 3631, (byte) -19 ); // Fill 46 of value (byte) -19 - CHARS[3631] = 33; - CHARS[3632] = -19; - CHARS[3633] = -87; - Arrays.fill(CHARS, 3634, 3636, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3636, 3643, (byte) -87 ); // Fill 7 of value (byte) -87 - Arrays.fill(CHARS, 3643, 3648, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 3648, 3654, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 3654, 3663, (byte) -87 ); // Fill 9 of value (byte) -87 - CHARS[3663] = 33; - Arrays.fill(CHARS, 3664, 3674, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3674, 3713, (byte) 33 ); // Fill 39 of value (byte) 33 - Arrays.fill(CHARS, 3713, 3715, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3715] = 33; - CHARS[3716] = -19; - Arrays.fill(CHARS, 3717, 3719, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3719, 3721, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3721] = 33; - CHARS[3722] = -19; - Arrays.fill(CHARS, 3723, 3725, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[3725] = -19; - Arrays.fill(CHARS, 3726, 3732, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 3732, 3736, (byte) -19 ); // Fill 4 of value (byte) -19 - CHARS[3736] = 33; - Arrays.fill(CHARS, 3737, 3744, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[3744] = 33; - Arrays.fill(CHARS, 3745, 3748, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3748] = 33; - CHARS[3749] = -19; - CHARS[3750] = 33; - CHARS[3751] = -19; - Arrays.fill(CHARS, 3752, 3754, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3754, 3756, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3756] = 33; - Arrays.fill(CHARS, 3757, 3759, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3759] = 33; - CHARS[3760] = -19; - CHARS[3761] = -87; - Arrays.fill(CHARS, 3762, 3764, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3764, 3770, (byte) -87 ); // Fill 6 of value (byte) -87 - CHARS[3770] = 33; - Arrays.fill(CHARS, 3771, 3773, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[3773] = -19; - Arrays.fill(CHARS, 3774, 3776, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3776, 3781, (byte) -19 ); // Fill 5 of value (byte) -19 - CHARS[3781] = 33; - CHARS[3782] = -87; - CHARS[3783] = 33; - Arrays.fill(CHARS, 3784, 3790, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 3790, 3792, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3792, 3802, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3802, 3864, (byte) 33 ); // Fill 62 of value (byte) 33 - Arrays.fill(CHARS, 3864, 3866, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3866, 3872, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 3872, 3882, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3882, 3893, (byte) 33 ); // Fill 11 of value (byte) 33 - CHARS[3893] = -87; - CHARS[3894] = 33; - CHARS[3895] = -87; - CHARS[3896] = 33; - CHARS[3897] = -87; - Arrays.fill(CHARS, 3898, 3902, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3902, 3904, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3904, 3912, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3912] = 33; - Arrays.fill(CHARS, 3913, 3946, (byte) -19 ); // Fill 33 of value (byte) -19 - Arrays.fill(CHARS, 3946, 3953, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 3953, 3973, (byte) -87 ); // Fill 20 of value (byte) -87 - CHARS[3973] = 33; - Arrays.fill(CHARS, 3974, 3980, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 3980, 3984, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3984, 3990, (byte) -87 ); // Fill 6 of value (byte) -87 - CHARS[3990] = 33; - CHARS[3991] = -87; - CHARS[3992] = 33; - Arrays.fill(CHARS, 3993, 4014, (byte) -87 ); // Fill 21 of value (byte) -87 - Arrays.fill(CHARS, 4014, 4017, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4017, 4024, (byte) -87 ); // Fill 7 of value (byte) -87 - CHARS[4024] = 33; - CHARS[4025] = -87; - Arrays.fill(CHARS, 4026, 4256, (byte) 33 ); // Fill 230 of value (byte) 33 - Arrays.fill(CHARS, 4256, 4294, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 4294, 4304, (byte) 33 ); // Fill 10 of value (byte) 33 - Arrays.fill(CHARS, 4304, 4343, (byte) -19 ); // Fill 39 of value (byte) -19 - Arrays.fill(CHARS, 4343, 4352, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[4352] = -19; - CHARS[4353] = 33; - Arrays.fill(CHARS, 4354, 4356, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4356] = 33; - Arrays.fill(CHARS, 4357, 4360, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[4360] = 33; - CHARS[4361] = -19; - CHARS[4362] = 33; - Arrays.fill(CHARS, 4363, 4365, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4365] = 33; - Arrays.fill(CHARS, 4366, 4371, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 4371, 4412, (byte) 33 ); // Fill 41 of value (byte) 33 - CHARS[4412] = -19; - CHARS[4413] = 33; - CHARS[4414] = -19; - CHARS[4415] = 33; - CHARS[4416] = -19; - Arrays.fill(CHARS, 4417, 4428, (byte) 33 ); // Fill 11 of value (byte) 33 - CHARS[4428] = -19; - CHARS[4429] = 33; - CHARS[4430] = -19; - CHARS[4431] = 33; - CHARS[4432] = -19; - Arrays.fill(CHARS, 4433, 4436, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4436, 4438, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 4438, 4441, (byte) 33 ); // Fill 3 of value (byte) 33 - CHARS[4441] = -19; - Arrays.fill(CHARS, 4442, 4447, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 4447, 4450, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[4450] = 33; - CHARS[4451] = -19; - CHARS[4452] = 33; - CHARS[4453] = -19; - CHARS[4454] = 33; - CHARS[4455] = -19; - CHARS[4456] = 33; - CHARS[4457] = -19; - Arrays.fill(CHARS, 4458, 4461, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4461, 4463, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 4463, 4466, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4466, 4468, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4468] = 33; - CHARS[4469] = -19; - Arrays.fill(CHARS, 4470, 4510, (byte) 33 ); // Fill 40 of value (byte) 33 - CHARS[4510] = -19; - Arrays.fill(CHARS, 4511, 4520, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[4520] = -19; - Arrays.fill(CHARS, 4521, 4523, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[4523] = -19; - Arrays.fill(CHARS, 4524, 4526, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 4526, 4528, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 4528, 4535, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 4535, 4537, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4537] = 33; - CHARS[4538] = -19; - CHARS[4539] = 33; - Arrays.fill(CHARS, 4540, 4547, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 4547, 4587, (byte) 33 ); // Fill 40 of value (byte) 33 - CHARS[4587] = -19; - Arrays.fill(CHARS, 4588, 4592, (byte) 33 ); // Fill 4 of value (byte) 33 - CHARS[4592] = -19; - Arrays.fill(CHARS, 4593, 4601, (byte) 33 ); // Fill 8 of value (byte) 33 - CHARS[4601] = -19; - Arrays.fill(CHARS, 4602, 7680, (byte) 33 ); // Fill 3078 of value (byte) 33 - Arrays.fill(CHARS, 7680, 7836, (byte) -19 ); // Fill 156 of value (byte) -19 - Arrays.fill(CHARS, 7836, 7840, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 7840, 7930, (byte) -19 ); // Fill 90 of value (byte) -19 - Arrays.fill(CHARS, 7930, 7936, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 7936, 7958, (byte) -19 ); // Fill 22 of value (byte) -19 - Arrays.fill(CHARS, 7958, 7960, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 7960, 7966, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 7966, 7968, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 7968, 8006, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 8006, 8008, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8008, 8014, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 8014, 8016, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8016, 8024, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[8024] = 33; - CHARS[8025] = -19; - CHARS[8026] = 33; - CHARS[8027] = -19; - CHARS[8028] = 33; - CHARS[8029] = -19; - CHARS[8030] = 33; - Arrays.fill(CHARS, 8031, 8062, (byte) -19 ); // Fill 31 of value (byte) -19 - Arrays.fill(CHARS, 8062, 8064, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8064, 8117, (byte) -19 ); // Fill 53 of value (byte) -19 - CHARS[8117] = 33; - Arrays.fill(CHARS, 8118, 8125, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[8125] = 33; - CHARS[8126] = -19; - Arrays.fill(CHARS, 8127, 8130, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 8130, 8133, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[8133] = 33; - Arrays.fill(CHARS, 8134, 8141, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 8141, 8144, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 8144, 8148, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 8148, 8150, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8150, 8156, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 8156, 8160, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 8160, 8173, (byte) -19 ); // Fill 13 of value (byte) -19 - Arrays.fill(CHARS, 8173, 8178, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 8178, 8181, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[8181] = 33; - Arrays.fill(CHARS, 8182, 8189, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 8189, 8400, (byte) 33 ); // Fill 211 of value (byte) 33 - Arrays.fill(CHARS, 8400, 8413, (byte) -87 ); // Fill 13 of value (byte) -87 - Arrays.fill(CHARS, 8413, 8417, (byte) 33 ); // Fill 4 of value (byte) 33 - CHARS[8417] = -87; - Arrays.fill(CHARS, 8418, 8486, (byte) 33 ); // Fill 68 of value (byte) 33 - CHARS[8486] = -19; - Arrays.fill(CHARS, 8487, 8490, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 8490, 8492, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 8492, 8494, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[8494] = -19; - Arrays.fill(CHARS, 8495, 8576, (byte) 33 ); // Fill 81 of value (byte) 33 - Arrays.fill(CHARS, 8576, 8579, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 8579, 12293, (byte) 33 ); // Fill 3714 of value (byte) 33 - CHARS[12293] = -87; - CHARS[12294] = 33; - CHARS[12295] = -19; - Arrays.fill(CHARS, 12296, 12321, (byte) 33 ); // Fill 25 of value (byte) 33 - Arrays.fill(CHARS, 12321, 12330, (byte) -19 ); // Fill 9 of value (byte) -19 - Arrays.fill(CHARS, 12330, 12336, (byte) -87 ); // Fill 6 of value (byte) -87 - CHARS[12336] = 33; - Arrays.fill(CHARS, 12337, 12342, (byte) -87 ); // Fill 5 of value (byte) -87 - Arrays.fill(CHARS, 12342, 12353, (byte) 33 ); // Fill 11 of value (byte) 33 - Arrays.fill(CHARS, 12353, 12437, (byte) -19 ); // Fill 84 of value (byte) -19 - Arrays.fill(CHARS, 12437, 12441, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 12441, 12443, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 12443, 12445, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 12445, 12447, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 12447, 12449, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 12449, 12539, (byte) -19 ); // Fill 90 of value (byte) -19 - CHARS[12539] = 33; - Arrays.fill(CHARS, 12540, 12543, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 12543, 12549, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 12549, 12589, (byte) -19 ); // Fill 40 of value (byte) -19 - Arrays.fill(CHARS, 12589, 19968, (byte) 33 ); // Fill 7379 of value (byte) 33 - Arrays.fill(CHARS, 19968, 40870, (byte) -19 ); // Fill 20902 of value (byte) -19 - Arrays.fill(CHARS, 40870, 44032, (byte) 33 ); // Fill 3162 of value (byte) 33 - Arrays.fill(CHARS, 44032, 55204, (byte) -19 ); // Fill 11172 of value (byte) -19 - Arrays.fill(CHARS, 55204, 55296, (byte) 33 ); // Fill 92 of value (byte) 33 - Arrays.fill(CHARS, 57344, 65534, (byte) 33 ); // Fill 8190 of value (byte) 33 - - } // () - - // - // Public static methods - // - - /** - * Returns true if the specified character is a supplemental character. - * - * @param c The character to check. - */ - public static boolean isSupplemental(int c) { - return (c >= 0x10000 && c <= 0x10FFFF); - } - - /** - * Returns true the supplemental character corresponding to the given - * surrogates. - * - * @param h The high surrogate. - * @param l The low surrogate. - */ - public static int supplemental(char h, char l) { - return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000; - } - - /** - * Returns the high surrogate of a supplemental character - * - * @param c The supplemental character to "split". - */ - public static char highSurrogate(int c) { - return (char) (((c - 0x00010000) >> 10) + 0xD800); - } - - /** - * Returns the low surrogate of a supplemental character - * - * @param c The supplemental character to "split". - */ - public static char lowSurrogate(int c) { - return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00); - } - - /** - * Returns whether the given character is a high surrogate - * - * @param c The character to check. - */ - public static boolean isHighSurrogate(int c) { - return (0xD800 <= c && c <= 0xDBFF); - } - - /** - * Returns whether the given character is a low surrogate - * - * @param c The character to check. - */ - public static boolean isLowSurrogate(int c) { - return (0xDC00 <= c && c <= 0xDFFF); - } - - - /** - * Returns true if the specified character is valid. This method - * also checks the surrogate character range from 0x10000 to 0x10FFFF. - *

- * If the program chooses to apply the mask directly to the - * CHARS array, then they are responsible for checking - * the surrogate character range. - * - * @param c The character to check. - */ - public static boolean isValid(int c) { - return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) || - (0x10000 <= c && c <= 0x10FFFF); - } // isValid(int):boolean - - /** - * Returns true if the specified character is invalid. - * - * @param c The character to check. - */ - public static boolean isInvalid(int c) { - return !isValid(c); - } // isInvalid(int):boolean - - /** - * Returns true if the specified character can be considered content. - * - * @param c The character to check. - */ - public static boolean isContent(int c) { - return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) || - (0x10000 <= c && c <= 0x10FFFF); - } // isContent(int):boolean - - /** - * Returns true if the specified character can be considered markup. - * Markup characters include '<', '&', and '%'. - * - * @param c The character to check. - */ - public static boolean isMarkup(int c) { - return c == '<' || c == '&' || c == '%'; - } // isMarkup(int):boolean - - /** - * Returns true if the specified character is a space character - * as defined by production [3] in the XML 1.0 specification. - * - * @param c The character to check. - */ - public static boolean isSpace(int c) { - return c <= 0x20 && (CHARS[c] & MASK_SPACE) != 0; - } // isSpace(int):boolean - - /** - * Returns true if the specified character is a valid name start - * character as defined by production [5] in the XML 1.0 - * specification. - * - * @param c The character to check. - */ - public static boolean isNameStart(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NAME_START) != 0; - } // isNameStart(int):boolean - - /** - * Returns true if the specified character is a valid name - * character as defined by production [4] in the XML 1.0 - * specification. - * - * @param c The character to check. - */ - public static boolean isName(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NAME) != 0; - } // isName(int):boolean - - /** - * Returns true if the specified character is a valid NCName start - * character as defined by production [4] in Namespaces in XML - * recommendation. - * - * @param c The character to check. - */ - public static boolean isNCNameStart(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NCNAME_START) != 0; - } // isNCNameStart(int):boolean - - /** - * Returns true if the specified character is a valid NCName - * character as defined by production [5] in Namespaces in XML - * recommendation. - * - * @param c The character to check. - */ - public static boolean isNCName(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NCNAME) != 0; - } // isNCName(int):boolean - - /** - * Returns true if the specified character is a valid Pubid - * character as defined by production [13] in the XML 1.0 - * specification. - * - * @param c The character to check. - */ - public static boolean isPubid(int c) { - return c < 0x10000 && (CHARS[c] & MASK_PUBID) != 0; - } // isPubid(int):boolean - - /* - * [5] Name ::= (Letter | '_' | ':') (NameChar)* - */ - /** - * Check to see if a string is a valid Name according to [5] - * in the XML 1.0 Recommendation - * - * @param name string to check - * @return true if name is a valid Name - */ - public static boolean isValidName(String name) { - if (name.length() == 0) - return false; - char ch = name.charAt(0); - if( isNameStart(ch) == false) - return false; - for (int i = 1; i < name.length(); i++ ) { - ch = name.charAt(i); - if( isName( ch ) == false ){ - return false; - } - } - return true; - } // isValidName(String):boolean - - - /* - * from the namespace rec - * [4] NCName ::= (Letter | '_') (NCNameChar)* - */ - /** - * Check to see if a string is a valid NCName according to [4] - * from the XML Namespaces 1.0 Recommendation - * - * @param ncName string to check - * @return true if name is a valid NCName - */ - public static boolean isValidNCName(String ncName) { - if (ncName.length() == 0) - return false; - char ch = ncName.charAt(0); - if( isNCNameStart(ch) == false) - return false; - for (int i = 1; i < ncName.length(); i++ ) { - ch = ncName.charAt(i); - if( isNCName( ch ) == false ){ - return false; - } - } - return true; - } // isValidNCName(String):boolean - - /* - * [7] Nmtoken ::= (NameChar)+ - */ - /** - * Check to see if a string is a valid Nmtoken according to [7] - * in the XML 1.0 Recommendation - * - * @param nmtoken string to check - * @return true if nmtoken is a valid Nmtoken - */ - public static boolean isValidNmtoken(String nmtoken) { - if (nmtoken.length() == 0) - return false; - for (int i = 0; i < nmtoken.length(); i++ ) { - char ch = nmtoken.charAt(i); - if( ! isName( ch ) ){ - return false; - } - } - return true; - } // isValidName(String):boolean - - - - - - // encodings - - /** - * Returns true if the encoding name is a valid IANA encoding. - * This method does not verify that there is a decoder available - * for this encoding, only that the characters are valid for an - * IANA encoding name. - * - * @param ianaEncoding The IANA encoding name. - */ - public static boolean isValidIANAEncoding(String ianaEncoding) { - if (ianaEncoding != null) { - int length = ianaEncoding.length(); - if (length > 0) { - char c = ianaEncoding.charAt(0); - if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { - for (int i = 1; i < length; i++) { - c = ianaEncoding.charAt(i); - if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && - (c < '0' || c > '9') && c != '.' && c != '_' && - c != '-') { - return false; - } - } - return true; - } - } - } - return false; - } // isValidIANAEncoding(String):boolean - - /** - * Returns true if the encoding name is a valid Java encoding. - * This method does not verify that there is a decoder available - * for this encoding, only that the characters are valid for an - * Java encoding name. - * - * @param javaEncoding The Java encoding name. - */ - public static boolean isValidJavaEncoding(String javaEncoding) { - if (javaEncoding != null) { - int length = javaEncoding.length(); - if (length > 0) { - for (int i = 1; i < length; i++) { - char c = javaEncoding.charAt(i); - if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && - (c < '0' || c > '9') && c != '.' && c != '_' && - c != '-') { - return false; - } - } - return true; - } - } - return false; - } // isValidIANAEncoding(String):boolean - - -} // class XMLChar diff --git a/jackrabbit-jcr2dav/pom.xml b/jackrabbit-jcr2dav/pom.xml index 4ba010d4997..15ca9a62f68 100644 --- a/jackrabbit-jcr2dav/pom.xml +++ b/jackrabbit-jcr2dav/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-jcr2dav @@ -45,7 +45,6 @@ maven-surefire-plugin ${test.opts} - true jackrabbit.test.integration @@ -208,6 +207,11 @@ derby test + + org.apache.derby + derbytools + test + diff --git a/jackrabbit-jcr2spi/pom.xml b/jackrabbit-jcr2spi/pom.xml index 689b94b16ef..d87b86cac90 100644 --- a/jackrabbit-jcr2spi/pom.xml +++ b/jackrabbit-jcr2spi/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-jcr2spi @@ -128,10 +128,6 @@ org.apache.commons commons-collections4 - - commons-io - commons-io - concurrent concurrent diff --git a/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java b/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java index 74ab25ca460..3b3717ac897 100644 --- a/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java +++ b/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java @@ -471,7 +471,7 @@ private void reorderAfter(LinkedEntries.LinkNode insertLN, LinkedEntries.LinkNod } } - //-------------------------------------------------< AbstractLinkedList >--- + //-------------------------------------------------< CopyOfAbstractLinkedList >--- //-------------------------------------------------------------------------- /** diff --git a/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/LinkedEntries.java b/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/LinkedEntries.java index 8d707fc96d9..1c4a5b957b2 100644 --- a/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/LinkedEntries.java +++ b/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/LinkedEntries.java @@ -22,7 +22,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; -import org.apache.commons.collections4.list.AbstractLinkedList; +import org.apache.commons.collections4.list.AbstractLinkedListJava21; import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.Path; @@ -31,7 +31,7 @@ * LinkNode which links the entries of the list. */ @SuppressWarnings("rawtypes") -class LinkedEntries extends AbstractLinkedList { +class LinkedEntries extends AbstractLinkedListJava21 { private Node header; private volatile int modCount; @@ -166,7 +166,7 @@ void reorderNode(LinkedEntries.LinkNode insert, LinkedEntries.LinkNode before) { * * @param value a child node entry. * @return a wrapping {@link LinkedEntries.LinkNode}. - * @see AbstractLinkedList#createNode(Object) + * @see AbstractLinkedListJava21#createNode(Object) */ @Override protected Node createNode(Object value) { @@ -175,7 +175,7 @@ protected Node createNode(Object value) { /** * @return a new LinkNode. - * @see AbstractLinkedList#createHeaderNode() + * @see AbstractLinkedListJava21#createHeaderNode() */ @Override protected Node createHeaderNode() { @@ -192,7 +192,7 @@ protected Iterator linkNodeIterator() { //---------------------------------------------------------------------- /** - * Extends the AbstractLinkedList.Node. + * Extends the CopyOfAbstractLinkedList.Node. */ protected final class LinkNode extends Node { diff --git a/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java b/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java index 210c11ee103..5c551656ebe 100644 --- a/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java +++ b/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java @@ -106,6 +106,7 @@ public void checkAddNodeConstraints(Name name, QNodeTypeDefinition nodeTypeDefin * @deprecated Use {@link #hasRemoveNodeConstraint(Name)} and * {@link #hasRemovePropertyConstraint(Name)} respectively. */ + @Deprecated public void checkRemoveItemConstraints(Name name) throws ConstraintViolationException; /** diff --git a/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java b/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java index a01d8209baa..11651c78470 100644 --- a/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java +++ b/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java @@ -16,19 +16,18 @@ */ package org.apache.jackrabbit.jcr2spi; -import java.util.Random; - import static org.junit.Assert.assertArrayEquals; import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.Random; +import javax.jcr.Binary; import javax.jcr.Node; -import javax.jcr.Session; import javax.jcr.Property; -import javax.jcr.Binary; +import javax.jcr.Session; import javax.jcr.ValueFormatException; -import org.apache.commons.io.IOUtils; import org.apache.jackrabbit.jcr2spi.state.PropertyState; import org.apache.jackrabbit.spi.QValue; import org.apache.jackrabbit.test.AbstractJCRTest; @@ -186,7 +185,9 @@ public void testStreamIntegrity() throws Exception { // check the binaries are indeed the same (JCR-4154) byte[] result = new byte[bytes.length]; - IOUtils.readFully(p.getBinary().getStream(), result); + try (InputStream in = p.getBinary().getStream()) { + result = in.readAllBytes(); + } assertArrayEquals(bytes, result); } finally { s.logout(); diff --git a/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/CopyMoveToJsonTest.java b/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/CopyMoveToJsonTest.java index 9b7e6c26b4d..2ac41fee50c 100755 --- a/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/CopyMoveToJsonTest.java +++ b/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/CopyMoveToJsonTest.java @@ -17,14 +17,15 @@ package org.apache.jackrabbit.jcr2spi; import java.io.ByteArrayInputStream; +import java.io.InputStream; import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import javax.jcr.Node; import javax.jcr.Property; import javax.jcr.RepositoryException; import javax.jcr.Session; -import org.apache.commons.io.IOUtils; import org.apache.jackrabbit.JcrConstants; import org.apache.jackrabbit.test.AbstractJCRTest; @@ -39,7 +40,9 @@ public void testCreateJson() throws Exception { try { Property p = s.getNode(testRoot).getNode("test.json").getNode(JcrConstants.JCR_CONTENT) .getProperty(JcrConstants.JCR_DATA); - assertEquals(jsondata, IOUtils.toString(p.getBinary().getStream(), "UTF-8")); + try (InputStream in = p.getBinary().getStream()) { + assertEquals(jsondata, new String(in.readAllBytes(), StandardCharsets.UTF_8)); + } } finally { s.logout(); } @@ -53,7 +56,9 @@ public void testCopyJson() throws Exception { try { Property p = s.getNode(testRoot).getNode("target.json").getNode(JcrConstants.JCR_CONTENT) .getProperty(JcrConstants.JCR_DATA); - assertEquals(jsondata, IOUtils.toString(p.getBinary().getStream(), "UTF-8")); + try (InputStream in = p.getBinary().getStream()) { + assertEquals(jsondata, new String(in.readAllBytes(), StandardCharsets.UTF_8)); + } } finally { s.logout(); } @@ -67,7 +72,9 @@ public void testMoveJson() throws Exception { try { Property p = s.getNode(testRoot).getNode("target.json").getNode(JcrConstants.JCR_CONTENT) .getProperty(JcrConstants.JCR_DATA); - assertEquals(jsondata, IOUtils.toString(p.getBinary().getStream(), "UTF-8")); + try (InputStream in = p.getBinary().getStream()) { + assertEquals(jsondata, new String(in.readAllBytes(), StandardCharsets.UTF_8)); + } } finally { s.logout(); } diff --git a/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/hierarchy/LinkedEntriesTest.java b/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/hierarchy/LinkedEntriesTest.java index 972e63aa2fb..9ab5e3ae7dd 100644 --- a/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/hierarchy/LinkedEntriesTest.java +++ b/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/hierarchy/LinkedEntriesTest.java @@ -1,38 +1,38 @@ -/* - * 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. - */ -package org.apache.jackrabbit.jcr2spi.hierarchy; - -import static org.mockito.Mockito.mock; - -import java.util.ConcurrentModificationException; -import java.util.Iterator; - -import junit.framework.TestCase; - -public class LinkedEntriesTest extends TestCase { - - public void testLinkedEntries() { - LinkedEntries linkedEntries = new LinkedEntries(null, null); - Iterator it = linkedEntries.linkNodeIterator(); - linkedEntries.add(mock(NodeEntry.class), 0); - try { - it.next(); - fail("ConcurrentModificationException expected"); - } catch (ConcurrentModificationException expected) { - } - } -} +/* + * 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. + */ +package org.apache.jackrabbit.jcr2spi.hierarchy; + +import static org.mockito.Mockito.mock; + +import java.util.ConcurrentModificationException; +import java.util.Iterator; + +import junit.framework.TestCase; + +public class LinkedEntriesTest extends TestCase { + + public void testLinkedEntries() { + LinkedEntries linkedEntries = new LinkedEntries(null, null); + Iterator it = linkedEntries.linkNodeIterator(); + linkedEntries.add(mock(NodeEntry.class), 0); + try { + it.next(); + fail("ConcurrentModificationException expected"); + } catch (ConcurrentModificationException expected) { + } + } +} diff --git a/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/security/authorization/jackrabbit/acl/AccessControlListImplTest.java b/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/security/authorization/jackrabbit/acl/AccessControlListImplTest.java index 9c6a9789d71..f0fe19ed5ee 100644 --- a/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/security/authorization/jackrabbit/acl/AccessControlListImplTest.java +++ b/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/security/authorization/jackrabbit/acl/AccessControlListImplTest.java @@ -28,7 +28,6 @@ import javax.jcr.security.AccessControlList; import javax.jcr.security.Privilege; -import junit.framework.Assert; import org.apache.jackrabbit.api.security.JackrabbitAccessControlList; import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.QValueFactory; @@ -36,6 +35,7 @@ import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver; import org.apache.jackrabbit.spi.commons.value.QValueFactoryImpl; import org.apache.jackrabbit.test.api.security.AbstractAccessControlTest; +import org.junit.Assert; /** * Tests the functionality of the JCR AccessControlList API implementation. The @@ -97,15 +97,14 @@ public void testAddingDifferentEntries() throws Exception { // four different entries Assert.assertEquals(4, acl.size()); - + // UnknownPrincipal entries AccessControlEntry[] pentries = getEntries(acl, unknownPrincipal); Assert.assertEquals(2, pentries.length); - + // secondPrincipal entries AccessControlEntry[] sentries = getEntries(acl, knownPrincipal); Assert.assertEquals(2, sentries.length); - } public void testMultipleEntryEffect() throws Exception { diff --git a/jackrabbit-parent/pom.xml b/jackrabbit-parent/pom.xml index 2233ab9ee95..30cf73765d6 100644 --- a/jackrabbit-parent/pom.xml +++ b/jackrabbit-parent/pom.xml @@ -17,7 +17,7 @@ limitations under the License. --> - + 4.0.0 @@ -27,14 +27,14 @@ org.apache apache - 29 + 33 org.apache.jackrabbit jackrabbit-parent Jackrabbit Parent POM - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT pom @@ -42,28 +42,42 @@ http://issues.apache.org/jira/browse/JCR + + + scm:git:https://gitbox.apache.org/repos/asf/jackrabbit.git + scm:git:https://gitbox.apache.org/repos/asf/jackrabbit.git + https://github.com/apache/jackrabbit/tree/${project.scm.tag} + jackrabbit-2.23.1-beta + + -Xmx256m ${test.opts.modules} ${test.opts.coverage} ${test.opts.memory} -enableassertions - 1.48.0 + 1.76.0 - 1.22.14 - 9.2.30.v20200428 - 2.7.0 + 1.22.22 + 9.4.56.v20240826 + 2.4.1 ${project.build.sourceEncoding} 1.7.36 1.7.36 - 1.2.11 - 1.8 - java18 + 1.2.13 + + + 11 + ${javaTargetVersion} + ${javaTargetVersion} + ${javaTargetVersion} + true 0.0 0.0 - 10 + 1728379281 + 3.6.1 http://jackrabbit.apache.org/ @@ -80,10 +94,6 @@ - - 3.2.1 - - javadoc @@ -195,29 +205,10 @@ maven-compiler-plugin - ${java.version} - ${java.version} - - - - org.codehaus.mojo - animal-sniffer-maven-plugin - 1.22 - - - org.codehaus.mojo.signature - ${java.version.signature} - 1.0 - + + -Xpkginfo:always + - - - compile - - check - - - @@ -226,7 +217,7 @@ ${java.version} true - https://docs.adobe.com/docs/en/spec/javax.jcr/javadocs/jcr-2.0/ + https://s.apache.org/jcr-2.0-javadoc/ https://jackrabbit.apache.org/oak/docs/apidocs https://hc.apache.org/httpcomponents-client-4.5.x/current/httpclient/apidocs/ https://hc.apache.org/httpcomponents-client-4.5.x/current/httpmime/apidocs/ @@ -269,7 +260,7 @@ org.jacoco jacoco-maven-plugin - 0.8.8 + 0.8.13 pre-unit-test @@ -324,41 +315,31 @@ - - - org.apache.maven.plugins maven-release-plugin - 2.5.3 false deploy -Papache-release,pedantic ${arguments} - - maven-javadoc-plugin - 3.4.1 - maven-surefire-plugin - 2.22.2 ${test.opts} maven-failsafe-plugin - 2.22.2 ${test.opts} maven-jar-plugin - 3.3.0 + 3.4.2 maven-rar-plugin @@ -366,11 +347,7 @@ maven-war-plugin - 3.3.2 - - - maven-assembly-plugin - 3.4.2 + 3.4.0 maven-idea-plugin @@ -383,7 +360,7 @@ org.apache.felix maven-bundle-plugin - 5.1.8 + 5.1.9 true @@ -402,7 +379,7 @@ - 2.20.9 + 2.22.0 @@ -410,7 +387,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.3.0 + 3.6.0 org.codehaus.mojo @@ -431,20 +408,15 @@ org.apache.maven.plugins maven-javadoc-plugin - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.22.2 - org.apache.maven.plugins maven-checkstyle-plugin - 3.2.1 + 3.5.0 org.apache.maven.plugins maven-pmd-plugin - 3.20.0 + 3.25.0 ${java.version} @@ -452,7 +424,7 @@ com.github.spotbugs spotbugs-maven-plugin - 4.7.3.0 + 4.8.6.4 @@ -475,20 +447,15 @@ concurrent 1.3.4 - - commons-beanutils - commons-beanutils - 1.9.4 - org.apache.commons commons-collections4 - 4.4 + 4.5.0-M3 commons-io commons-io - 2.11.0 + 2.17.0 javax.transaction @@ -518,7 +485,7 @@ org.apache.lucene lucene-core - 3.6.0 + 3.6.2 org.apache.tika @@ -589,7 +556,12 @@ org.apache.derby derby - 10.14.2.0 + 10.15.2.0 + + + org.apache.derby + derbytools + 10.15.2.0 org.apache.geronimo.specs @@ -624,7 +596,7 @@ org.eclipse.jetty - jetty-jsp + apache-jsp ${jetty.version} @@ -640,7 +612,7 @@ org.easymock easymock - 5.1.0 + 5.5.0 junit @@ -650,7 +622,7 @@ org.mockito mockito-core - 4.11.0 + 5.17.0 diff --git a/jackrabbit-spi-commons/pom.xml b/jackrabbit-spi-commons/pom.xml index bb8d0e3b85c..f16b4e33442 100644 --- a/jackrabbit-spi-commons/pom.xml +++ b/jackrabbit-spi-commons/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-spi-commons @@ -115,7 +115,7 @@ org.codehaus.mojo javacc-maven-plugin - 3.0.1 + 3.1.0 sql diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java index 2baa3c8baa7..8edd58bf38a 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java @@ -81,6 +81,7 @@ public class EventImpl implements Event, Serializable { * Creates a new serializable event. * @deprecated */ + @Deprecated public EventImpl(int type, Path path, ItemId itemId, NodeId parentId, Name primaryNodeTypeName, Name[] mixinTypeNames, String userId) { diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoImpl.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoImpl.java index 0c8b0edef58..4ba735b1305 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoImpl.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoImpl.java @@ -50,6 +50,7 @@ public abstract class ItemInfoImpl implements ItemInfo, Serializable { * parentId is not used any more and the corresponding getter has been * removed. */ + @Deprecated public ItemInfoImpl(NodeId parentId, Name name, Path path, boolean isNode) { this(path, isNode); } diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/LockInfoImpl.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/LockInfoImpl.java index 04906cad5d9..c9f5c161f91 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/LockInfoImpl.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/LockInfoImpl.java @@ -72,6 +72,7 @@ public class LockInfoImpl implements LockInfo, Serializable { * @param nodeId the node id of the locked node. * @deprecated Use {@link #LockInfoImpl(String, String, boolean, boolean, long, boolean, NodeId)} instaed. */ + @Deprecated public LockInfoImpl(String lockToken, String lockOwner, boolean isDeep, boolean isSessionScoped, NodeId nodeId) { this(lockToken, lockOwner, isDeep, isSessionScoped, Long.MAX_VALUE, lockToken != null, nodeId); diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/NodeInfoImpl.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/NodeInfoImpl.java index c4c0f8319c8..1d4ab8c3242 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/NodeInfoImpl.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/NodeInfoImpl.java @@ -149,6 +149,7 @@ public void remove() { * @deprecated Use {@link #NodeInfoImpl(Path, NodeId, int, Name, Name[], Iterator, Iterator, Iterator)} * instead. The parentId is not used any more. */ + @Deprecated public NodeInfoImpl(NodeId parentId, Name name, Path path, NodeId id, int index, Name primaryTypeName, Name[] mixinNames, Iterator references, Iterator propertyIds, diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/PropertyInfoImpl.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/PropertyInfoImpl.java index 8abf38b66ec..fd78d4b3b69 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/PropertyInfoImpl.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/PropertyInfoImpl.java @@ -87,6 +87,7 @@ public static PropertyInfo createSerializablePropertyInfo( * @deprecated Use {@link #PropertyInfoImpl(Path, PropertyId, int, boolean, QValue[])} * instead. The parentId is not used any more. */ + @Deprecated public PropertyInfoImpl(NodeId parentId, Name name, Path path, PropertyId id, int type, boolean isMultiValued, QValue[] values) { diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/IllegalNameException.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/IllegalNameException.java index 366b45e0695..e26ae80f1fd 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/IllegalNameException.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/IllegalNameException.java @@ -23,7 +23,7 @@ * {@link javax.jcr.NamespaceException} is thrown if the prefix of the JCR name * string is syntactically valid but not bound to any namespace. *

- * See the section 4.6 of the JCR 1.0 specification for details of the + * See the section 3.4 of the JCR 2.0 specification for details of the * JCR name syntax. */ public class IllegalNameException extends NameException { diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java index f4b10ce9a8e..aa7c0f87756 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java @@ -52,13 +52,18 @@ public class NameParser { */ public static Name parse(String jcrName, NamespaceResolver resolver, NameFactory factory) throws IllegalNameException, NamespaceException { - // trivial check - int len = jcrName == null ? 0 : jcrName.length(); + + if (jcrName == null) { + complainAndThrow("name is null", ""); + } + + int len = jcrName.length(); if (len == 0) { - throw new IllegalNameException("empty name"); + complainAndThrow("empty name", jcrName); } + if (".".equals(jcrName) || "..".equals(jcrName)) { - throw new IllegalNameException(jcrName); + complainAndThrow("illegal name", jcrName); } // parse the name @@ -73,36 +78,36 @@ public static Name parse(String jcrName, NamespaceResolver resolver, NameFactory char c = jcrName.charAt(i); if (c == ':') { if (state == STATE_PREFIX_START) { - throw new IllegalNameException("Prefix must not be empty"); + complainAndThrow("Prefix must not be empty", jcrName, i); } else if (state == STATE_PREFIX) { if (trailingSpaces) { - throw new IllegalNameException("Trailing spaces not allowed"); + complainAndThrow("Trailing spaces not allowed", jcrName, i); } prefix = jcrName.substring(0, i); if (!XMLChar.isValidNCName(prefix)) { - throw new IllegalNameException("Invalid name prefix: " + prefix); + complainAndThrow("Invalid name prefix: " + prefix, jcrName, i); } state = STATE_NAME_START; } else if (state == STATE_URI) { // ignore -> validation of uri later on. } else { - throw new IllegalNameException(asDisplayableString(c) + " not allowed in name"); + complainAndThrow("'" + asDisplayableString(c) + "' not allowed in name", jcrName, i); } trailingSpaces = false; } else if (c == ' ') { if (state == STATE_PREFIX_START || state == STATE_NAME_START) { - throw new IllegalNameException(asDisplayableString(c) + " not valid name start"); + complainAndThrow("'" + asDisplayableString(c) + "' not valid name start", jcrName, i); } trailingSpaces = true; } else if (c == '[' || c == ']' || c == '*' || c == '|') { - throw new IllegalNameException(asDisplayableString(c) + " not allowed in name"); - } else if (Character.isWhitespace(c)) { - throw new IllegalNameException("Whitespace character " + asDisplayableString(c) + " not allowed in name"); + complainAndThrow("'" + asDisplayableString(c) + "' not allowed in name", jcrName, i); + } else if (Character.isWhitespace(c) && c < 128) { + complainAndThrow("Whitespace character '" + asDisplayableString(c) + "' not allowed in name", jcrName, i); } else if (c == '/') { if (state == STATE_URI_START) { state = STATE_URI; } else if (state != STATE_URI) { - throw new IllegalNameException(asDisplayableString(c) + " not allowed in name"); + complainAndThrow("'" + asDisplayableString(c) + "' not allowed in name", jcrName, i); } trailingSpaces = false; } else if (c == '{') { @@ -140,10 +145,7 @@ public static Name parse(String jcrName, NamespaceResolver resolver, NameFactory state = STATE_NAME; nameStart = 0; } else { - throw new IllegalNameException( - "The URI prefix of the name " + jcrName - + " is neither a valid URI nor a valid part" - + " of a local name."); + complainAndThrow("The URI prefix is neither a valid URI nor a valid part of a local name", jcrName); } } else if (state == STATE_PREFIX_START) { state = STATE_PREFIX; // prefix start -> validation later on will fail. @@ -168,14 +170,14 @@ public static Name parse(String jcrName, NamespaceResolver resolver, NameFactory // take care of qualified jcrNames starting with '{' that are not having // a terminating '}' -> make sure there are no illegal characters present. if (state == STATE_URI && (jcrName.indexOf(':') > -1 || jcrName.indexOf('/') > -1)) { - throw new IllegalNameException("Local name may not contain ':' nor '/'"); + complainAndThrow("Local name may not contain ':' nor '/'", jcrName); } if (nameStart == len || state == STATE_NAME_START) { - throw new IllegalNameException("Local name must not be empty"); + complainAndThrow("Local name must not be empty", jcrName); } if (trailingSpaces) { - throw new IllegalNameException("Trailing spaces not allowed"); + complainAndThrow("Trailing spaces not allowed", jcrName); } // if namespace is null, this is just a check for format. this can only @@ -194,11 +196,47 @@ public static Name parse(String jcrName, NamespaceResolver resolver, NameFactory } private static String asDisplayableString(char c) { - if (Character.isWhitespace(c)) { - return String.format("'\\u%04x'", (int)c); + if (c >= ' ' && c < 127) { + return Character.toString(c); + } else if (c == '\b') { + return "\\b"; + } else if (c == '\f') { + return "\\f"; + } else if (c == '\n') { + return "\\n"; + } else if (c == '\r') { + return "\\r"; + } else if (c == '\t') { + return "\\t"; + } else if (c == '\'') { + return "\\'"; + } else if (c == '"') { + return "\\\""; + } else { + return String.format("\\u%04x", (int) c); + } + } + + private static String formatNameForDisplay(String name) { + StringBuilder b = new StringBuilder(); + for (int i = 0; i < name.length(); i++) { + b.append(asDisplayableString(name.charAt(i))); + } + return b.toString(); + } + + private static void complainAndThrow(String reason, String name) throws IllegalNameException { + complainAndThrow(reason, name, -1); + } + + private static void complainAndThrow(String reason, String name, int index) throws IllegalNameException{ + String msg; + if (index == -1) { + msg = String.format("%s (name: \"%s\")", reason, formatNameForDisplay(name)); } else { - return "'" + c + "'"; + msg = String.format("%s (name: \"%s\", at position: %d)", reason, formatNameForDisplay(name), index); } + throw new IllegalNameException(msg); } /** diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/package-info.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/package-info.java index 1f1034ce774..b1220f25bb2 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/package-info.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/package-info.java @@ -14,5 +14,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@org.osgi.annotation.versioning.Version("2.4.0") +@org.osgi.annotation.versioning.Version("2.5.0") package org.apache.jackrabbit.spi.commons.conversion; diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Iterators.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Iterators.java index 88301d098ff..4acdf65fad9 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Iterators.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Iterators.java @@ -121,6 +121,7 @@ public static Iterator arrayIterator(T[] values, int from, int to) { * @return * @deprecated use {@link #filterIterator(Iterator, java.util.function.Predicate)} instead */ + @Deprecated public static Iterator filterIterator(Iterator iterator, final Predicate predicate) { diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Predicate.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Predicate.java index b94bcbd3bfc..18c788bd236 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Predicate.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Predicate.java @@ -22,6 +22,7 @@ * @param type of values this predicate is defined on * @deprecated use {@link java.util.function.Predicate} instead */ +@Deprecated public interface Predicate { /** diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Predicates.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Predicates.java index be81d1110b7..b6880a282dc 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Predicates.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/iterator/Predicates.java @@ -21,6 +21,7 @@ * Utility class containing pre defined {@link Predicate}s * @deprecated use instances of {@link java.util.function.Predicate} instead */ +@Deprecated public final class Predicates { /** diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/lock/Locked.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/lock/Locked.java index b9447957c5c..29e0ae1246c 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/lock/Locked.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/lock/Locked.java @@ -78,6 +78,7 @@ * * @deprecated Use org.apache.jackrabbit.util.Locked instead. */ +@Deprecated public abstract class Locked { /** diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/AbstractNamespaceResolver.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/AbstractNamespaceResolver.java index bdcb95227c4..6b74d015770 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/AbstractNamespaceResolver.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/AbstractNamespaceResolver.java @@ -35,6 +35,7 @@ * * @deprecated https://issues.apache.org/jira/browse/JCR-1700 */ +@Deprecated public abstract class AbstractNamespaceResolver implements NamespaceResolver { private final Set listeners; diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/NamespaceListener.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/NamespaceListener.java index a3ee219e596..e3203996bc1 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/NamespaceListener.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/NamespaceListener.java @@ -21,6 +21,7 @@ * * @deprecated https://issues.apache.org/jira/browse/JCR-1700 */ +@Deprecated public interface NamespaceListener { /** diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java index f5a1d244073..542d1933b49 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java @@ -135,6 +135,7 @@ public boolean isValid() { * ordered ascending; descending if false. * @deprecated use {@link #addOrderSpec(Path , boolean)} instead. */ + @Deprecated public void addOrderSpec(Name property, boolean ascending) { addOrderSpec(createPath(property), ascending); } @@ -232,6 +233,7 @@ public static final class OrderSpec { * ascending, otherwise descending. * @deprecated use {@link OrderSpec#OrderSpec(Path, boolean)} instead. */ + @Deprecated public OrderSpec(Name property, boolean ascending) { this(createPath(property), ascending); } @@ -254,6 +256,7 @@ public OrderSpec(Path property, boolean ascending) { * @return the name of the property. * @deprecated use {@link #getPropertyPath()} instead. */ + @Deprecated public Name getProperty() { return property.getName(); } diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java index 15d1686e64f..3c2fe14ce82 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java @@ -98,6 +98,7 @@ public String getQuery() { * @return property name or null. * @deprecated Use {@link #getRelativePath()} instead. */ + @Deprecated public Name getPropertyName() { return relPath == null ? null : relPath.getName(); } @@ -108,6 +109,7 @@ public Name getPropertyName() { * @param property the name of the property. * @deprecated Use {@link #setRelativePath(Path)} instead. */ + @Deprecated public void setPropertyName(Name property) { PathBuilder builder = new PathBuilder(); builder.addLast(property); diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/SimpleCharStream.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/SimpleCharStream.java index 2e085993bd7..9df5d742496 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/SimpleCharStream.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/SimpleCharStream.java @@ -218,7 +218,7 @@ public char readChar() throws java.io.IOException * @deprecated * @see #getEndColumn */ - + @Deprecated public int getColumn() { return bufcolumn[bufpos]; } @@ -227,7 +227,7 @@ public int getColumn() { * @deprecated * @see #getEndLine */ - + @Deprecated public int getLine() { return bufline[bufpos]; } diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql2/Parser.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql2/Parser.java index d8603db6197..22500e701f8 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql2/Parser.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql2/Parser.java @@ -25,6 +25,7 @@ * @deprecated use {@link org.apache.jackrabbit.commons.query.sql2.Parser} * instead. */ +@Deprecated public class Parser extends org.apache.jackrabbit.commons.query.sql2.Parser { diff --git a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/xpath/SimpleCharStream.java b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/xpath/SimpleCharStream.java index 1547afa8cb8..1d7f294d0e0 100644 --- a/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/xpath/SimpleCharStream.java +++ b/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/xpath/SimpleCharStream.java @@ -202,7 +202,7 @@ public char readChar() throws java.io.IOException * @deprecated * @see #getEndColumn */ - + @Deprecated public int getColumn() { return bufcolumn[bufpos]; } @@ -211,7 +211,7 @@ public int getColumn() { * @deprecated * @see #getEndLine */ - + @Deprecated public int getLine() { return bufline[bufpos]; } diff --git a/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/NameParserTest.java b/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/NameParserTest.java index 6fe3b9ff03f..d2cfee6e5db 100644 --- a/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/NameParserTest.java +++ b/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/NameParserTest.java @@ -110,6 +110,9 @@ public void testExpandedJcrNames() throws NamespaceException, IllegalNameExcepti valid.add(new String[] {"abc { }", "", "abc { }"}); valid.add(new String[] {"{ ab }", "", "{ ab }"}); valid.add(new String[] {"{ }abc", "", "{ }abc"}); + // see JCR-4917 + valid.add(new String[] {"a\u200ab", "", "a\u200ab"}); + valid.add(new String[] {"\u200ab\u200a", "", "\u200ab\u200a"}); // unknown uri -> but valid non-prefixed jcr-name valid.add(new String[] {"{test}abc", "", "{test}abc"}); valid.add(new String[] {"{ab}", "", "{ab}"}); @@ -238,12 +241,24 @@ public void testCheckFormatOfExpandedNames() throws NamespaceException, IllegalN } } - public void testMessage() { + public void testMessageTab() { try { NameParser.checkFormat("horizontal\ttab"); fail("should fail with IllegalNameException"); } catch (IllegalNameException ex) { - assertTrue("message should contain '\\u0009'", ex.getMessage().indexOf("'\\u0009'") >= 0); + assertTrue("message should contain '\\t', was: >>>" + ex.getMessage() + "<<<", ex.getMessage().indexOf("\\t") >= 0); + assertTrue("message should contain 'horizontal', was: >>>" + ex.getMessage() + "<<<", + ex.getMessage().indexOf("horizontal") >= 0); + } + } + + public void testMessageWithNonAscii() { + try { + NameParser.checkFormat("\uD83D\uDCA9[]"); + fail("should fail with IllegalNameException"); + } catch (IllegalNameException ex) { + assertTrue("message should contain '\\ud83d\\udca9', was: >>>" + ex.getMessage() + "<<<", + ex.getMessage().indexOf("\\ud83d\\udca9") >= 0); } } diff --git a/jackrabbit-spi/pom.xml b/jackrabbit-spi/pom.xml index 725d6bc3b85..7c7d7b86da6 100644 --- a/jackrabbit-spi/pom.xml +++ b/jackrabbit-spi/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-spi diff --git a/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java b/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java index da56567d520..13c454b3c32 100644 --- a/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java +++ b/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/NodeInfo.java @@ -71,6 +71,7 @@ public interface NodeInfo extends ItemInfo { * @see PropertyInfo#getId() * @deprecated Use {@link RepositoryService#getReferences(SessionInfo, NodeId, Name, boolean)} instead. */ + @Deprecated public PropertyId[] getReferences(); /** diff --git a/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java b/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java index a01385bec7b..09e6841766e 100644 --- a/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java +++ b/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java @@ -302,6 +302,7 @@ public SessionInfo obtain(SessionInfo sessionInfo, String workspaceName) * @see javax.jcr.version.Version#getContainingHistory() * @deprecated Use {@link #getItemInfos(SessionInfo, ItemId)} */ + @Deprecated public NodeInfo getNodeInfo(SessionInfo sessionInfo, NodeId nodeId) throws ItemNotFoundException, RepositoryException; /** @@ -382,6 +383,7 @@ public SessionInfo obtain(SessionInfo sessionInfo, String workspaceName) * @see javax.jcr.Node#getProperty(String) * @deprecated Use {@link #getItemInfos(SessionInfo, ItemId)} */ + @Deprecated public PropertyInfo getPropertyInfo(SessionInfo sessionInfo, PropertyId propertyId) throws ItemNotFoundException, RepositoryException; //-----------------------------------------------< general modification >--- diff --git a/jackrabbit-spi2dav/pom.xml b/jackrabbit-spi2dav/pom.xml index e9505891a9d..4f5935aeaf9 100644 --- a/jackrabbit-spi2dav/pom.xml +++ b/jackrabbit-spi2dav/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-spi2dav @@ -45,7 +45,6 @@ false - once ${test.opts} @@ -253,6 +252,11 @@ derby test + + org.apache.derby + derbytools + test + org.littleshoot diff --git a/jackrabbit-spi2jcr/pom.xml b/jackrabbit-spi2jcr/pom.xml index 9f3f6fcec94..eaa313deb1d 100644 --- a/jackrabbit-spi2jcr/pom.xml +++ b/jackrabbit-spi2jcr/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-spi2jcr @@ -40,7 +40,6 @@ **/TestAll.java - once ${test.opts} @@ -182,5 +181,10 @@ org.apache.jackrabbit.test.api.query.qom.EquiJoinConditionTest#testLeftOuterJoin derby test + + org.apache.derby + derbytools + test + diff --git a/jackrabbit-standalone-components/pom.xml b/jackrabbit-standalone-components/pom.xml index e334155d169..4391f69058e 100644 --- a/jackrabbit-standalone-components/pom.xml +++ b/jackrabbit-standalone-components/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-standalone-components @@ -103,11 +103,6 @@ jackrabbit-jcr2dav ${project.version} - - org.apache.jackrabbit - jackrabbit-jcr-rmi - ${project.version} - org.apache.jackrabbit jackrabbit-webapp @@ -130,20 +125,7 @@ org.eclipse.jetty - jetty-jsp - - - - org.glassfish - javax.el - - - - - - org.glassfish - javax.el - 3.0.0 + apache-jsp org.eclipse.jetty @@ -152,7 +134,7 @@ commons-cli commons-cli - 1.5.0 + 1.9.0 commons-chain @@ -168,11 +150,6 @@ org.apache.commons commons-collections4 - 4.4 - - - commons-beanutils - commons-beanutils commons-digester diff --git a/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/Main.java b/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/Main.java index 9f001e43abc..09aa5902fb0 100644 --- a/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/Main.java +++ b/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/Main.java @@ -45,6 +45,7 @@ import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.RequestLogHandler; import org.eclipse.jetty.servlet.ServletHolder; +import org.eclipse.jetty.webapp.Configuration; import org.eclipse.jetty.webapp.WebAppContext; /** @@ -56,28 +57,47 @@ public class Main { * @param args */ public static void main(String[] args) throws Exception { - new Main(args).run(); - } + Options options = new Options(); + CommandLine command = createCommand(args, options); - private final Options options = new Options(); + File jarFile = findJarFileLocation(command); - private final CommandLine command; + if (command.hasOption("help")) { + HelpFormatter formatter = new HelpFormatter(); + formatter.printHelp("java -jar " + jarFile.getName(), options, true); + } else if (command.hasOption("notice")) { + copyToOutput("/META-INF/NOTICE.txt"); + } else if (command.hasOption("license")) { + copyToOutput("/META-INF/LICENSE.txt"); + } else if (command.hasOption("cli")) { + System.setProperty("logback.configurationFile", "logback-cli.xml"); - private final RequestLogHandler accessLog = new RequestLogHandler(); + String uri = command.getOptionValue("cli"); + Repository repository = JcrUtils.getRepository(uri); - private final WebAppContext webapp = new WebAppContext(); + Context context = new ContextBase(); + CommandHelper.setRepository(context, repository, uri); + try { + Session session = repository.login(); + CommandHelper.setSession(context, session); + CommandHelper.setCurrentNode(context, session.getRootNode()); + } catch (RepositoryException ignore) { + // anonymous login not possible + } - private final Server server = new Server(); + new JcrClient(context).runInteractive(); - private final ServerConnector connector = new ServerConnector(server); + try { + CommandHelper.getSession(context).logout(); + } catch (CommandException ignore) { + // already logged out + } + } else { + new Main(command).run(jarFile); + } + } - /** - * Construct Main application instance. - *

- * Note: Constructor is protected because other projects such as Commons VFS can extend this for some reasons - * (e.g, unit testing against Jackrabbit WebDAV). - */ - protected Main(String[] args) throws ParseException { + private static CommandLine createCommand(String[] args, Options options) throws ParseException { options.addOption("?", "help", false, "print this message"); options.addOption("n", "notice", false, "print copyright notices"); options.addOption("l", "license", false, "print license information"); @@ -101,99 +121,141 @@ protected Main(String[] args) throws ParseException { "C", "backup-conf", true, "backup repository configuration file"); - command = new DefaultParser().parse(options, args); + return new DefaultParser().parse(options, args); } - - /** - * Run this Main application. - *

- * Note: this is public because this can be used by other projects in unit tests. e.g, Commons-VFS. - * @throws Exception if any exception occurs - */ - public void run() throws Exception { + + private static File findJarFileLocation(CommandLine command) { String defaultFile = "jackrabbit-standalone.jar"; URL location = - Main.class.getProtectionDomain().getCodeSource().getLocation(); + Main.class.getProtectionDomain().getCodeSource().getLocation(); if (location != null && "file".equals(location.getProtocol())) { File file = new File(location.getPath()); if (file.isFile()) { defaultFile = location.getPath(); } } - File file = new File(command.getOptionValue("file", defaultFile)); + return new File(command.getOptionValue("file", defaultFile)); + } + + private static void setSystemPropertyIfMissing(String key, String value) { + if (System.getProperty(key) == null) { + System.setProperty(key, value); + } + } - if (command.hasOption("help")) { - HelpFormatter formatter = new HelpFormatter(); - formatter.printHelp("java -jar " + file.getName(), options, true); - } else if (command.hasOption("notice")) { - copyToOutput("/META-INF/NOTICE.txt"); - } else if (command.hasOption("license")) { - copyToOutput("/META-INF/LICENSE.txt"); - } else if (command.hasOption("cli")) { - System.setProperty("logback.configurationFile", "logback-cli.xml"); + private final CommandLine command; - String uri = command.getOptionValue("cli"); - Repository repository = JcrUtils.getRepository(uri); + private final RequestLogHandler accessLog; - Context context = new ContextBase(); - CommandHelper.setRepository(context, repository, uri); - try { - Session session = repository.login(); - CommandHelper.setSession(context, session); - CommandHelper.setCurrentNode(context, session.getRootNode()); - } catch (RepositoryException ignore) { - // anonymous login not possible - } + private final WebAppContext webapp; - new JcrClient(context).runInteractive(); + private final Server server; - try { - CommandHelper.getSession(context).logout(); - } catch (CommandException ignore) { - // already logged out - } + private final ServerConnector connector; + + private final File repository; + + private final File log; + + /** + * Construct Main application instance. + *

+ * Note: Constructor is protected because other projects such as Commons VFS can extend this for some reasons + * (e.g, unit testing against Jackrabbit WebDAV). + */ + private Main(CommandLine command) throws ParseException { + this.command = command; + + repository = new File(command.getOptionValue("repo", "jackrabbit")); + repository.mkdirs(); + log = new File(repository, "log"); + log.mkdir(); + + if (!command.hasOption("quiet")) { + System.out.println("Using repository directory " + repository); + System.out.println("Writing log messages to " + log); + } + + setSystemPropertyIfMissing( + "jackrabbit.log", + new File(log, "jackrabbit.log").getPath()); + setSystemPropertyIfMissing( + "jetty.log", + new File(log, "jetty.log").getPath()); + + if (command.hasOption("debug")) { + setSystemPropertyIfMissing("log.level", "DEBUG"); } else { - message("Welcome to Apache Jackrabbit!"); - message("-------------------------------"); + setSystemPropertyIfMissing("log.level", "INFO"); + } - File repository = - new File(command.getOptionValue("repo", "jackrabbit")); - message("Using repository directory " + repository); - repository.mkdirs(); + setSystemPropertyIfMissing( + "derby.stream.error.file", + new File(log, "derby.log").getPath()); + + accessLog = new RequestLogHandler(); + webapp = new WebAppContext(); + server = new Server(); + connector = new ServerConnector(server); + } + + /** + * Construct Main application instance. + *

+ * Note: Constructor is protected because other projects such as Commons VFS can extend this for some reasons + * (e.g, unit testing against Jackrabbit WebDAV). + */ + protected Main(String[] args) throws ParseException { + this(createCommand(args, new Options())); + } + + /** + * Run this Main application. + *

+ * Note: this is public because this can be used by other projects in unit tests. e.g, Commons-VFS. + * @throws Exception if any exception occurs + */ + public void run() throws Exception { + run(findJarFileLocation(command)); + } + + /** + * Run this Main application. + *

+ * Note: this is public because this can be used by other projects in unit tests. e.g, Commons-VFS. + * @throws Exception if any exception occurs + */ + private void run(File jarFile) throws Exception { + message("Welcome to Apache Jackrabbit!"); + message("-------------------------------"); + + if (command.hasOption("backup")) { + backup(repository); + } else { + message("Starting the server..."); File tmp = new File(repository, "tmp"); tmp.mkdir(); - File log = new File(repository, "log"); - log.mkdir(); - - message("Writing log messages to " + log); - prepareServerLog(log); - - if (command.hasOption("backup")) { - backup(repository); - } else { - message("Starting the server..."); - prepareWebapp(file, repository, tmp); - accessLog.setHandler(webapp); - prepareAccessLog(log); - server.setHandler(accessLog); - prepareConnector(); - server.addConnector(connector); - prepareShutdown(); - - try { - server.start(); - - String host = connector.getHost(); - if (host == null) { - host = "localhost"; - } - message("Apache Jackrabbit is now running at " - +"http://" + host + ":" + connector.getPort() + "/"); - } catch (Throwable t) { - System.err.println( - "Unable to start the server: " + t.getMessage()); - System.exit(1); + prepareWebapp(jarFile, repository, tmp); + accessLog.setHandler(webapp); + prepareAccessLog(log); + server.setHandler(accessLog); + prepareConnector(); + server.addConnector(connector); + prepareShutdown(); + + try { + server.start(); + + String host = connector.getHost(); + if (host == null) { + host = "localhost"; } + message("Apache Jackrabbit is now running at " + +"http://" + host + ":" + connector.getPort() + "/"); + } catch (Throwable t) { + System.err.println( + "Unable to start the server: " + t.getMessage()); + System.exit(1); } } } @@ -249,24 +311,6 @@ private void backup(File sourceDir) throws Exception { message("The repository has been successfully copied."); } - private void prepareServerLog(File log) - throws IOException { - System.setProperty( - "jackrabbit.log", new File(log, "jackrabbit.log").getPath()); - System.setProperty( - "jetty.log", new File(log, "jetty.log").getPath()); - - if (command.hasOption("debug")) { - System.setProperty("log.level", "DEBUG"); - } else { - System.setProperty("log.level", "INFO"); - } - - System.setProperty( - "derby.stream.error.file", - new File(log, "derby.log").getPath()); - } - private void prepareAccessLog(File log) { NCSARequestLog ncsa = new NCSARequestLog( new File(log, "access.log.yyyy_mm_dd").getPath()); @@ -280,6 +324,12 @@ private void prepareWebapp(File file, File repository, File tmp) { webapp.setExtractWAR(true); webapp.setTempDirectory(tmp); + Configuration.ClassList classlist = Configuration.ClassList + .setServerDefault(server); + classlist.addBefore( + "org.eclipse.jetty.webapp.JettyWebXmlConfiguration", + "org.eclipse.jetty.annotations.AnnotationConfiguration"); + ServletHolder servlet = new ServletHolder(JackrabbitRepositoryServlet.class); servlet.setInitOrder(1); @@ -314,7 +364,7 @@ private void message(String message) { } } - private void copyToOutput(String resource) throws IOException { + private static void copyToOutput(String resource) throws IOException { InputStream stream = Main.class.getResourceAsStream(resource); try { IOUtils.copy(stream, System.out); diff --git a/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/ext/ConnectToJNDIServer.java b/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/ext/ConnectToJNDIServer.java deleted file mode 100644 index d5c119042dd..00000000000 --- a/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/ext/ConnectToJNDIServer.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.standalone.cli.ext; - -import javax.jcr.Repository; -import javax.naming.InitialContext; - -import org.apache.commons.chain.Command; -import org.apache.commons.chain.Context; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.jackrabbit.rmi.client.ClientAdapterFactory; -import org.apache.jackrabbit.rmi.remote.RemoteRepository; -import org.apache.jackrabbit.standalone.cli.CommandHelper; - -/** - * Connect to a JCR-RMI server - */ -public class ConnectToJNDIServer implements Command { - /** logger */ - private static Log log = LogFactory.getLog(ConnectToJNDIServer.class); - - // ---------------------------- < keys > - /** url key */ - private String urlKey = "url"; - - /** - * {@inheritDoc} - */ - public boolean execute(Context ctx) throws Exception { - String url = (String) ctx.get(this.urlKey); - if (log.isDebugEnabled()) { - log.debug("connecting to jndi server at " + url); - } - InitialContext iCtx = new InitialContext(); - ClientAdapterFactory adapter = new ClientAdapterFactory(); - RemoteRepository remote = (RemoteRepository) iCtx.lookup(url); - Repository repo = adapter.getRepository(remote); - CommandHelper.setRepository(ctx, repo, "jndi " + url); - return false; - } - - /** - * @return the url key - */ - public String getUrlKey() { - return urlKey; - } - - /** - * @param urlKey - * the url key to set - */ - public void setUrlKey(String urlKey) { - this.urlKey = urlKey; - } -} diff --git a/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/ext/ConnectToRmiServer.java b/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/ext/ConnectToRmiServer.java deleted file mode 100644 index b9c706cc75f..00000000000 --- a/jackrabbit-standalone-components/src/main/java/org/apache/jackrabbit/standalone/cli/ext/ConnectToRmiServer.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.standalone.cli.ext; - -import javax.jcr.Repository; - -import org.apache.commons.chain.Command; -import org.apache.commons.chain.Context; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.jackrabbit.rmi.client.ClientRepositoryFactory; -import org.apache.jackrabbit.standalone.cli.CommandHelper; - -/** - * Connect to a JCR-RMI server - */ -public class ConnectToRmiServer implements Command { - /** logger */ - private static Log log = LogFactory.getLog(ConnectToRmiServer.class); - - // ---------------------------- < keys > - /** url key */ - private String urlKey = "url"; - - /** - * {@inheritDoc} - */ - public boolean execute(Context ctx) throws Exception { - String url = (String) ctx.get(this.urlKey); - if (log.isDebugEnabled()) { - log.debug("connecting to jcr-rmi server at " + url); - } - ClientRepositoryFactory factory = new ClientRepositoryFactory(); - Repository repository = factory.getRepository(url); - CommandHelper.setRepository(ctx, repository, "jcr-rmi " + url); - return false; - } - - /** - * @return the url key - */ - public String getUrlKey() { - return urlKey; - } - - /** - * @param urlKey - * the url key to set - */ - public void setUrlKey(String urlKey) { - this.urlKey = urlKey; - } -} diff --git a/jackrabbit-standalone-components/src/main/resources/WEB-INF/web.xml b/jackrabbit-standalone-components/src/main/resources/WEB-INF/web.xml index e00199c579c..8fa8b438dda 100644 --- a/jackrabbit-standalone-components/src/main/resources/WEB-INF/web.xml +++ b/jackrabbit-standalone-components/src/main/resources/WEB-INF/web.xml @@ -170,10 +170,10 @@ - - RMI - org.apache.jackrabbit.servlet.remote.RemoteBindingServlet - + + + + @@ -186,10 +186,10 @@ JCRWebdavServer /server/* - - RMI - /rmi - + + + + diff --git a/jackrabbit-standalone-components/src/main/resources/org/apache/jackrabbit/standalone/cli/command.xml b/jackrabbit-standalone-components/src/main/resources/org/apache/jackrabbit/standalone/cli/command.xml index 959990e3fa4..6a226719c63 100644 --- a/jackrabbit-standalone-components/src/main/resources/org/apache/jackrabbit/standalone/cli/command.xml +++ b/jackrabbit-standalone-components/src/main/resources/org/apache/jackrabbit/standalone/cli/command.xml @@ -54,12 +54,6 @@ - - - - diff --git a/jackrabbit-standalone/pom.xml b/jackrabbit-standalone/pom.xml index 6e4cbf4f98a..fa8e011c8e6 100644 --- a/jackrabbit-standalone/pom.xml +++ b/jackrabbit-standalone/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-standalone diff --git a/jackrabbit-vfs-ext/pom.xml b/jackrabbit-vfs-ext/pom.xml index 8f628dd012e..418d84b9e9d 100644 --- a/jackrabbit-vfs-ext/pom.xml +++ b/jackrabbit-vfs-ext/pom.xml @@ -20,7 +20,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-vfs-ext @@ -44,57 +44,22 @@ org.apache.commons commons-vfs2 - 2.9.0 + 2.10.0 - commons-logging - commons-logging - - - - org.apache.hadoop - hadoop-hdfs-client - - - - - - org.apache.hadoop - hadoop-hdfs-client - 3.3.4 - - - org.jetbrains.kotlin - kotlin-stdlib-common + commons-io + commons-io - - - org.jetbrains.kotlin - kotlin-stdlib - 1.8.0 - org.apache.commons commons-vfs2-jackrabbit2 - 2.9.0 + 2.10.0 - commons-logging - commons-logging - - - org.apache.httpcomponents - httpclient - - - org.apache.jackrabbit - jackrabbit-webdav - - - org.apache.jackrabbit - jackrabbit-standalone-components + commons-io + commons-io diff --git a/jackrabbit-vfs-ext/src/test/java/org/apache/jackrabbit/vfs/ext/ds/TestVFSDataStore.java b/jackrabbit-vfs-ext/src/test/java/org/apache/jackrabbit/vfs/ext/ds/TestVFSDataStore.java index c8c89d2162a..43736aaba2f 100644 --- a/jackrabbit-vfs-ext/src/test/java/org/apache/jackrabbit/vfs/ext/ds/TestVFSDataStore.java +++ b/jackrabbit-vfs-ext/src/test/java/org/apache/jackrabbit/vfs/ext/ds/TestVFSDataStore.java @@ -32,14 +32,13 @@ import org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder; import org.apache.jackrabbit.core.data.CachingDataStore; import org.apache.jackrabbit.core.data.TestCaseBase; +import org.junit.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.InputSource; -import junit.framework.Assert; - /** * Test {@link CachingDataStore} with VFSBackend with a VFS file system (local file system) by default. *

@@ -191,7 +190,11 @@ protected void doSetFileSystemOptionsPropertiesInString() throws Exception { File [] identities = configBuilder.getIdentities(fso); Assert.assertNotNull(identities); Assert.assertEquals(1, identities.length); - Assert.assertEquals("/home/tester/.ssh/id_rsa", FilenameUtils.separatorsToUnix(identities[0].getPath())); + String expectedPath = identities[0].getPath(); + if (FilenameUtils.getPrefixLength(expectedPath) != 0) { + expectedPath = expectedPath.substring(FilenameUtils.getPrefixLength(expectedPath) - 1); + } + Assert.assertEquals("/home/tester/.ssh/id_rsa", FilenameUtils.separatorsToUnix(expectedPath)); Assert.assertEquals(Integer.valueOf(30000), configBuilder.getTimeout(fso)); dataStore.close(); diff --git a/jackrabbit-webapp-jakarta/pom.xml b/jackrabbit-webapp-jakarta/pom.xml index 0a85da68d9c..f95a6c6f90c 100644 --- a/jackrabbit-webapp-jakarta/pom.xml +++ b/jackrabbit-webapp-jakarta/pom.xml @@ -20,13 +20,15 @@ org.apache.jackrabbit jackrabbit-webapp-project - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-webapp-project jackrabbit-webapp-jakarta + Jackrabbit Web Application (Jakarta) + Web application that hosts and serves a Jackrabbit content repository. This artifact supports the Jakarta Servlet API 5.0, as transformed from the jackrabbit-webapp project. war - 10.1.6 + 10.1.42 @@ -62,6 +64,7 @@ + @@ -137,18 +140,23 @@ ${tomcat.version} - org.apache.tika - tika-parsers-standard-package - - - org.bouncycastle - bcmail-jdk15on - - - org.bouncycastle - bcprov-jdk15on - - + org.apache.derby + derbytools + test + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jackrabbit-webapp-project/pom.xml b/jackrabbit-webapp-project/pom.xml index 7beb86aa682..7ca3ebe94f4 100644 --- a/jackrabbit-webapp-project/pom.xml +++ b/jackrabbit-webapp-project/pom.xml @@ -20,10 +20,12 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-webapp-project + Jackrabbit Web Application (parent) + Parent project for the Jackrabbit web application for both legacy Servlet API and Jakarta Servlet API 5.0. pom ../jackrabbit-webapp @@ -51,11 +53,6 @@ org.slf4j jcl-over-slf4j - - org.apache.jackrabbit - jackrabbit-jcr-rmi - ${project.version} - ch.qos.logback logback-classic @@ -63,6 +60,7 @@ commons-beanutils commons-beanutils + 1.9.4 org.apache.tomcat @@ -121,4 +119,4 @@ - \ No newline at end of file + diff --git a/jackrabbit-webapp/pom.xml b/jackrabbit-webapp/pom.xml index 3c0f04da523..4ad25a023ca 100644 --- a/jackrabbit-webapp/pom.xml +++ b/jackrabbit-webapp/pom.xml @@ -23,13 +23,18 @@ org.apache.jackrabbit jackrabbit-webapp-project - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-webapp-project jackrabbit-webapp war Jackrabbit Web Application Web application that hosts and serves a Jackrabbit content repository + + + 9.0.104 + + org.apache.jackrabbit @@ -41,6 +46,24 @@ jackrabbit-jcr-servlet ${project.version} + + + ch.qos.logback + logback-classic + + + + org.apache.tomcat + tomcat-servlet-api + ${tomcat.version} + provided + + + + junit + junit + test + org.apache.tomcat tomcat-catalina @@ -73,33 +96,58 @@ + + org.htmlunit + htmlunit + 4.7.0 + test + + + commons-logging + commons-logging + + + + + org.slf4j + jul-to-slf4j + ${slf4j.version} + test + + + org.apache.derby + derby + test + + + org.apache.derby + derbytools + test + - maven-antrun-plugin + maven-jar-plugin - package - - - - - + prepare-jar + + prepare-package - run + jar - + org.codehaus.mojo build-helper-maven-plugin - attach-artifacts + attach-jar package attach-artifact diff --git a/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/AbstractConfig.java b/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/AbstractConfig.java index 2d005bdd0d2..9221327737d 100644 --- a/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/AbstractConfig.java +++ b/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/AbstractConfig.java @@ -16,17 +16,12 @@ */ package org.apache.jackrabbit.j2ee; -import org.apache.commons.beanutils.BeanMap; import org.apache.jackrabbit.util.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Enumeration; +import java.util.HashMap; import java.util.Iterator; -import java.util.Properties; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; /** * Abstract configuration class that is based on a bean map. @@ -40,54 +35,7 @@ public abstract class AbstractConfig { protected boolean valid; - private BeanMap map = new BeanMap(this); - - /** - * Initializes the configuration with values from the given properties - * @param props the configuration properties - */ - public void init(Properties props) throws ServletException { - Iterator iter = props.keySet().iterator(); - while (iter.hasNext()) { - String name = (String) iter.next(); - String mapName = toMapName(name, '.'); - try { - if (map.containsKey(mapName)) { - map.put(mapName, props.getProperty(name)); - } - } catch (Exception e) { - throw new ServletExceptionWithCause( - "Invalid configuration property: " + name, e); - } - } - } - - public void init(ServletConfig ctx) throws ServletException { - Enumeration names = ctx.getInitParameterNames(); - while (names.hasMoreElements()) { - String name = (String) names.nextElement(); - String mapName = toMapName(name, '-'); - try { - if (map.containsKey(mapName)) { - map.put(mapName, ctx.getInitParameter(name)); - } - } catch (Exception e) { - throw new ServletExceptionWithCause( - "Invalid servlet configuration option: " + name, e); - } - } - } - - public String toMapName(String name, char delim) { - StringBuffer ret = new StringBuffer(); - String[] elems = Text.explode(name, delim); - ret.append(elems[0]); - for (int i=1; i - * +-------------------+--------------------+ - * | Property Name | Init-Param Name | - * +-------------------+--------------------+ - * | rmi.enable | {rmi-port sepc.} | - * | rmi.host | rmi-host | - * | rmi.port | rmi-port | - * | rmi.name | {repository name} | - * | rmi.url | rmi-url | - * +-------------------+--------------------+ - * - */ -public class RMIConfig extends AbstractConfig { - - /** - * default logger - */ - private static final Logger log = LoggerFactory.getLogger(RMIConfig.class); - - private boolean rmiEnabled; - - private int rmiPort = -1; - - private String rmiHost; - - private String rmiName; - - private String rmiUri; - - private final BootstrapConfig parentConfig; - - - public RMIConfig(BootstrapConfig parentConfig) { - this.parentConfig = parentConfig; - } - - public void init(ServletConfig ctx) throws ServletException { - super.init(ctx); - // enable RMI if either port or url was defined - rmiEnabled = rmiPort >=0 || rmiUri != null; - } - - public String getRmiName() { - return rmiName; - } - - public void setRmiName(String rmiName) { - this.rmiName = rmiName; - } - - public boolean enabled() { - return rmiEnabled; - } - - public String getRmiEnabled() { - return String.valueOf(rmiEnabled); - } - - public void setRmiEnabled(String rmiEnabled) { - this.rmiEnabled = Boolean.valueOf(rmiEnabled).booleanValue(); - } - - public int rmiPort() { - return rmiPort; - } - - public String getRmiPort() { - return String.valueOf(rmiPort); - } - - public void setRmiPort(String rmiPort) { - this.rmiPort = Integer.decode(rmiPort).intValue(); - } - - public String getRmiHost() { - return rmiHost; - } - - public void setRmiHost(String rmiHost) { - this.rmiHost = rmiHost; - } - - public String getRmiUri() { - return rmiUri; - } - - public void setRmiUri(String rmiUri) { - this.rmiUri = rmiUri; - } - - public void validate() { - if (!rmiEnabled) { - return; - } - - if (rmiUri != null && rmiUri.length() > 0) { - // URI takes precedences, so check whether the configuration has to - // be set from the URI - try { - URI uri = new URI(rmiUri); - - // extract values from the URI, check later - rmiHost = uri.getHost(); - rmiPort = uri.getPort(); - rmiName = uri.getPath(); - - } catch (URISyntaxException e) { - log.warn("Cannot parse RMI URI '" + rmiUri + "'.", e); - rmiUri = null; // clear RMI URI use another one - rmiHost = null; // use default host, ignore rmi-host param - } - - // cut of leading slash from name if defined at all - if (rmiName != null && rmiName.startsWith("/")) { - rmiName = rmiName.substring(1); - } - } - - // check RMI port - if (rmiPort == -1 || rmiPort == 0) { - // accept -1 or 0 as a hint to use the default - rmiPort = Registry.REGISTRY_PORT; - } else if (rmiPort < -1 || rmiPort > 0xFFFF) { - // emit a warning if out of range, use defualt in this case - log.warn("Invalid port in rmi-port param " + rmiPort + ". using default port."); - rmiPort = Registry.REGISTRY_PORT; - } - - // check host - use an empty name if null (i.e. not configured) - if (rmiHost == null) { - rmiHost = ""; - } - - // check name - use repositoryName if empty or null - if (rmiName == null || rmiName.length() ==0) { - rmiName = parentConfig.getRepositoryName(); - } - - // reconstruct the rmiURI now because values might have been changed - rmiUri = "//" + rmiHost + ":" + rmiPort + "/" + rmiName; - valid = true; - } -} \ No newline at end of file diff --git a/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryAccessServlet.java b/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryAccessServlet.java index f09575fdab2..30054c25744 100644 --- a/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryAccessServlet.java +++ b/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryAccessServlet.java @@ -16,7 +16,6 @@ */ package org.apache.jackrabbit.j2ee; -import org.apache.jackrabbit.rmi.client.ClientRepositoryFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,9 +24,6 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import java.net.MalformedURLException; -import java.rmi.NotBoundException; -import java.rmi.RemoteException; import java.util.Properties; import javax.jcr.Repository; @@ -39,7 +35,7 @@ /** * This Class implements a servlet that is used as unified mechanism to retrieve - * a jcr repository either through JNDI or RMI. + * a jcr repository either through JNDI. */ public class RepositoryAccessServlet extends HttpServlet { @@ -220,42 +216,6 @@ private Repository getRepositoryByJNDI() throws ServletException { } } - /** - * Checks if the repository is available via RMI and returns it. - * @return the repository or null - * @throws ServletException if this servlet is not properly configured. - */ - private Repository getRepositoryByRMI() throws ServletException { - BootstrapConfig config = getConfig(); - if (!config.getRmiConfig().isValid() || !config.getRmiConfig().enabled()) { - return null; - } - - // acquire via RMI - String rmiURI = config.getRmiConfig().getRmiUri(); - if (rmiURI == null) { - return null; - } - log.info(" trying to retrieve repository using rmi. uri={}", rmiURI); - ClientFactoryDelegater cfd; - try { - Class clazz = Class.forName(getServerFactoryDelegaterClass()); - cfd = (ClientFactoryDelegater) clazz.newInstance(); - } catch (Throwable e) { - log.error("Unable to locate RMI ClientRepositoryFactory. Is jcr-rmi.jar missing?", e); - return null; - } - - try { - Repository r = cfd.getRepository(rmiURI); - log.info("Acquired repository via RMI."); - return r; - } catch (Exception e) { - log.error("Error while retrieving repository using RMI: {}", rmiURI, e); - return null; - } - } - /** * If our config said so, try to retrieve a Repository from the ServletContext */ @@ -275,17 +235,6 @@ protected Repository getRepositoryByContextAttribute() { return result; } - /** - * Return the fully qualified name of the class providing the client - * repository. The class whose name is returned must implement the - * {@link ClientFactoryDelegater} interface. - * - * @return the qfn of the factory class. - */ - protected String getServerFactoryDelegaterClass() { - return getClass().getName() + "$RMIClientFactoryDelegater"; - } - /** * Returns the JCR repository * @@ -302,10 +251,6 @@ public Repository getRepository() { // try to retrieve via jndi repository = getRepositoryByJNDI(); } - if (repository == null) { - // try to get via rmi - repository = getRepositoryByRMI(); - } if (repository == null) { throw new ServletException("N/A"); } @@ -335,29 +280,5 @@ public static Repository getRepository(ServletContext ctx) { public BootstrapConfig getBootstrapConfig() { return config; } - - /** - * optional class for RMI, will only be used, if RMI client is present - */ - protected static abstract class ClientFactoryDelegater { - - public abstract Repository getRepository(String uri) - throws RemoteException, MalformedURLException, NotBoundException; - } - - /** - * optional class for RMI, will only be used, if RMI server is present - */ - protected static class RMIClientFactoryDelegater extends ClientFactoryDelegater { - - // only used to enforce linking upon Class.forName() - static String FactoryClassName = ClientRepositoryFactory.class.getName(); - - public Repository getRepository(String uri) - throws MalformedURLException, NotBoundException, RemoteException { - System.setProperty("java.rmi.server.useCodebaseOnly", "true"); - return new ClientRepositoryFactory().getRepository(uri); - } - } } diff --git a/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java b/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java index fef961e058b..3764d1380fa 100644 --- a/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java +++ b/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java @@ -20,8 +20,6 @@ import org.apache.jackrabbit.commons.repository.RepositoryFactory; import org.apache.jackrabbit.core.RepositoryImpl; import org.apache.jackrabbit.core.config.RepositoryConfig; -import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory; -import org.apache.jackrabbit.rmi.server.ServerAdapterFactory; import org.apache.jackrabbit.servlet.AbstractRepositoryServlet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,15 +33,6 @@ import java.net.InetAddress; import java.net.ServerSocket; import java.net.UnknownHostException; -import java.rmi.AlreadyBoundException; -import java.rmi.Naming; -import java.rmi.NoSuchObjectException; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; -import java.rmi.server.RMIServerSocketFactory; -import java.rmi.server.UnicastRemoteObject; import java.util.Properties; import javax.jcr.Repository; @@ -57,83 +46,8 @@ /** * The RepositoryStartupServlet starts a jackrabbit repository and registers it - * to the JNDI environment and optional to the RMI registry. + * to the JNDI environment. *

- * Registration with RMI - *

- * Upon successfull creation of the repository in the {@link #init()} method, - * the repository is registered with an RMI registry if the web application is - * so configured. To register with RMI, the following web application - * init-params are considered: rmi-port designating - * the port on which the RMI registry is listening, rmi-host - * designating the interface on the local host on which the RMI registry is - * active, repository-name designating the name to which the - * repository is to be bound in the registry, and rmi-uri - * designating an RMI URI complete with host, optional port and name to which - * the object is bound. - *

- * If the rmi-uri parameter is configured with a non-empty value, - * the rmi-port and rmi-host parameters are ignored. - * The repository-name parameter is only considered if a non-empty - * rmi-uri parameter is configured if the latter does not contain - * a name to which to bind the repository. - *

- * This is the algorithm used to find out the host, port and name for RMI - * registration: - *

    - *
  1. If neither a rmi-uri nor a rmi-host nor a - * rmi-port parameter is configured, the repository is not - * registered with any RMI registry. - *
  2. If a non-empty rmi-uri parameter is configured extract the - * host name (or IP address), port number and name to bind to from the - * URI. If the URI is not valid, host defaults to 0.0.0.0 - * meaning all interfaces on the local host, port defaults to the RMI - * default port (1099) and the name defaults to the value - * of the repository-name parameter. - *
  3. If a non-empty rmi-uri is not configured, the host is taken - * from the rmi-host parameter, the port from the - * rmi-port parameter and the name to bind the repository to - * from the repository-name parameter. If the - * rmi-host parameter is empty or not configured, the host - * defaults to 0.0.0.0 meaning all interfaces on the local - * host. If the rmi-port parameter is empty, not configured, - * zero or a negative value, the default port for the RMI registry - * (1099) is used. - *
- *

- * After finding the host and port of the registry, the RMI registry itself - * is acquired. It is assumed, that host and port primarily designate an RMI - * registry, which should be active on the local host but has not been started - * yet. In this case, the LocateRegistry.createRegistry method is - * called to create a registry on the local host listening on the host and port - * configured. If creation fails, the LocateRegistry.getRegistry - * method is called to get a remote instance of the registry. Note, that - * getRegistry does not create an actual registry on the given - * host/port nor does it check, whether an RMI registry is active. - *

- * When the registry has been retrieved, either by creation or by just creating - * a remote instance, the repository is bound to the configured name in the - * registry. - *

- * Possible causes for registration failures include: - *

    - *
  • The web application is not configured to register with an RMI registry at - * all. - *
  • The registry is expected to be running on a remote host but does not. - *
  • The registry is expected to be running on the local host but cannot be - * accessed. Reasons include another application which does not act as an - * RMI registry is running on the configured port and thus blocks creation - * of a new RMI registry. - *
  • An object may already be bound to the same name as is configured to be - * used for the repository. - *
- *

- * Note: if a bootstrap-config init parameter is specified the - * servlet tries to read the respective resource, either as context resource or - * as file. The properties specified in this file override the init params - * specified in the web.xml. - *

- *

* Setup Wizard Functionality
* When using the first time, the configuration can miss the relevant * repository parameters in the web.xml. if so, it must contain a @@ -177,21 +91,6 @@ public class RepositoryStartupServlet extends AbstractRepositoryServlet { */ private InitialContext jndiContext; - private Registry rmiRegistry = null; - - /** - * Keeps a strong reference to the server side RMI repository instance to - * prevent the RMI distributed Garbage Collector from collecting the - * instance making the repository unaccessible though it should still be. - * This field is only set to a non-null value, if registration - * of the repository to an RMI registry succeeded in the - * {@link #registerRMI()} method. - * - * @see #registerRMI() - * @see #unregisterRMI() - */ - private Remote rmiRepository; - /** * the file to the bootstrap config */ @@ -245,7 +144,6 @@ public void startup() throws ServletException { try { if (configure()) { initRepository(); - registerRMI(); registerJNDI(); } log.info("RepositoryStartupServlet initialized."); @@ -266,7 +164,6 @@ public void shutdown() { } else { log.info("RepositoryStartupServlet shutting down..."); shutdownRepository(); - unregisterRMI(); unregisterJNDI(); log.info("RepositoryStartupServlet shut down."); } @@ -487,139 +384,6 @@ private void unregisterJNDI() { } } - /** - * Registers the repository to an RMI registry configured in the web - * application. See Registration with RMI in the - * class documentation for a description of the algorithms used to register - * the repository with an RMI registry. - * @throws ServletException if an error occurs. - */ - private void registerRMI() { - RMIConfig rc = config.getRmiConfig(); - if (!rc.isValid() || !rc.enabled()) { - return; - } - - // try to create remote repository - Remote remote; - try { - Class clazz = Class.forName(getRemoteFactoryDelegaterClass()); - RemoteFactoryDelegater rmf = (RemoteFactoryDelegater) clazz.newInstance(); - remote = rmf.createRemoteRepository(repository); - } catch (RemoteException e) { - log.warn("Unable to create RMI repository.", e); - return; - } catch (Throwable t) { - log.warn("Unable to create RMI repository." - + " The jcr-rmi jar might be missing.", t); - return; - } - - try { - System.setProperty("java.rmi.server.useCodebaseOnly", "true"); - Registry reg = null; - - // first try to create the registry, which will fail if another - // application is already running on the configured host/port - // or if the rmiHost is not local - try { - // find the server socket factory: use the default if the - // rmiHost is not configured - RMIServerSocketFactory sf; - if (rc.getRmiHost().length() > 0) { - log.debug("Creating RMIServerSocketFactory for host " + rc.getRmiHost()); - InetAddress hostAddress = InetAddress.getByName(rc.getRmiHost()); - sf = getRMIServerSocketFactory(hostAddress); - } else { - // have the RMI implementation decide which factory is the - // default actually - log.debug("Using default RMIServerSocketFactory"); - sf = null; - } - - // create a registry using the default client socket factory - // and the server socket factory retrieved above. This also - // binds to the server socket to the rmiHost:rmiPort. - reg = LocateRegistry.createRegistry(rc.rmiPort(), null, sf); - rmiRegistry = reg; - } catch (UnknownHostException uhe) { - // thrown if the rmiHost cannot be resolved into an IP-Address - // by getRMIServerSocketFactory - log.info("Cannot create Registry", uhe); - } catch (RemoteException e) { - // thrown by createRegistry if binding to the rmiHost:rmiPort - // fails, for example due to rmiHost being remote or another - // application already being bound to the port - log.info("Cannot create Registry", e); - } - - // if creation of the registry failed, we try to access an - // potentially active registry. We do not check yet, whether the - // registry is actually accessible. - if (reg == null) { - log.debug("Trying to access existing registry at " + rc.getRmiHost() - + ":" + rc.getRmiPort()); - try { - reg = LocateRegistry.getRegistry(rc.getRmiHost(), rc.rmiPort()); - } catch (RemoteException re) { - log.warn("Cannot create the reference to the registry at " - + rc.getRmiHost() + ":" + rc.getRmiPort(), re); - } - } - - // if we finally have a registry, register the repository with the - // rmiName - if (reg != null) { - log.debug("Registering repository as " + rc.getRmiName() - + " to registry " + reg); - reg.bind(rc.getRmiName(), remote); - - // when successfull, keep references - this.rmiRepository = remote; - log.info("Repository bound via RMI with name: " + rc.getRmiUri()); - } else { - log.info("RMI registry missing, cannot bind repository via RMI"); - } - } catch (RemoteException e) { - log.warn("Unable to bind repository via RMI: " + rc.getRmiUri(), e); - } catch (AlreadyBoundException e) { - log.warn("Unable to bind repository via RMI: " + rc.getRmiUri(), e); - } - } - - /** - * Unregisters the repository from the RMI registry, if it has previously - * been registered. - */ - private void unregisterRMI() { - if (rmiRepository != null) { - // Forcibly unexport the repository; - try { - UnicastRemoteObject.unexportObject(rmiRepository, true); - } catch (NoSuchObjectException e) { - log.warn("Odd, the RMI repository was not exported", e); - } - // drop strong reference to remote repository - rmiRepository = null; - - // unregister repository - try { - Naming.unbind(config.getRmiConfig().getRmiUri()); - } catch (Exception e) { - log("Error while unbinding repository from JNDI: " + e); - } - } - - if (rmiRegistry != null) { - try { - UnicastRemoteObject.unexportObject(rmiRegistry, true); - } catch (NoSuchObjectException e) { - log.warn("Odd, the RMI registry was not exported", e); - } - rmiRegistry = null; - } - } - /** * Returns the config that was used to bootstrap this servlet. * @return the bootstrap config or null. @@ -628,71 +392,6 @@ public BootstrapConfig getBootstrapConfig() { return config; } - /** - * Return the fully qualified name of the class providing the remote - * repository. The class whose name is returned must implement the - * {@link RemoteFactoryDelegater} interface. - *

- * Subclasses may override this method for providing a name of a own - * implementation. - * - * @return getClass().getName() + "$RMIRemoteFactoryDelegater" - */ - protected String getRemoteFactoryDelegaterClass() { - return getClass().getName() + "$RMIRemoteFactoryDelegater"; - } - - /** - * Returns an RMIServerSocketFactory used to create the server - * socket for a locally created RMI registry. - *

- * This implementation returns a new instance of a simple - * RMIServerSocketFactory which just creates instances of - * the java.net.ServerSocket class bound to the given - * hostAddress. Implementations may overwrite this method to - * provide factory instances, which provide more elaborate server socket - * creation, such as SSL server sockets. - * - * @param hostAddress The InetAddress instance representing the - * the interface on the local host to which the server sockets are - * bound. - * @return A new instance of a simple RMIServerSocketFactory - * creating java.net.ServerSocket instances bound to - * the rmiHost. - */ - protected RMIServerSocketFactory getRMIServerSocketFactory( - final InetAddress hostAddress) { - return new RMIServerSocketFactory() { - public ServerSocket createServerSocket(int port) throws IOException { - return new ServerSocket(port, -1, hostAddress); - } - }; - } - - /** - * optional class for RMI, will only be used, if RMI server is present - */ - protected static abstract class RemoteFactoryDelegater { - - public abstract Remote createRemoteRepository(Repository repository) - throws RemoteException; - } - - /** - * optional class for RMI, will only be used, if RMI server is present - */ - protected static class RMIRemoteFactoryDelegater extends RemoteFactoryDelegater { - - private static final RemoteAdapterFactory FACTORY = - new ServerAdapterFactory(); - - public Remote createRemoteRepository(Repository repository) - throws RemoteException { - return FACTORY.getRemoteRepository(repository); - } - - } - //-------------------------------------------------< Installer Routines >--- /** @@ -764,4 +463,3 @@ private void redirect(HttpServletRequest req, resp.sendRedirect(cp + loc); } } - diff --git a/jackrabbit-webapp/src/main/webapp/WEB-INF/templates/bootstrap.properties b/jackrabbit-webapp/src/main/webapp/WEB-INF/templates/bootstrap.properties index ca373785f89..1b6672dd991 100644 --- a/jackrabbit-webapp/src/main/webapp/WEB-INF/templates/bootstrap.properties +++ b/jackrabbit-webapp/src/main/webapp/WEB-INF/templates/bootstrap.properties @@ -22,13 +22,6 @@ repository.config=jackrabbit/repository/repository.xml repository.home=jackrabbit/repository repository.name=jackrabbit.repository -# RMI Settings -rmi.enabled=true -rmi.port=0 -rmi.host=localhost -# If the URI is not specified, it's composed as follows: -#rmi.uri=//${rmi.host}:${rmi.port}/${repository.name} - # JNDI Settings # all properties starting with 'java.naming.' will go into the # environment of the initial context diff --git a/jackrabbit-webapp/src/main/webapp/WEB-INF/web.xml b/jackrabbit-webapp/src/main/webapp/WEB-INF/web.xml index bfcf019d546..b809f2bcb73 100644 --- a/jackrabbit-webapp/src/main/webapp/WEB-INF/web.xml +++ b/jackrabbit-webapp/src/main/webapp/WEB-INF/web.xml @@ -363,10 +363,10 @@ - - RMI - org.apache.jackrabbit.servlet.remote.RemoteBindingServlet - + + + + @@ -383,10 +383,10 @@ JCRWebdavServer /server/* - - RMI - /rmi - + + + + diff --git a/jackrabbit-webapp/src/main/webapp/remote.jsp b/jackrabbit-webapp/src/main/webapp/remote.jsp index 1eedcfb1f51..139502242e8 100644 --- a/jackrabbit-webapp/src/main/webapp/remote.jsp +++ b/jackrabbit-webapp/src/main/webapp/remote.jsp @@ -23,15 +23,21 @@ String base = base = Text.encodeIllegalXMLCharacters(base); %>

- The content repository within this web application is made available + The content repository within this web application may be made available to remote clients through RMI and the jackrabbit-jcr-rmi component.

- The remote repository stub is available both in the RMI registry - (one is started automatically by this web application if not already running) - and as a direct HTTP download. The default URLs for accessing the remote + To access a remote repository stub, it needs to be registered in the RMI registry. + By default, this is not started automatically by this web application. To change that, + use the related properties in the bootstrap.properties file which are commented out + in the template file. + You can also make the stub available as a direct HTTP download by enabling the + RemoteBindingServlet and the corresponding servlet mapping, which are commented out + in the web.xml template. + + The default URLs for accessing the remote repository are:

    diff --git a/jackrabbit-webapp/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java b/jackrabbit-webapp/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java index a547758177e..bf2e57a157d 100644 --- a/jackrabbit-webapp/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java +++ b/jackrabbit-webapp/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java @@ -20,21 +20,21 @@ import java.io.File; import java.io.IOException; import java.net.URL; -import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.List; import junit.framework.TestCase; import org.apache.catalina.startup.Tomcat; import org.apache.commons.io.FileUtils; +import org.apache.tomcat.util.scan.StandardJarScanner; import org.slf4j.bridge.SLF4JBridgeHandler; -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.HtmlElement; -import com.gargoylesoftware.htmlunit.html.HtmlForm; -import com.gargoylesoftware.htmlunit.html.HtmlInput; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import com.google.common.io.Files; +import org.htmlunit.WebClient; +import org.htmlunit.html.HtmlElement; +import org.htmlunit.html.HtmlForm; +import org.htmlunit.html.HtmlInput; +import org.htmlunit.html.HtmlPage; public class TomcatIT extends TestCase { @@ -75,8 +75,11 @@ protected void setUp() throws Exception { tomcat.setBaseDir(baseDir.getPath()); tomcat.setHostname(url.getHost()); tomcat.setPort(url.getPort()); + tomcat.getConnector(); - tomcat.addWebapp("", war.getAbsolutePath()); + StandardJarScanner jarScanner = new StandardJarScanner(); + jarScanner.setScanManifest(false); + tomcat.addWebapp("", war.getAbsolutePath()).setJarScanner(jarScanner); tomcat.start(); @@ -112,10 +115,10 @@ private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException { } private void rewriteWebXml(File war) throws IOException { - File webXml = new File(war, new File("WEB-INF","web.xml").getPath()); + File webXml = new File(war, new File("WEB-INF", "web.xml").getPath()); assertTrue(webXml.exists()); - List lines = Files.readLines(webXml, StandardCharsets.UTF_8); - BufferedWriter writer = Files.newWriter(webXml, StandardCharsets.UTF_8); + List lines = Files.readAllLines(webXml.toPath()); + BufferedWriter writer = Files.newBufferedWriter(webXml.toPath()); try { for (String line : lines) { line = line.replace("jackrabbit/bootstrap.properties", diff --git a/jackrabbit-webdav-jakarta/pom.xml b/jackrabbit-webdav-jakarta/pom.xml index 1c5fd85e069..fd2cd36c21b 100644 --- a/jackrabbit-webdav-jakarta/pom.xml +++ b/jackrabbit-webdav-jakarta/pom.xml @@ -20,10 +20,12 @@ org.apache.jackrabbit jackrabbit-webdav-project - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-webdav-project jackrabbit-webdav-jakarta + Jackrabbit WebDAV Library (Jakarta) + Generic WebDAV Library supporting the Jakarta Servlet API 5.0, transformed from the jackrabbit-webdav project. diff --git a/jackrabbit-webdav-project/pom.xml b/jackrabbit-webdav-project/pom.xml index 857430509c0..ae092a1ec67 100644 --- a/jackrabbit-webdav-project/pom.xml +++ b/jackrabbit-webdav-project/pom.xml @@ -20,12 +20,13 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-parent/pom.xml jackrabbit-webdav-project pom - Jackrabbit JCR Servlet Project + Jackrabbit WebDAV Library (parent) + Parent project for the two API-versions of the WebDAV Library (legacy Servlet API and Jakarta Servlet API 5.0) ../jackrabbit-webdav ../jackrabbit-webdav-jakarta diff --git a/jackrabbit-webdav/pom.xml b/jackrabbit-webdav/pom.xml index 18f478fa109..803cda5cd64 100644 --- a/jackrabbit-webdav/pom.xml +++ b/jackrabbit-webdav/pom.xml @@ -26,7 +26,7 @@ org.apache.jackrabbit jackrabbit-webdav-project - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT ../jackrabbit-webdav-project jackrabbit-webdav @@ -47,7 +47,6 @@ **/*TestAll.java - once ${test.opts} diff --git a/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java b/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java index 38d8460a4da..39aba4696a3 100644 --- a/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java +++ b/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java @@ -61,6 +61,7 @@ import org.apache.jackrabbit.webdav.header.OverwriteHeader; import org.apache.jackrabbit.webdav.header.PollTimeoutHeader; import org.apache.jackrabbit.webdav.header.TimeoutHeader; +import org.apache.jackrabbit.webdav.lock.ActiveLock; import org.apache.jackrabbit.webdav.lock.LockInfo; import org.apache.jackrabbit.webdav.lock.Scope; import org.apache.jackrabbit.webdav.lock.Type; @@ -619,19 +620,22 @@ public LockInfo getLockInfo() throws DavException { * @see org.apache.jackrabbit.webdav.lock.ActiveLock#getToken() */ public boolean matchesIfHeader(DavResource resource) { - // no ifheader, no resource or no write lock on resource + // no ifheader // >> preconditions ok so far - if (!ifHeader.hasValue() || resource == null || !resource.hasLock(Type.WRITE, Scope.EXCLUSIVE)) { + if (!ifHeader.hasValue() || resource == null) { return true; } - boolean isMatching = false; - String lockToken = resource.getLock(Type.WRITE, Scope.EXCLUSIVE).getToken(); - if (lockToken != null) { - isMatching = matchesIfHeader(resource.getHref(), lockToken, getStrongETag(resource)); - } // else: lockToken is null >> the if-header will not match. - - return isMatching; + ActiveLock[] locks = resource.getLocks(); + if (!resource.exists() || locks.length == 0) { + return matchesIfHeader(resource.getHref(), null, getStrongETag(resource)); + } + for (ActiveLock lock : locks) { + if (matchesIfHeader(resource.getHref(), lock.getToken(), getStrongETag(resource))) { + return true; + } + } + return false; } /** @@ -650,11 +654,13 @@ public boolean matchesIfHeader(String href, String token, String eTag) { * @return strong etag or empty string. */ private String getStrongETag(DavResource resource) { - DavProperty prop = resource.getProperty(DavPropertyName.GETETAG); - if (prop != null && prop.getValue() != null) { - String etag = prop.getValue().toString(); - if (isStrongETag(etag)) { - return etag; + if (resource.exists()) { + DavProperty prop = resource.getProperty(DavPropertyName.GETETAG); + if (prop != null && prop.getValue() != null) { + String etag = prop.getValue().toString(); + if (isStrongETag(etag)) { + return etag; + } } } // no strong etag available diff --git a/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/IfHeader.java b/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/IfHeader.java index 63d272865b6..6adac78482b 100644 --- a/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/IfHeader.java +++ b/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/IfHeader.java @@ -103,6 +103,8 @@ public class IfHeader implements Header { */ private List allNotTokens = new ArrayList(); + private String uriPrefix; + /** * Create a Untagged IfHeader if the given lock tokens. * @@ -127,6 +129,9 @@ public IfHeader(String[] tokens) { * @param req The request object */ public IfHeader(HttpServletRequest req) { + String host = req.getHeader("Host"); + String scheme = req.getScheme(); + uriPrefix = scheme + "://" + host + req.getContextPath(); headerValue = req.getHeader(DavConstants.HEADER_IF); ifHeader = parse(); } @@ -657,7 +662,7 @@ private static class IfListEntryToken extends IfListEntry { */ @Override public boolean match(String token, String etag) { - return super.match(token); + return token == null || super.match(token); } /** @@ -858,7 +863,7 @@ public boolean matches(String resource, String token, String etag) { Tagged = { "<" Word ">" "(" IfList ")" } . * */ - private static class IfHeaderMap extends HashMap implements IfHeaderInterface { + private class IfHeaderMap extends HashMap implements IfHeaderInterface { /** * Matches the token and etag for the given resource. If the resource is @@ -876,10 +881,22 @@ private static class IfHeaderMap extends HashMap implement public boolean matches(String resource, String token, String etag) { log.debug("matches: Trying to match resource="+resource+", token="+token+","+etag); - IfHeaderList list = get(resource); + String uri; + String path; + if (resource.startsWith("/")) { + path = resource; + uri = IfHeader.this.uriPrefix + resource; + } else { + path = resource.substring(IfHeader.this.uriPrefix.length()); + uri = resource; + } + IfHeaderList list = get(path); + if (list == null) { + list = get(uri); + } if (list == null) { - log.debug("matches: No entry for tag "+resource+", assuming match"); - return true; + log.debug("matches: No entry for tag "+resource+", assuming mismatch"); + return false; } else { return list.matches(resource, token, etag); } diff --git a/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropContainer.java b/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropContainer.java index a86e55fea36..63d3b81be63 100644 --- a/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropContainer.java +++ b/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropContainer.java @@ -42,6 +42,7 @@ public abstract class PropContainer implements XmlSerializable, DavConstants { * @return true if the object could be added; false otherwise * @deprecated Use {@link #addContent(PropEntry)} instead. */ + @Deprecated public boolean addContent(Object contentEntry) { if (contentEntry instanceof PropEntry) { return addContent((PropEntry) contentEntry); diff --git a/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/version/WorkspaceResource.java b/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/version/WorkspaceResource.java index bfbbe5ff6e1..a5e6e309e28 100644 --- a/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/version/WorkspaceResource.java +++ b/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/version/WorkspaceResource.java @@ -56,6 +56,7 @@ public interface WorkspaceResource extends DeltaVResource { /** * @deprecated Use {@link #CURRENT_ACTIVITY_SET} instead. */ + @Deprecated public static final DavPropertyName CUURENT_ACTIVITY_SET = DavPropertyName.create("current-activity-set", DeltaVConstants.NAMESPACE); /** diff --git a/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java b/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java index 07a603fa5d6..86d19133a6a 100644 --- a/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java +++ b/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java @@ -736,6 +736,7 @@ public static Element hrefToXml(String href, Document factory) { * is called Expanded Name. * */ + @Deprecated public static String getQualifiedName(String localName, Namespace namespace) { return getExpandedName(localName, namespace); } diff --git a/pom.xml b/pom.xml index 57c7da2921d..178edb5b098 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ org.apache.jackrabbit jackrabbit-parent - 2.21.16-SNAPSHOT + 2.23.2-beta-SNAPSHOT jackrabbit-parent/pom.xml @@ -45,7 +45,6 @@ jackrabbit-core jackrabbit-webdav-project jackrabbit-jcr-server-project - jackrabbit-jcr-rmi jackrabbit-jcr-servlet-project jackrabbit-webapp-project jackrabbit-jca @@ -61,12 +60,6 @@ jackrabbit-it-osgi - - scm:svn:http://svn.apache.org/repos/asf/jackrabbit/trunk - scm:svn:https://svn.apache.org/repos/asf/jackrabbit/trunk - http://svn.apache.org/viewvc/jackrabbit/trunk - - @@ -170,7 +163,7 @@ A candidate for the Jackrabbit ${project.version} release is available at: The release candidate is a zip archive of the sources in: - https://svn.apache.org/repos/asf/jackrabbit/tags/jackrabbit-${project.version}/ + https://github.com/apache/jackrabbit/tree/${project.artifactId}-${project.version}/ The SHA1 checksum of the archive is ${checksum}. @@ -181,7 +174,7 @@ A staged Maven repository is available for review at: The command for running automated checks against this release candidate is: # run in SVN checkout of https://dist.apache.org/repos/dist/dev/jackrabbit/ - $ sh check-release.sh ${project.version} ${checksum} + $ sh check-release.sh jackrabbit ${project.version} ${checksum} Please vote on releasing this package as Apache Jackrabbit ${project.version}. The vote is open for the next 72 hours and passes if a majority of at diff --git a/test/performance/jackrabbit10/pom.xml b/test/performance/jackrabbit10/pom.xml deleted file mode 100644 index e30a5c818ef..00000000000 --- a/test/performance/jackrabbit10/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.jackrabbit - jackrabbit-perf-parent - 1-SNAPSHOT - ../parent/pom.xml - - - jackrabbit-perf-jackrabbit10 - Jackrabbit 1.0 Performance Test - - - - org.apache.jackrabbit - jackrabbit-perf-base - ${project.version} - test - - - org.apache.jackrabbit - jackrabbit-core - 1.0 - test - - - jsr170 - jcr - - - org.slf4j - slf4j-log4j12 - - - - - - - diff --git a/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java b/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java deleted file mode 100644 index 861fe48e062..00000000000 --- a/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.performance; - -import org.testng.annotations.Test; - -public class PerformanceTest extends AbstractPerformanceTest { - - @Test - public void testPerformance() throws Exception { - testPerformance("1.0"); - } - -} diff --git a/test/performance/jackrabbit11/pom.xml b/test/performance/jackrabbit11/pom.xml deleted file mode 100644 index d0c3c5d2d8f..00000000000 --- a/test/performance/jackrabbit11/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.jackrabbit - jackrabbit-perf-parent - 1-SNAPSHOT - ../parent/pom.xml - - - jackrabbit-perf-jackrabbit11 - Jackrabbit 1.1 Performance Test - - - - org.apache.jackrabbit - jackrabbit-perf-base - ${project.version} - test - - - org.apache.jackrabbit - jackrabbit-core - 1.1 - test - - - jsr170 - jcr - - - org.slf4j - slf4j-log4j12 - - - - - - - diff --git a/test/performance/jackrabbit11/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java b/test/performance/jackrabbit11/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java deleted file mode 100644 index 11a7ccebb50..00000000000 --- a/test/performance/jackrabbit11/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.performance; - -import org.testng.annotations.Test; - -public class PerformanceTest extends AbstractPerformanceTest { - - @Test - public void testPerformance() throws Exception { - testPerformance("1.1"); - } - -} diff --git a/test/performance/jackrabbit12/pom.xml b/test/performance/jackrabbit12/pom.xml deleted file mode 100644 index 9ff4fab9700..00000000000 --- a/test/performance/jackrabbit12/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.jackrabbit - jackrabbit-perf-parent - 1-SNAPSHOT - ../parent/pom.xml - - - jackrabbit-perf-jackrabbit12 - Jackrabbit 1.2 Performance Test - - - - org.apache.jackrabbit - jackrabbit-perf-base - ${project.version} - test - - - org.apache.jackrabbit - jackrabbit-core - 1.2.1 - test - - - org.slf4j - slf4j-log4j12 - - - - - - - diff --git a/test/performance/jackrabbit12/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java b/test/performance/jackrabbit12/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java deleted file mode 100644 index 76266ef8dd2..00000000000 --- a/test/performance/jackrabbit12/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.performance; - -import org.testng.annotations.Test; - -public class PerformanceTest extends AbstractPerformanceTest { - - @Test - public void testPerformance() throws Exception { - testPerformance("1.2"); - } - -} diff --git a/test/performance/jackrabbit13/pom.xml b/test/performance/jackrabbit13/pom.xml deleted file mode 100644 index 90b5dec10ea..00000000000 --- a/test/performance/jackrabbit13/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.jackrabbit - jackrabbit-perf-parent - 1-SNAPSHOT - ../parent/pom.xml - - - jackrabbit-perf-jackrabbit13 - Jackrabbit 1.3 Performance Test - - - - org.apache.jackrabbit - jackrabbit-perf-base - ${project.version} - test - - - org.apache.jackrabbit - jackrabbit-core - 1.3 - test - - - - - diff --git a/test/performance/jackrabbit13/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java b/test/performance/jackrabbit13/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java deleted file mode 100644 index fc4df262cac..00000000000 --- a/test/performance/jackrabbit13/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.performance; - -import org.testng.annotations.Test; - -public class PerformanceTest extends AbstractPerformanceTest { - - @Test - public void testPerformance() throws Exception { - testPerformance("1.3"); - } - -} diff --git a/test/performance/jackrabbit14/pom.xml b/test/performance/jackrabbit14/pom.xml deleted file mode 100644 index b28716fc3a6..00000000000 --- a/test/performance/jackrabbit14/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.jackrabbit - jackrabbit-perf-parent - 1-SNAPSHOT - ../parent/pom.xml - - - jackrabbit-perf-jackrabbit14 - Jackrabbit 1.4 Performance Test - - - - org.apache.jackrabbit - jackrabbit-perf-base - ${project.version} - test - - - org.apache.jackrabbit - jackrabbit-core - 1.4 - test - - - - - diff --git a/test/performance/jackrabbit14/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java b/test/performance/jackrabbit14/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java deleted file mode 100644 index ce7d671bc76..00000000000 --- a/test/performance/jackrabbit14/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.performance; - -import org.testng.annotations.Test; - -public class PerformanceTest extends AbstractPerformanceTest { - - @Test - public void testPerformance() throws Exception { - testPerformance("1.4"); - } - -} diff --git a/test/performance/jackrabbit15/pom.xml b/test/performance/jackrabbit15/pom.xml deleted file mode 100644 index 449540d756d..00000000000 --- a/test/performance/jackrabbit15/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.jackrabbit - jackrabbit-perf-parent - 1-SNAPSHOT - ../parent/pom.xml - - - jackrabbit-perf-jackrabbit15 - Jackrabbit 1.5 Performance Test - - - - org.apache.jackrabbit - jackrabbit-perf-base - ${project.version} - test - - - org.apache.jackrabbit - jackrabbit-core - 1.5.0 - test - - - - - diff --git a/test/performance/jackrabbit15/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java b/test/performance/jackrabbit15/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java deleted file mode 100644 index 6772594f499..00000000000 --- a/test/performance/jackrabbit15/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.performance; - -import org.testng.annotations.Test; - -public class PerformanceTest extends AbstractPerformanceTest { - - @Test - public void testPerformance() throws Exception { - testPerformance("1.5"); - } - -} diff --git a/test/performance/jackrabbit16/pom.xml b/test/performance/jackrabbit16/pom.xml deleted file mode 100644 index a3a3ad4f086..00000000000 --- a/test/performance/jackrabbit16/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.jackrabbit - jackrabbit-perf-parent - 1-SNAPSHOT - ../parent/pom.xml - - - jackrabbit-perf-jackrabbit16 - Jackrabbit 1.6 Performance Test - - - - org.apache.jackrabbit - jackrabbit-perf-base - ${project.version} - test - - - org.apache.jackrabbit - jackrabbit-core - 1.6.0 - test - - - - - diff --git a/test/performance/jackrabbit16/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java b/test/performance/jackrabbit16/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java deleted file mode 100644 index ecd3a86e52c..00000000000 --- a/test/performance/jackrabbit16/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package org.apache.jackrabbit.performance; - -import org.testng.annotations.Test; - -public class PerformanceTest extends AbstractPerformanceTest { - - @Test - public void testPerformance() throws Exception { - testPerformance("1.6"); - } - -} diff --git a/test/performance/pom.xml b/test/performance/pom.xml index 4a0330d27e2..177e9159ec3 100644 --- a/test/performance/pom.xml +++ b/test/performance/pom.xml @@ -41,13 +41,6 @@ parent base - jackrabbit20 jackrabbit21 jackrabbit22