You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2005/01/29 12:20:40 UTC
svn commit: r149025 - in incubator/jackrabbit/trunk: . contrib contrib/jcr-rmi contrib/jcr-rmi/src contrib/jcr-rmi/src/java contrib/jcr-rmi/src/java/org contrib/jcr-rmi/src/java/org/apache contrib/jcr-rmi/src/java/org/apache/jackrabbit contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml contrib/jcr-rmi/src/test contrib/jcr-rmi/src/test/org contrib/jcr-rmi/src/test/org/apache contrib/jcr-rmi/src/test/org/apache/jackrabbit contrib/jcr-rmi/src/test/org/apache/jackrabbit/test contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi
Author: stefan
Date: Sat Jan 29 03:20:38 2005
New Revision: 149025
URL: http://svn.apache.org/viewcvs?view=rev&rev=149025
Log:
adding jcr-rmi contributed by jukka
Added:
incubator/jackrabbit/trunk/contrib/
incubator/jackrabbit/trunk/contrib/jcr-rmi/ (props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/LICENSE.txt (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/maven.xml (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/project.properties
incubator/jackrabbit/trunk/contrib/jcr-rmi/project.xml (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientItem.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientItemDef.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientLock.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNamespaceRegistry.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNode.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeDef.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeType.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeTypeManager.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientObject.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientProperty.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientPropertyDef.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepository.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepositoryFactory.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientSession.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRepositoryException.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRuntimeException.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/package.html (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayIterator.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeIterator.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeTypeIterator.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayPropertyIterator.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/package.html (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteItem.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteItemDef.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNamespaceRegistry.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeDef.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeType.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeTypeManager.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteProperty.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemotePropertyDef.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteRepository.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteWorkspace.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/SerialValue.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/package.html (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItem.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItemDef.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerLock.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeDef.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerProperty.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerPropertyDef.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/package.html (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/ImportContentHandler.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/SessionImportContentHandler.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/WorkspaceImportContentHandler.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/package.html (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteItemDefTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteItemTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteLockTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNamespaceRegistryTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeDefTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTypeManagerTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTypeTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemotePropertyDefTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemotePropertyTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteRepositoryTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteSessionTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteTestHelper.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteWorkspaceTest.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java (contents, props changed)
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/package.html (contents, props changed)
Modified:
incubator/jackrabbit/trunk/project.xml
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/LICENSE.txt
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/LICENSE.txt?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/LICENSE.txt Sat Jan 29 03:20:38 2005
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/maven.xml
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/maven.xml?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/maven.xml Sat Jan 29 03:20:38 2005
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+ Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project>
+
+ <postGoal name="java:compile">
+ <rmic base="${maven.build.dest}" verify="true"
+ includes="org/apache/jackrabbit/rmi/server/Server*.class"
+ classpathref="maven.dependency.classpath"/>
+ </postGoal>
+
+</project>
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/project.properties
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/project.properties?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/project.properties Sat Jan 29 03:20:38 2005
@@ -0,0 +1,2 @@
+maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api/,http://www.day.com/maven/jsr170/javadocs/jcr-0.16.1-pfd/
+maven.repo.remote = http://www.ibiblio.org/maven/,http://www.day.com/maven/
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/project.xml
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/project.xml?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/project.xml Sat Jan 29 03:20:38 2005
@@ -0,0 +1,87 @@
+<?xml version="1.0"?>
+
+<!--
+ Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<project>
+ <pomVersion>2</pomVersion>
+ <id>jcr-rmi</id>
+ <name>JCR-RMI</name>
+ <currentVersion>0.16.2</currentVersion>
+ <inceptionYear>2004</inceptionYear>
+ <package>org.apache.jackrabbit.rmi.*</package>
+ <description>
+ JCR-RMI is an independent subproject of the Jackrabbit project. It
+ provides a transparent Remote Method Invocation (RMI) layer for the
+ Content Repository for Java Technology API (JCR). The JCR-RMI layer
+ makes it possible to access JCR content repositories across virtual
+ machine boundaries. Although implemented as a contribution to the
+ Jackrabbit project, the JCR-RMI layer is independent of the underlying
+ JCR repository implementation.
+ </description>
+ <shortDescription>Transparent RMI layer for the JCR API.</shortDescription>
+
+ <developers>
+ <developer>
+ <name>Jukka Zitting</name>
+ <id>jukkaz</id>
+ <email>jz@yukatan.fi</email>
+ <organization>Yukatan</organization>
+ <roles>
+ <role>Java Developer</role>
+ </roles>
+ <timezone>+2</timezone>
+ </developer>
+ </developers>
+
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>/LICENSE.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <dependencies>
+ <dependency>
+ <groupId>jsr170</groupId>
+ <artifactId>jcr</artifactId>
+ <version>0.16.2</version>
+ <url>http://www.day.com/maven/jsr170/jars/jcr-0.16.2.jar</url>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.6.2</version>
+ </dependency>
+ <dependency>
+ <id>easymock</id>
+ <version>1.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>src/java</sourceDirectory>
+ <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+ <unitTest>
+ <includes>
+ <include>**/*TestAll.java</include>
+ </includes>
+ </unitTest>
+ </build>
+
+</project>
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import javax.jcr.Item;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+import javax.jcr.lock.Lock;
+import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.nodetype.PropertyDef;
+
+import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteLock;
+import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+import org.apache.jackrabbit.rmi.remote.RemoteRepository;
+import org.apache.jackrabbit.rmi.remote.RemoteSession;
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+
+/**
+ * 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.
+ *
+ * @author Jukka Zitting
+ */
+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.
+ *
+ * {@inheritDoc}
+ */
+ public Session getSession(Repository repository, RemoteSession remote) {
+ 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 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 ClientNodeType ClientNodeType} instance.
+ *
+ * {@inheritDoc}
+ */
+ public NodeType getNodeType(RemoteNodeType remote) {
+ return new ClientNodeType(remote, this);
+ }
+
+ /**
+ * Creates and returns a {@link ClientNodeDef ClientNodeDef} instance.
+ *
+ * {@inheritDoc}
+ */
+ public NodeDef getNodeDef(RemoteNodeDef remote) {
+ return new ClientNodeDef(remote, this);
+ }
+
+ /**
+ * Creates and returns a {@link ClientPropertyDef ClientPropertyDef}
+ * instance.
+ *
+ * {@inheritDoc}
+ */
+ public PropertyDef getPropertyDef(RemotePropertyDef remote) {
+ return new ClientPropertyDef(remote, this);
+ }
+
+ /**
+ * Creates and returns a {@link ClientLock ClientLock} instance.
+ *
+ * {@inheritDoc}
+ */
+ public Lock getLock(Node node, RemoteLock remote) {
+ return new ClientLock(node, remote);
+ }
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientItem.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientItem.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientItem.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.Item;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.ItemVisitor;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.ReferentialIntegrityException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
+import org.apache.jackrabbit.rmi.remote.RemoteItem;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteItem RemoteItem}
+ * inteface. 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.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Item
+ * @see org.apache.jackrabbit.rmi.remote.RemoteItem
+ */
+public class ClientItem extends ClientObject implements Item {
+
+ /** Current session. */
+ protected 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 ItemNotFoundException,
+ AccessDeniedException, RepositoryException {
+ try {
+ return factory.getItem(session, remote.getAncestor(level));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Node getParent() throws ItemNotFoundException,
+ AccessDeniedException, RepositoryException {
+ try {
+ return factory.getNode(session, 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}
+ */
+ 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 <em>item paths</em> 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) {
+ if (item == null) {
+ return false;
+ } else if (equals(item)) {
+ return true;
+ } else if ((item instanceof Property) && !(this instanceof Property)) {
+ return false;
+ } else if ((item instanceof Node) && !(this instanceof Node)) {
+ return false;
+ } else {
+ try {
+ return getPath().equals(item.getPath());
+ } catch (RepositoryException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+
+ /**
+ * 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 AccessDeniedException, LockException,
+ ConstraintViolationException, InvalidItemStateException,
+ ReferentialIntegrityException, RepositoryException {
+ try {
+ remote.save();
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void refresh(boolean keepChanges) throws InvalidItemStateException,
+ 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);
+ }
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientItemDef.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientItemDef.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientItemDef.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.nodetype.ItemDef;
+import javax.jcr.nodetype.NodeType;
+
+import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteItemDef RemoteItemDef}
+ * inteface. This class makes a remote item definition locally available using
+ * the JCR {@link javax.jcr.nodetype.ItemDef ItemDef} interface. Used mainly
+ * as the base class for the
+ * {@link org.apache.jackrabbit.rmi.client.ClientPropertyDef ClientPropertyDef}
+ * and
+ * {@link org.apache.jackrabbit.rmi.client.ClientNodeDef ClientNodeDef} adapters.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.ItemDef
+ * @see org.apache.jackrabbit.rmi.remote.RemoteItemDef
+ */
+public class ClientItemDef extends ClientObject implements ItemDef {
+
+ /** The adapted remote item definition. */
+ private RemoteItemDef remote;
+
+ /**
+ * Creates a local adapter for the given remote item definition.
+ *
+ * @param remote remote item definition
+ * @param factory local adapter factory
+ */
+ public ClientItemDef(RemoteItemDef remote, LocalAdapterFactory factory) {
+ super(factory);
+ this.remote = remote;
+ }
+
+ /** {@inheritDoc} */
+ public NodeType getDeclaringNodeType() {
+ try {
+ return factory.getNodeType(remote.getDeclaringNodeType());
+ } 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 isAutoCreate() {
+ try {
+ return remote.isAutoCreate();
+ } 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);
+ }
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientLock.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientLock.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientLock.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.Lock;
+import javax.jcr.lock.LockException;
+
+import org.apache.jackrabbit.rmi.remote.RemoteLock;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteLock RemoteLock}
+ * inteface. This class makes a remote lock locally available using
+ * the JCR {@link javax.jcr.lock.Lock Lock} interface.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.lock.Lock
+ * @see org.apache.jackrabbit.rmi.remote.RemoteLock
+ */
+public class ClientLock implements Lock {
+
+ /** The current node. */
+ private Node node;
+
+ /** The adapted remote lock. */
+ private RemoteLock remote;
+
+ /**
+ * Creates a local adapter for the given remote lock.
+ *
+ * @param node current node
+ * @param remote remote lock
+ */
+ public ClientLock(Node node, RemoteLock remote) {
+ this.node = node;
+ this.remote = remote;
+ }
+
+ /**
+ * Returns the owning node without contacting the remote lock.
+ *
+ * {@inheritDoc}
+ */
+ public Node getNode() {
+ return node;
+ }
+
+ /** {@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() {
+ try {
+ return remote.isLive();
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void refresh() throws LockException, RepositoryException {
+ try {
+ remote.refresh();
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNamespaceRegistry.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNamespaceRegistry.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNamespaceRegistry.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.NamespaceException;
+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}
+ * inteface. This class makes a remote namespace registry locally available
+ * using the JCR {@link javax.jcr.NamespaceRegistry NamespaceRegistry}
+ * interface.
+ *
+ * @author Jukka Zitting
+ * @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 NamespaceException, RepositoryException {
+ try {
+ remote.registerNamespace(prefix, uri);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void unregisterNamespace(String prefix) throws NamespaceException,
+ 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 NamespaceException,
+ RepositoryException {
+ try {
+ return remote.getURI(prefix);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public String getPrefix(String uri) throws NamespaceException,
+ RepositoryException {
+ try {
+ return remote.getPrefix(uri);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNode.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNode.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNode.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,623 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.io.InputStream;
+import java.rmi.RemoteException;
+import java.util.Calendar;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.BinaryValue;
+import javax.jcr.BooleanValue;
+import javax.jcr.DateValue;
+import javax.jcr.DoubleValue;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.Item;
+import javax.jcr.ItemExistsException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.ItemVisitor;
+import javax.jcr.LongValue;
+import javax.jcr.MergeException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.ReferenceValue;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.StringValue;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+import javax.jcr.lock.Lock;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionException;
+import javax.jcr.version.VersionHistory;
+
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+import org.apache.jackrabbit.rmi.remote.SerialValue;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteNode RemoteNode}
+ * inteface. This class makes a remote node locally available using
+ * the JCR {@link javax.jcr.Node Node} interface.
+ *
+ * @author Jukka Zitting
+ * @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 <code>true</code> 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 ItemExistsException,
+ PathNotFoundException, ConstraintViolationException,
+ RepositoryException {
+ try {
+ return factory.getNode(session, remote.addNode(path));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Node addNode(String path, String type) throws ItemExistsException,
+ PathNotFoundException, NoSuchNodeTypeException,
+ ConstraintViolationException, RepositoryException {
+ try {
+ return factory.getNode(session, remote.addNode(path, type));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void orderBefore(String src, String dst) throws
+ UnsupportedRepositoryOperationException,
+ ConstraintViolationException, ItemNotFoundException,
+ RepositoryException {
+ try {
+ remote.orderBefore(src, dst);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, Value value)
+ throws ValueFormatException, RepositoryException {
+ try {
+ return factory.getProperty(
+ session, remote.setProperty(name, new SerialValue(value)));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, Value[] values)
+ throws ValueFormatException, RepositoryException {
+ try {
+ Value[] serials = SerialValue.makeSerialValueArray(values);
+ RemoteProperty property = remote.setProperty(name, serials);
+ return factory.getProperty(session, property);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, String[] strings)
+ throws ValueFormatException, RepositoryException {
+ Value[] values = new Value[strings.length];
+ for (int i = 0; i < strings.length; i++) {
+ values[i] = new StringValue(strings[i]);
+ }
+ return setProperty(name, values);
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, String value)
+ throws ValueFormatException, RepositoryException {
+ return setProperty(name, new StringValue(value));
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, InputStream value)
+ throws ValueFormatException, RepositoryException {
+ return setProperty(name, new BinaryValue(value));
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, boolean value)
+ throws ValueFormatException, RepositoryException {
+ return setProperty(name, new BooleanValue(value));
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, double value)
+ throws ValueFormatException, RepositoryException {
+ return setProperty(name, new DoubleValue(value));
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, long value)
+ throws ValueFormatException, RepositoryException {
+ return setProperty(name, new LongValue(value));
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, Calendar value)
+ throws ValueFormatException, RepositoryException {
+ return setProperty(name, new DateValue(value));
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, Node value)
+ throws ValueFormatException, RepositoryException {
+ return setProperty(name, new ReferenceValue(value));
+ }
+
+ /** {@inheritDoc} */
+ public Node getNode(String path) throws PathNotFoundException,
+ RepositoryException {
+ try {
+ return factory.getNode(session, remote.getNode(path));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public NodeIterator getNodes() throws RepositoryException {
+ try {
+ return getNodeIterator(session, remote.getNodes());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public NodeIterator getNodes(String pattern) throws RepositoryException {
+ try {
+ return getNodeIterator(session, remote.getNodes(pattern));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Property getProperty(String path) throws PathNotFoundException,
+ RepositoryException {
+ try {
+ return factory.getProperty(session, remote.getProperty(path));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public PropertyIterator getProperties() throws RepositoryException {
+ try {
+ return getPropertyIterator(session, remote.getProperties());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public PropertyIterator getProperties(String pattern) throws
+ RepositoryException {
+ try {
+ return getPropertyIterator(session, remote.getProperties(pattern));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Item getPrimaryItem() throws ItemNotFoundException,
+ RepositoryException {
+ try {
+ return factory.getItem(session, remote.getPrimaryItem());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public String getUUID() throws UnsupportedRepositoryOperationException,
+ RepositoryException {
+ try {
+ return remote.getUUID();
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public PropertyIterator getReferences() throws RepositoryException {
+ try {
+ return getPropertyIterator(session, remote.getReferences());
+ } 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 factory.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 NoSuchNodeTypeException,
+ ConstraintViolationException, RepositoryException {
+ try {
+ remote.addMixin(name);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void removeMixin(String name) throws NoSuchNodeTypeException,
+ ConstraintViolationException, 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 NodeDef getDefinition() throws RepositoryException {
+ try {
+ return factory.getNodeDef(remote.getDefinition());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Version checkin() throws VersionException,
+ UnsupportedRepositoryOperationException, RepositoryException {
+ // TODO Auto-generated method stub
+ // return null;
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ public void checkout() throws UnsupportedRepositoryOperationException,
+ RepositoryException {
+ try {
+ remote.checkout();
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void update(String workspace) throws NoSuchWorkspaceException,
+ AccessDeniedException, RepositoryException {
+ try {
+ remote.update(workspace);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void merge(String workspace, boolean bestEffort) throws
+ UnsupportedRepositoryOperationException, NoSuchWorkspaceException,
+ AccessDeniedException, MergeException, RepositoryException {
+ try {
+ remote.merge(workspace, bestEffort);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void cancelMerge(Version version) throws VersionException,
+ InvalidItemStateException, UnsupportedRepositoryOperationException,
+ RepositoryException {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ public void doneMerge(Version version) throws VersionException,
+ InvalidItemStateException, UnsupportedRepositoryOperationException,
+ RepositoryException {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ public String getCorrespondingNodePath(String workspace) throws
+ ItemNotFoundException, NoSuchWorkspaceException,
+ AccessDeniedException, 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
+ VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ InvalidItemStateException, RepositoryException {
+ try {
+ remote.restore(version, removeExisting);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void restore(Version version, boolean removeExisting) throws
+ VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ RepositoryException {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ public void restore(Version version, String path, boolean removeExisting)
+ throws PathNotFoundException, ItemExistsException,
+ VersionException, ConstraintViolationException,
+ UnsupportedRepositoryOperationException, LockException,
+ InvalidItemStateException, RepositoryException {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ public void restoreByLabel(String label, boolean removeExisting) throws
+ VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ InvalidItemStateException, RepositoryException {
+ try {
+ remote.restoreByLabel(label, removeExisting);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, String[] strings, int type)
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
+ Value[] values = new Value[strings.length];
+ for (int i = 0; i < strings.length; i++) {
+ values[i] = new StringValue(strings[i]);
+ }
+ return setProperty(name, values, type);
+ }
+
+ /** {@inheritDoc} */
+ public Property setProperty(String name, Value[] values, int type)
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException {
+ try {
+ Value[] serials = SerialValue.makeSerialValueArray(values);
+ RemoteProperty property = remote.setProperty(name, serials, type);
+ return factory.getProperty(session, property);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public boolean isCheckedOut() throws
+ UnsupportedRepositoryOperationException, RepositoryException {
+ try {
+ return remote.isCheckedOut();
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public VersionHistory getVersionHistory()
+ throws UnsupportedRepositoryOperationException, RepositoryException {
+ // TODO Auto-generated method stub
+ // return null;
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ public Version getBaseVersion()
+ throws UnsupportedRepositoryOperationException, RepositoryException {
+ // TODO Auto-generated method stub
+ // return null;
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ public Lock lock(boolean isDeep, boolean isSessionScoped)
+ throws UnsupportedRepositoryOperationException, LockException,
+ AccessDeniedException, RepositoryException {
+ try {
+ return factory.getLock(this, remote.lock(isDeep, isSessionScoped));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Lock getLock() throws UnsupportedRepositoryOperationException,
+ LockException, AccessDeniedException, RepositoryException {
+ try {
+ return factory.getLock(this, remote.getLock());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void unlock() throws UnsupportedRepositoryOperationException,
+ LockException, AccessDeniedException, 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);
+ }
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeDef.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeDef.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeDef.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeType;
+
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeDef RemoteNodeDef}
+ * inteface. This class makes a remote node definition locally available using
+ * the JCR {@link javax.jcr.nodetype.NodeDef NodeDef} interface.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.NodeDef
+ * @see org.apache.jackrabbit.rmi.remote.RemoteNodeDef
+ */
+public class ClientNodeDef extends ClientItemDef implements NodeDef {
+
+ /** The adapted remote node definition. */
+ private RemoteNodeDef remote;
+
+ /**
+ * Creates a local adapter for the given remote node definition.
+ *
+ * @param remote remote node definition
+ * @param factory local adapter factory
+ */
+ public ClientNodeDef(RemoteNodeDef 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 {
+ return factory.getNodeType(remote.getDefaultPrimaryType());
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public boolean allowSameNameSibs() {
+ try {
+ return remote.allowSameNameSibs();
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeType.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeType.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeType.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Value;
+import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.PropertyDef;
+
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.remote.SerialValue;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeType RemoteNodeType}
+ * inteface. This class makes a remote node type locally available using
+ * the JCR {@link javax.jcr.nodetype.NodeType NodeType} interface.
+ *
+ * @author Jukka Zitting
+ * @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;
+ }
+
+ /** {@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 PropertyDef[] getPropertyDefs() {
+ try {
+ return getPropertyDefArray(remote.getPropertyDefs());
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public PropertyDef[] getDeclaredPropertyDefs() {
+ try {
+ return getPropertyDefArray(remote.getDeclaredPropertyDefs());
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public NodeDef[] getChildNodeDefs() {
+ try {
+ RemoteNodeDef[] defs = remote.getChildNodeDefs();
+ return getNodeDefArray(defs);
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public NodeDef[] getDeclaredChildNodeDefs() {
+ try {
+ RemoteNodeDef[] defs = remote.getDeclaredChildNodeDefs();
+ return getNodeDefArray(defs);
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public boolean canSetProperty(String name, Value value) {
+ try {
+ return remote.canSetProperty(name, new SerialValue(value));
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public boolean canSetProperty(String name, Value[] values) {
+ try {
+ Value[] serials = SerialValue.makeSerialValueArray(values);
+ return remote.canSetProperty(name, serials);
+ } 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);
+ }
+ }
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeTypeManager.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeTypeManager.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientNodeTypeManager.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.NodeTypeManager;
+
+import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager RemoteNodeTypeManager}
+ * inteface. This class makes a remote node type manager locally available
+ * using the JCR {@link javax.jcr.nodetype.NodeTypeManager NodeTypeManager}
+ * interface.
+ *
+ * @author Jukka Zitting
+ * @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 NoSuchNodeTypeException,
+ RepositoryException {
+ try {
+ return factory.getNodeType(remote.getNodeType(name));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public NodeTypeIterator getAllNodeTypes() throws RepositoryException {
+ try {
+ return getNodeTypeIterator(remote.getAllNodeTypes());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public NodeTypeIterator getPrimaryNodeTypes() throws RepositoryException {
+ try {
+ return getNodeTypeIterator(remote.getPrimaryNodeTypes());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public NodeTypeIterator getMixinNodeTypes() throws RepositoryException {
+ try {
+ return getNodeTypeIterator(remote.getMixinNodeTypes());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientObject.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientObject.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientObject.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,212 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import javax.jcr.Item;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.Session;
+import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.PropertyDef;
+
+import org.apache.jackrabbit.rmi.iterator.ArrayNodeIterator;
+import org.apache.jackrabbit.rmi.iterator.ArrayNodeTypeIterator;
+import org.apache.jackrabbit.rmi.iterator.ArrayPropertyIterator;
+import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+
+/**
+ * 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.
+ *
+ * @author Jukka Zitting
+ */
+public class ClientObject {
+
+ /** Local adapter factory. */
+ protected 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;
+ }
+
+ /**
+ * Utility method to create a local adapter for a remote item.
+ * This method introspects the remote reference to determine
+ * whether to instantiate a {@link Property Property},
+ * a {@link Node Node}, or an {@link Item Item} adapter using
+ * the local adapter factory.
+ *
+ * @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 factory.getNode(session, (RemoteNode) remote);
+ } else {
+ return factory.getItem(session, remote);
+ }
+ }
+
+ /**
+ * Utility method for creating a property iterator for an array
+ * of remote properties. The properties in the returned iterator
+ * are created using the local adapter factory.
+ * <p>
+ * A <code>null</code> input is treated as an empty array.
+ *
+ * @param session current session
+ * @param remotes remote properties
+ * @return local property iterator
+ */
+ protected PropertyIterator getPropertyIterator(
+ Session session, RemoteProperty[] remotes) {
+ if (remotes == null) {
+ return new ArrayPropertyIterator(new Property[0]); // for safety
+ }
+
+ Property[] properties = new Property[remotes.length];
+ for (int i = 0; i < remotes.length; i++) {
+ properties[i] = factory.getProperty(session, remotes[i]);
+ }
+ return new ArrayPropertyIterator(properties);
+ }
+
+ /**
+ * Utility method for creating a node iterator for an array
+ * of remote nodes. The nodes in the returned iterator
+ * are created using the local adapter factory.
+ * <p>
+ * A <code>null</code> input is treated as an empty array.
+ *
+ * @param session current session
+ * @param remotes remote nodes
+ * @return local node iterator
+ */
+ protected NodeIterator getNodeIterator(
+ Session session, RemoteNode[] remotes) {
+ if (remotes == null) {
+ return new ArrayNodeIterator(new Node[0]); // for safety
+ }
+
+ Node[] nodes = new Node[remotes.length];
+ for (int i = 0; i < remotes.length; i++) {
+ nodes[i] = factory.getNode(session, remotes[i]);
+ }
+ return new ArrayNodeIterator(nodes);
+ }
+
+ /**
+ * 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.
+ * <p>
+ * A <code>null</code> 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) {
+ return new NodeType[0]; // for safety
+ }
+
+ NodeType[] types = new NodeType[remotes.length];
+ for (int i = 0; i < remotes.length; i++) {
+ types[i] = factory.getNodeType(remotes[i]);
+ }
+ return types;
+ }
+
+ /**
+ * Utility method for creating an iterator of local node type adapters
+ * for an array of remote node types. The node type adapters are created
+ * using the local adapter factory.
+ * <p>
+ * A <code>null</code> input is treated as an empty array.
+ *
+ * @param remotes remote node types
+ * @return local node type iterator
+ */
+ protected NodeTypeIterator getNodeTypeIterator(RemoteNodeType[] remotes) {
+ return new ArrayNodeTypeIterator(getNodeTypeArray(remotes));
+ }
+
+ /**
+ * 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.
+ * <p>
+ * A <code>null</code> input is treated as an empty array.
+ *
+ * @param remotes remote node definitions
+ * @return local node definition array
+ */
+ protected NodeDef[] getNodeDefArray(RemoteNodeDef[] remotes) {
+ if (remotes == null) {
+ return new NodeDef[0]; // for safety
+ }
+
+ NodeDef[] defs = new NodeDef[remotes.length];
+ for (int i = 0; i < remotes.length; i++) {
+ defs[i] = factory.getNodeDef(remotes[i]);
+ }
+ return defs;
+ }
+
+ /**
+ * 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.
+ * <p>
+ * A <code>null</code> input is treated as an empty array.
+ *
+ * @param remotes remote property definitions
+ * @return local property definition array
+ */
+ protected PropertyDef[] getPropertyDefArray(RemotePropertyDef[] remotes) {
+ if (remotes == null) {
+ return new PropertyDef[0]; // for safety
+ }
+
+ PropertyDef[] defs = new PropertyDef[remotes.length];
+ for (int i = 0; i < remotes.length; i++) {
+ defs[i] = factory.getPropertyDef(remotes[i]);
+ }
+ return defs;
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientProperty.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientProperty.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientProperty.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,319 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.io.InputStream;
+import java.rmi.RemoteException;
+import java.util.Calendar;
+
+import javax.jcr.BinaryValue;
+import javax.jcr.BooleanValue;
+import javax.jcr.DateValue;
+import javax.jcr.DoubleValue;
+import javax.jcr.ItemVisitor;
+import javax.jcr.LongValue;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.ReferenceValue;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.StringValue;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+import javax.jcr.nodetype.PropertyDef;
+
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+import org.apache.jackrabbit.rmi.remote.SerialValue;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteProperty RemoteProperty}
+ * inteface. This class makes a remote property locally available using
+ * the JCR {@link javax.jcr.Property Property} interface.
+ *
+ * @author Jukka Zitting
+ * @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 ValueFormatException,
+ RepositoryException {
+ return getValue().getBoolean();
+ }
+
+ /**
+ * Returns the date value of this property. Implemented as
+ * getValue().getDate().
+ *
+ * {@inheritDoc}
+ */
+ public Calendar getDate() throws ValueFormatException, RepositoryException {
+ return getValue().getDate();
+ }
+
+ /**
+ * Returns the double value of this property. Implemented as
+ * getValue().getDouble().
+ *
+ * {@inheritDoc}
+ */
+ public double getDouble() throws ValueFormatException, RepositoryException {
+ return getValue().getDouble();
+ }
+
+ /**
+ * Returns the long value of this property. Implemented as
+ * getValue().getLong().
+ *
+ * {@inheritDoc}
+ */
+ public long getLong() throws ValueFormatException, RepositoryException {
+ return getValue().getLong();
+ }
+
+ /**
+ * Returns the binary value of this property. Implemented as
+ * getValue().getStream().
+ *
+ * {@inheritDoc}
+ */
+ public InputStream getStream() throws ValueFormatException,
+ RepositoryException {
+ return getValue().getStream();
+ }
+
+ /**
+ * Returns the string value of this property. Implemented as
+ * getValue().getString().
+ *
+ * {@inheritDoc}
+ */
+ public String getString() throws ValueFormatException, RepositoryException {
+ return getValue().getString();
+ }
+
+ /** {@inheritDoc} */
+ public Value getValue() throws ValueFormatException, RepositoryException {
+ try {
+ return remote.getValue();
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Value[] getValues() throws ValueFormatException, 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 ValueFormatException,
+ RepositoryException {
+ setValue(new BooleanValue(value));
+ }
+
+ /**
+ * Sets the date value of this property. Implemented as
+ * setValue(new DateValue(value)).
+ *
+ * {@inheritDoc}
+ */
+ public void setValue(Calendar value) throws ValueFormatException,
+ RepositoryException {
+ setValue(new DateValue(value));
+ }
+
+ /**
+ * Sets the double value of this property. Implemented as
+ * setValue(new DoubleValue(value)).
+ *
+ * {@inheritDoc}
+ */
+ public void setValue(double value) throws ValueFormatException,
+ RepositoryException {
+ setValue(new DoubleValue(value));
+ }
+
+ /**
+ * Sets the binary value of this property. Implemented as
+ * setValue(new BinaryValue(value)).
+ *
+ * {@inheritDoc}
+ */
+ public void setValue(InputStream value) throws ValueFormatException,
+ RepositoryException {
+ setValue(new BinaryValue(value));
+ }
+
+ /**
+ * Sets the long value of this property. Implemented as
+ * setValue(new LongValue(value)).
+ *
+ * {@inheritDoc}
+ */
+ public void setValue(long value) throws ValueFormatException,
+ RepositoryException {
+ setValue(new LongValue(value));
+ }
+
+ /**
+ * Sets the reference value of this property. Implemented as
+ * setValue(new ReferenceValue(value)).
+ *
+ * {@inheritDoc}
+ */
+ public void setValue(Node value) throws ValueFormatException,
+ RepositoryException {
+ setValue(new ReferenceValue(value));
+ }
+
+ /**
+ * Sets the string value of this property. Implemented as
+ * setValue(new StringValue(value)).
+ *
+ * {@inheritDoc}
+ */
+ public void setValue(String value) throws ValueFormatException,
+ RepositoryException {
+ setValue(new StringValue(value));
+ }
+
+ /**
+ * Sets the string values of this property. Implemented as
+ * setValue(new Value[] { new StringValue(strings[0]), ... }).
+ *
+ * {@inheritDoc}
+ */
+ public void setValue(String[] strings) throws ValueFormatException,
+ RepositoryException {
+ Value[] values = new Value[strings.length];
+ for (int i = 0; i < strings.length; i++) {
+ values[i] = new StringValue(strings[i]);
+ }
+ setValue(values);
+ }
+
+ /** {@inheritDoc} */
+ public void setValue(Value value) throws ValueFormatException,
+ RepositoryException {
+ try {
+ remote.setValue(new SerialValue(value));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void setValue(Value[] values) throws ValueFormatException,
+ RepositoryException {
+ try {
+ remote.setValue(SerialValue.makeSerialValueArray(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 ValueFormatException, RepositoryException {
+ return getSession().getNodeByUUID(getString());
+ }
+
+ /** {@inheritDoc} */
+ public long getLength() throws ValueFormatException, RepositoryException {
+ try {
+ return remote.getLength();
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public long[] getLengths() throws ValueFormatException, RepositoryException {
+ try {
+ return remote.getLengths();
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public PropertyDef getDefinition() throws RepositoryException {
+ try {
+ return factory.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);
+ }
+ }
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientPropertyDef.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientPropertyDef.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientPropertyDef.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Value;
+import javax.jcr.nodetype.PropertyDef;
+
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemotePropertyDef RemotePropertyDef}
+ * inteface. This class makes a remote property definition locally available
+ * using the JCR {@link javax.jcr.nodetype.PropertyDef PropertyDef} interface.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.PropertyDef
+ * @see org.apache.jackrabbit.rmi.remote.RemotePropertyDef
+ */
+public class ClientPropertyDef extends ClientItemDef implements PropertyDef {
+
+ /** The adapted remote property. */
+ private RemotePropertyDef remote;
+
+ /**
+ * Creates a local adapter for the given remote property definition.
+ *
+ * @param remote remote property definition
+ * @param factory local adapter factory
+ */
+ public ClientPropertyDef(RemotePropertyDef 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);
+ }
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepository.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepository.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepository.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Credentials;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.jackrabbit.rmi.remote.RemoteRepository;
+import org.apache.jackrabbit.rmi.remote.RemoteSession;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteRepository RemoteRepository}
+ * inteface. This class makes a remote repository locally available using
+ * the JCR {@link javax.jcr.Repository Repository} interface.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Repository
+ * @see org.apache.jackrabbit.rmi.remote.RemoteRepository
+ */
+public class ClientRepository extends ClientObject implements Repository {
+
+ /** The adapted remote repository. */
+ private RemoteRepository remote;
+
+ /**
+ * Creates a client adapter for the given remote repository.
+ *
+ * @param remote remote repository
+ * @param factory local adapter factory
+ */
+ public ClientRepository(
+ RemoteRepository remote, LocalAdapterFactory factory) {
+ super(factory);
+ this.remote = remote;
+ }
+
+ /** {@inheritDoc} */
+ public String getDescriptor(String name) {
+ try {
+ return remote.getDescriptor(name);
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public String[] getDescriptorKeys() {
+ try {
+ return remote.getDescriptorKeys();
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Session login() throws LoginException, NoSuchWorkspaceException,
+ RepositoryException {
+ try {
+ RemoteSession session = remote.login();
+ return factory.getSession(this, session);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Session login(String workspace) throws LoginException,
+ NoSuchWorkspaceException, RepositoryException {
+ try {
+ RemoteSession session = remote.login(workspace);
+ return factory.getSession(this, session);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Session login(Credentials credentials) throws LoginException,
+ NoSuchWorkspaceException, RepositoryException {
+ try {
+ RemoteSession session = remote.login(credentials);
+ return factory.getSession(this, session);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Session login(Credentials credentials, String workspace) throws
+ LoginException, NoSuchWorkspaceException, RepositoryException {
+ try {
+ RemoteSession session = remote.login(credentials, workspace);
+ return factory.getSession(this, session);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepositoryFactory.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepositoryFactory.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientRepositoryFactory.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.net.MalformedURLException;
+import java.rmi.Naming;
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.jcr.Repository;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+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.
+ *
+ * @author Jukka Zitting
+ * @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";
+
+ /**
+ * Cache for repository references.
+ */
+ private Map repositories;
+
+ /**
+ * 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.repositories = new HashMap();
+ 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 and
+ * wrapped into a {@link ClientRepository ClientRepository} adapter.
+ * <p>
+ * The repository references are cached so that only one client instance
+ * (per factory) exists for each remote repository.
+ *
+ * @param url the RMI URL of the remote repository
+ * @return repository client
+ * @throws ClassCastException if the URL points to an unknown object
+ * @throws MalformedURLException if the URL is malformed
+ * @throws NotBoundException if the URL points to nowhere
+ * @throws RemoteException on RMI errors
+ */
+ public synchronized Repository getRepository(String url) throws
+ ClassCastException, MalformedURLException,
+ NotBoundException, RemoteException {
+ Repository repository = (Repository) repositories.get(url);
+ if (repository == null) {
+ RemoteRepository remote = (RemoteRepository) Naming.lookup(url);
+ repository = factory.getRepository(remote);
+ repositories.put(url, repository);
+ }
+ return repository;
+ }
+
+ /**
+ * Utility method for looking up the URL within the given RefAddr object.
+ * Feeds the content of the RefAddr object to
+ * {@link #getRepository(String) getRepository(String)} and wraps all
+ * errors to {@link NamingException NamingExceptions}.
+ * <p>
+ * Used by {@link #getObjectInstance(Object, Name, Context, Hashtable) getObjectInstance()}.
+ *
+ * @param url the URL reference
+ * @return repository client
+ * @throws NamingException on all errors
+ */
+ private Repository getRepository(RefAddr url) throws NamingException {
+ try {
+ return getRepository((String) url.getContent());
+ } catch (Exception ex) {
+ throw new NamingException(ex.getMessage());
+ }
+ }
+
+ /**
+ * JNDI factory method for creating JCR-RMI clients. Looks up a
+ * remote repository using the reference parameter "url" as the RMI URL
+ * and returns a client wrapper for the remote repository.
+ *
+ * @param object reference parameters
+ * @param name unused
+ * @param context unused
+ * @param environment unused
+ * @return repository client
+ * @throws NamingException on all errors
+ */
+ public Object getObjectInstance(
+ Object object, Name name, Context context, Hashtable environment)
+ throws NamingException {
+ if (object instanceof Reference) {
+ Reference reference = (Reference) object;
+ if (Repository.class.getName().equals(reference.getClassName())) {
+ RefAddr url = reference.get(URL_PARAMETER);
+ if (url != null) {
+ return getRepository(url);
+ }
+ }
+ }
+ return null;
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientSession.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientSession.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientSession.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,435 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.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.AccessDeniedException;
+import javax.jcr.Credentials;
+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.NamespaceException;
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+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.xml.SessionImportContentHandler;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteSession RemoteSession}
+ * inteface. This class makes a remote session locally available using
+ * the JCR {@link javax.jcr.Session Session} interface.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Session
+ * @see org.apache.jackrabbit.rmi.remote.RemoteSession
+ */
+public class ClientSession extends ClientObject implements Session {
+
+ /** The current repository. */
+ private Repository repository;
+
+ /** The adapted remote session. */
+ private RemoteSession remote;
+
+ /**
+ * 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() {
+ try {
+ return factory.getWorkspace(this, remote.getWorkspace());
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Session impersonate(Credentials credentials) throws
+ LoginException, RepositoryException {
+ try {
+ RemoteSession session = remote.impersonate(credentials);
+ return factory.getSession(repository, session);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Node getRootNode() throws RepositoryException {
+ try {
+ return factory.getNode(this, remote.getRootNode());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Node getNodeByUUID(String uuid) throws ItemNotFoundException,
+ RepositoryException {
+ try {
+ return factory.getNode(this, remote.getNodeByUUID(uuid));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public Item getItem(String path) throws PathNotFoundException,
+ RepositoryException {
+ try {
+ return factory.getItem(this, remote.getItem(path));
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public boolean itemExists(String path) {
+ try {
+ return remote.itemExists(path);
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void move(String from, String to) throws ItemExistsException,
+ PathNotFoundException, ConstraintViolationException,
+ RepositoryException {
+ try {
+ remote.move(from, to);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void save() throws AccessDeniedException, LockException,
+ ConstraintViolationException, InvalidItemStateException,
+ 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);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void checkPermission(String path, String actions)
+ throws AccessControlException {
+ try {
+ remote.checkPermission(path, actions);
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void importXML(String path, InputStream xml) throws IOException,
+ PathNotFoundException, ItemExistsException,
+ ConstraintViolationException, InvalidSerializedDataException,
+ 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());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public ContentHandler getImportContentHandler(String path) throws
+ PathNotFoundException, RepositoryException {
+ return new SessionImportContentHandler(this, path);
+ }
+
+ /** {@inheritDoc} */
+ public void setNamespacePrefix(String prefix, String uri) throws
+ NamespaceException, 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 NamespaceException,
+ RepositoryException {
+ try {
+ return remote.getNamespaceURI(prefix);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public String getNamespacePrefix(String uri) throws NamespaceException,
+ RepositoryException {
+ try {
+ return remote.getNamespacePrefix(uri);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void logout() {
+ try {
+ remote.logout();
+ } catch (RemoteException ex) {
+ throw new RemoteRuntimeException(ex);
+ }
+ }
+
+ /** {@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 exportSysView(String path, ContentHandler handler,
+ boolean binaryAsLink, boolean noRecurse) throws
+ PathNotFoundException, SAXException, RepositoryException {
+ try {
+ byte[] xml = remote.exportSysView(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 exportSysView(String path, OutputStream output,
+ boolean binaryAsLink, boolean noRecurse) throws
+ PathNotFoundException, IOException, RepositoryException {
+ try {
+ byte[] xml = remote.exportSysView(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 exportDocView(String path, ContentHandler handler,
+ boolean binaryAsLink, boolean noRecurse) throws
+ InvalidSerializedDataException, PathNotFoundException,
+ SAXException, RepositoryException {
+ try {
+ byte[] xml = remote.exportDocView(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 exportDocView(String path, OutputStream output,
+ boolean binaryAsLink, boolean noRecurse) throws
+ InvalidSerializedDataException, PathNotFoundException,
+ IOException, RepositoryException {
+ try {
+ byte[] xml = remote.exportDocView(path, binaryAsLink, noRecurse);
+ output.write(xml);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,220 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.rmi.RemoteException;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.InvalidSerializedDataException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Workspace;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.observation.ObservationManager;
+import javax.jcr.query.QueryManager;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionException;
+
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+import org.apache.jackrabbit.rmi.xml.WorkspaceImportContentHandler;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Local adapter for the JCR-RMI
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteWorkspace RemoteWorkspace}
+ * inteface. This class makes a remote workspace locally available using
+ * the JCR {@link javax.jcr.Workspace Workspace} interface.
+ *
+ * @author Jukka Zitting
+ * @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;
+
+ /**
+ * 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
+ ConstraintViolationException, AccessDeniedException,
+ PathNotFoundException, ItemExistsException, RepositoryException {
+ try {
+ remote.copy(from, to);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void copy(String from, String to, String workspace) throws
+ NoSuchWorkspaceException, ConstraintViolationException,
+ AccessDeniedException, PathNotFoundException, ItemExistsException,
+ RepositoryException {
+ try {
+ remote.copy(from, to, workspace);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void move(String from, String to) throws
+ ConstraintViolationException, AccessDeniedException,
+ PathNotFoundException, ItemExistsException, RepositoryException {
+ try {
+ remote.move(from, to);
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public QueryManager getQueryManager() throws RepositoryException {
+ // TODO Auto-generated method stub
+ // return null;
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ public NamespaceRegistry getNamespaceRegistry() throws RepositoryException {
+ try {
+ return factory.getNamespaceRegistry(remote.getNamespaceRegistry());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public NodeTypeManager getNodeTypeManager() throws RepositoryException {
+ try {
+ return factory.getNodeTypeManager(remote.getNodeTypeManager());
+ } catch (RemoteException ex) {
+ throw new RemoteRepositoryException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public ObservationManager getObservationManager()
+ throws UnsupportedRepositoryOperationException, RepositoryException {
+ // TODO Auto-generated method stub
+ // return null;
+ throw new UnsupportedOperationException();
+ }
+
+
+ /** {@inheritDoc} */
+ public void clone(String workspace, String src, String dst,
+ boolean removeExisting) throws NoSuchWorkspaceException,
+ ConstraintViolationException, VersionException,
+ AccessDeniedException, PathNotFoundException, ItemExistsException,
+ LockException, 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(String path,
+ int uuidBehaviour) throws PathNotFoundException,
+ ConstraintViolationException, VersionException, LockException,
+ RepositoryException {
+ return new WorkspaceImportContentHandler(this, path, uuidBehaviour);
+ }
+
+ /** {@inheritDoc} */
+ public void importXML(String path, InputStream xml, int uuidBehaviour)
+ throws IOException, PathNotFoundException, ItemExistsException,
+ ConstraintViolationException, InvalidSerializedDataException,
+ LockException, 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);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void restore(Version[] versions, boolean removeExisting) throws
+ ItemExistsException, UnsupportedRepositoryOperationException,
+ VersionException, LockException, InvalidItemStateException,
+ RepositoryException {
+ // TODO Auto-generated method stub
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,178 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.client;
+
+import javax.jcr.Item;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+import javax.jcr.lock.Lock;
+import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.nodetype.PropertyDef;
+
+import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteLock;
+import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+import org.apache.jackrabbit.rmi.remote.RemoteRepository;
+import org.apache.jackrabbit.rmi.remote.RemoteSession;
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+
+/**
+ * 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.
+ * <p>
+ * 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.
+ *
+ * @author Jukka Zitting
+ * @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
+ */
+ public 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
+ */
+ public 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
+ */
+ public Workspace getWorkspace(Session session, RemoteWorkspace remote);
+
+ /**
+ * Factory method for creating a local adapter for a remote namespace
+ * registry.
+ *
+ * @param remote remote namespace registry
+ * @return local namespace registry adapter
+ */
+ public 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
+ */
+ public 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
+ */
+ public 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
+ */
+ public 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
+ */
+ public Node getNode(Session session, RemoteNode remote);
+
+ /**
+ * Factory method for creating a local adapter for a remote node type.
+ *
+ * @param remote remote node type
+ * @return local node type adapter
+ */
+ public NodeType getNodeType(RemoteNodeType remote);
+
+ /**
+ * Factory method for creating a local adapter for a remote node
+ * definition.
+ *
+ * @param remote remote node definition
+ * @return local node definition adapter
+ */
+ public NodeDef getNodeDef(RemoteNodeDef remote);
+
+ /**
+ * Factory method for creating a local adapter for a remote property
+ * definition.
+ *
+ * @param remote remote property definition
+ * @return local property definition adapter
+ */
+ public PropertyDef getPropertyDef(RemotePropertyDef remote);
+
+ /**
+ * Factory method for creating a local adapter for a remote lock.
+ *
+ * @param node current node
+ * @param remote remote lock
+ * @return local lock adapter
+ */
+ public Lock getLock(Node node, RemoteLock remote);
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRepositoryException.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRepositoryException.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRepositoryException.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.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.
+ * <p>
+ * Note that if a RemoteException is received by call with no declared
+ * exceptions, then the RemoteException is wrapped into a
+ * RemoteRuntimeException.
+ *
+ * @author Jukka Zitting
+ */
+public class RemoteRepositoryException extends RepositoryException {
+
+ /**
+ * Creates a RemoteRepositoryException based on the given RemoteException.
+ *
+ * @param ex the remote exception
+ */
+ public RemoteRepositoryException(RemoteException ex) {
+ super(ex);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRuntimeException.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRuntimeException.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/RemoteRuntimeException.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.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.
+ * <p>
+ * Note that if a RemoteException is received by call that declares to
+ * throw RepositoryExceptions, then the RemoteException is wrapped into
+ * a RemoteRepositoryException.
+ *
+ * @author Jukka Zitting
+ */
+public class RemoteRuntimeException extends RuntimeException {
+
+ /**
+ * Creates a RemoteRuntimeException based on the given RemoteException.
+ *
+ * @param ex the remote exception
+ */
+ public RemoteRuntimeException(RemoteException ex) {
+ super(ex);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/package.html
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/package.html?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/client/package.html Sat Jan 29 03:20:38 2005
@@ -0,0 +1,60 @@
+<body>
+Client implementation of the transparent JCR-RMI layer.
+<p>
+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.
+<p>
+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.
+
+<h2>Looking up a JCR-RMI client</h2>
+<p>
+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.
+<p>
+The following example shows how to use the ClientRepositoryFactory
+directly:
+
+<pre>
+ String name = ...; // The RMI URL of the repository
+
+ ClientRepositoryFactory factory = new ClientRepositoryFactory();
+ Repository repository = factory.getRepository(name);
+</pre>
+
+<p>
+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:
+
+<pre>
+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");
+</pre>
+
+<p>
+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.
+
+</body>
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayIterator.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayIterator.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayIterator.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.iterator;
+
+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.
+ *
+ * @author Jukka Zitting
+ */
+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;
+ }
+
+ /** {@inheritDoc} */
+ public long getSize() {
+ return array.length;
+ }
+
+ /** {@inheritDoc} */
+ public long getPos() {
+ return position;
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeIterator.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeIterator.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeIterator.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.iterator;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+
+/**
+ * Array implementation of the JCR
+ * {@link javax.jcr.NodeIterator NodeIterator} interface.
+ * This class is used by the JCR-RMI client adapters to convert
+ * node arrays to iterators.
+ *
+ * @author Jukka Zitting
+ */
+public class ArrayNodeIterator extends ArrayIterator implements NodeIterator {
+
+ /**
+ * Creates an iterator for the given array of nodes.
+ *
+ * @param nodes the nodes to iterate
+ */
+ public ArrayNodeIterator(Node[] nodes) {
+ super(nodes);
+ }
+
+ /** {@inheritDoc} */
+ public Node nextNode() {
+ return (Node) next();
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeTypeIterator.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeTypeIterator.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayNodeTypeIterator.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.iterator;
+
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeIterator;
+
+/**
+ * Array implementation of the JCR
+ * {@link javax.jcr.NodeTypeIterator NodeTypeIterator} interface.
+ * This class is used by the JCR-RMI client adapters to convert
+ * node type arrays to iterators.
+ *
+ * @author Jukka Zitting
+ */
+public class ArrayNodeTypeIterator extends ArrayIterator implements
+ NodeTypeIterator {
+
+ /**
+ * Creates an iterator for the given array of node types.
+ *
+ * @param types the node types to iterate
+ */
+ public ArrayNodeTypeIterator(NodeType[] types) {
+ super(types);
+ }
+
+ /** {@inheritDoc} */
+ public NodeType nextNodeType() {
+ return (NodeType) next();
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayPropertyIterator.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayPropertyIterator.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/ArrayPropertyIterator.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.iterator;
+
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+
+/**
+ * Array implementation of the JCR
+ * {@link javax.jcr.PropertyIterator PropertyIterator} interface.
+ * This class is used by the JCR-RMI client adapters to convert
+ * property arrays to iterators.
+ *
+ * @author Jukka Zitting
+ */
+public class ArrayPropertyIterator extends ArrayIterator
+ implements PropertyIterator {
+
+ /**
+ * Creates an iterator for the given array of properties.
+ *
+ * @param properties the properties to iterate
+ */
+ public ArrayPropertyIterator(Property[] properties) {
+ super(properties);
+ }
+
+ /** {@inheritDoc} */
+ public Property nextProperty() {
+ return (Property) next();
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/package.html
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/package.html?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/iterator/package.html Sat Jan 29 03:20:38 2005
@@ -0,0 +1,10 @@
+<body>
+Utility classes for implementing JCR iterators based on static arrays.
+<p>
+This package contains array-based implementations of the JCR
+{@link javax.jcr.RangeIterator RangeIterator} interfaces.
+<p>
+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.
+</body>
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteItem.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteItem.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteItem.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.ReferentialIntegrityException;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
+/**
+ * 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.
+ * <p>
+ * 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.
+ * Compex return values (Items and Nodes) are returned as remote references
+ * to the corresponding remote interfaces. RMI errors are signalled with
+ * RemoteExceptions.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Item
+ * @see org.apache.jackrabbit.rmi.client.ClientItem
+ * @see org.apache.jackrabbit.rmi.server.ServerItem
+ */
+public interface RemoteItem extends Remote {
+
+ /**
+ * @see javax.jcr.Item#getPath()
+ * @throws RemoteException on RMI exceptions
+ */
+ public String getPath() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Item#getName()
+ * @throws RemoteException on RMI exceptions
+ */
+ public String getName() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Item#getAncestor(int)
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteItem getAncestor(int level) throws ItemNotFoundException,
+ AccessDeniedException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Item#getParent()
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteNode getParent() throws ItemNotFoundException,
+ AccessDeniedException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Item#getDepth()
+ * @throws RemoteException on RMI exceptions
+ */
+ public int getDepth() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Item#isNew()
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean isNew() throws RemoteException;
+
+ /**
+ * @see javax.jcr.Item#isModified()
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean isModified() throws RemoteException;
+
+ /**
+ * @see javax.jcr.Item#save()
+ * @throws RemoteException on RMI exceptions
+ */
+ public void save() throws AccessDeniedException, LockException,
+ ConstraintViolationException, InvalidItemStateException,
+ ReferentialIntegrityException, RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Item#refresh(boolean)
+ * @throws RemoteException on RMI exceptions
+ */
+ public void refresh(boolean keepChanges) throws InvalidItemStateException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Item#remove()
+ * @throws RemoteException on RMI exceptions
+ */
+ public void remove() throws RepositoryException, RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteItemDef.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteItemDef.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteItemDef.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * Remote version of the JCR {@link javax.jcr.nodetype.ItemDef ItemDef}
+ * interface. Used by the
+ * {@link org.apache.jackrabbit.rmi.server.ServerItemDef ServerItemDef} and
+ * {@link org.apache.jackrabbit.rmi.client.ClientItemDef ClientItemDef}
+ * adapter base classes to provide transparent RMI access to remote item
+ * definitions.
+ * <p>
+ * 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.
+ * Compex {@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 signalled with RemoteExceptions.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.ItemDef
+ * @see org.apache.jackrabbit.rmi.client.ClientItemDef
+ * @see org.apache.jackrabbit.rmi.server.ServerItemDef
+ */
+public interface RemoteItemDef extends Remote {
+
+ /**
+ * @see javax.jcr.nodetype.ItemDef#getDeclaringNodeType()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeType getDeclaringNodeType() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.ItemDef#getName()
+ * @throws RemoteException on RMI errors
+ */
+ public String getName() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.ItemDef#isAutoCreate()
+ * @throws RemoteException on RMI errors
+ */
+ public boolean isAutoCreate() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.ItemDef#isMandatory()
+ * @throws RemoteException on RMI errors
+ */
+ public boolean isMandatory() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.ItemDef#getOnParentVersion()
+ * @throws RemoteException on RMI errors
+ */
+ public int getOnParentVersion() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.ItemDef#isProtected()
+ * @throws RemoteException on RMI errors
+ */
+ public boolean isProtected() throws RemoteException;
+
+}
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+
+/**
+ * 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.
+ * <p>
+ * 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 signalled
+ * with RemoteExceptions.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.lock.Lock
+ * @see org.apache.jackrabbit.rmi.client.ClientLock
+ * @see org.apache.jackrabbit.rmi.server.ServerLock
+ */
+public interface RemoteLock extends Remote {
+
+ /**
+ * @see javax.jcr.lock.Lock#getLockOwner()
+ * @throws RemoteException on RMI exceptions
+ */
+ public String getLockOwner() throws RemoteException;
+
+ /**
+ * @see javax.jcr.lock.Lock#isDeep()
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean isDeep() throws RemoteException;
+
+ /**
+ * @see javax.jcr.lock.Lock#getLockToken()
+ * @throws RemoteException on RMI exceptions
+ */
+ public String getLockToken() throws RemoteException;
+
+ /**
+ * @see javax.jcr.lock.Lock#isLive()
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean isLive() throws RemoteException;
+
+ /**
+ * @see javax.jcr.lock.Lock#refresh()
+ * @throws RemoteException on RMI exceptions
+ */
+ public void refresh() throws LockException, RepositoryException,
+ RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNamespaceRegistry.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNamespaceRegistry.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNamespaceRegistry.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jcr.NamespaceException;
+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.
+ * <p>
+ * 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 signalled with RemoteExceptions.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.NamespaceRegistry
+ * @see org.apache.jackrabbit.rmi.client.ClientNamespaceRegistry
+ * @see org.apache.jackrabbit.rmi.server.ServerNamespaceRegistry
+ */
+public interface RemoteNamespaceRegistry extends Remote {
+
+ /**
+ * @see javax.jcr.NamespaceRegistry#registerNamespace(java.lang.String,java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public void registerNamespace(String prefix, String uri)
+ throws NamespaceException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.NamespaceRegistry#unregisterNamespace(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public void unregisterNamespace(String prefix)
+ throws NamespaceException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.NamespaceRegistry#getPrefixes()
+ * @throws RemoteException on RMI errors
+ */
+ public String[] getPrefixes() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.NamespaceRegistry#getURIs()
+ * @throws RemoteException on RMI errors
+ */
+ public String[] getURIs() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.NamespaceRegistry#getURI(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public String getURI(String prefix)
+ throws NamespaceException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.NamespaceRegistry#getPrefix(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public String getPrefix(String uri)
+ throws NamespaceException, RepositoryException, RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,353 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.MergeException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.PathNotFoundException;
+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.version.VersionException;
+
+
+/**
+ * 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.
+ * <p>
+ * 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.
+ * Compex 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 signalled with
+ * RemoteExceptions.
+ * <p>
+ * 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.remote.SerialValue SerialValue}
+ * decorator utility provides a convenient way to satisfy these
+ * requirements.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Node
+ * @see org.apache.jackrabbit.rmi.client.ClientNode
+ * @see org.apache.jackrabbit.rmi.server.ServerNode
+ */
+public interface RemoteNode extends RemoteItem {
+
+ /**
+ * @see javax.jcr.Node#addNode(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteNode addNode(String path) throws ItemExistsException,
+ PathNotFoundException, ConstraintViolationException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#addNode(java.lang.String, java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteNode addNode(String path, String type) throws
+ ItemExistsException, PathNotFoundException, NoSuchNodeTypeException,
+ ConstraintViolationException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getProperty(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteProperty getProperty(String path) throws PathNotFoundException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getProperties()
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteProperty[] getProperties() throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getProperties(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteProperty[] getProperties(String pattern) throws
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getPrimaryItem()
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteItem getPrimaryItem() throws ItemNotFoundException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getUUID()
+ * @throws RemoteException on RMI exceptions
+ */
+ public String getUUID() throws UnsupportedRepositoryOperationException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getReferences()
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteProperty[] getReferences() throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getNodes()
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteNode[] getNodes() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getNodes(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteNode[] getNodes(String pattern) throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Node#hasNode(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean hasNode(String path) throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Node#hasProperty(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean hasProperty(String path) throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Node#hasNodes()
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean hasNodes() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#hasProperties()
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean hasProperties() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getPrimaryNodeType()
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteNodeType getPrimaryNodeType()
+ throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getMixinNodeTypes()
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteNodeType[] getMixinNodeTypes()
+ throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#isNodeType(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean isNodeType(String type)
+ throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getNode(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteNode getNode(String path) throws PathNotFoundException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#orderBefore(java.lang.String, java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public void orderBefore(String src, String dst) throws
+ UnsupportedRepositoryOperationException,
+ ConstraintViolationException, ItemNotFoundException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#setProperty(java.lang.String, javax.jcr.Value)
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteProperty setProperty(String name, Value value) throws
+ ValueFormatException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#setProperty(java.lang.String, javax.jcr.Value[])
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteProperty setProperty(String name, Value[] value) throws
+ ValueFormatException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#addMixin(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public void addMixin(String name) throws NoSuchNodeTypeException,
+ ConstraintViolationException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#removeMixin(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public void removeMixin(String name) throws NoSuchNodeTypeException,
+ ConstraintViolationException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#canAddMixin(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean canAddMixin(String name) throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getDefinition()
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteNodeDef getDefinition() throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Node#checkout()
+ * @throws RemoteException on RMI exceptions
+ */
+ public void checkout() throws UnsupportedRepositoryOperationException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#update(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public void update(String workspace) throws NoSuchWorkspaceException,
+ AccessDeniedException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#merge(java.lang.String, boolean)
+ * @throws RemoteException on RMI exceptions
+ */
+ public void merge(String workspace, boolean bestEffort) throws
+ UnsupportedRepositoryOperationException, NoSuchWorkspaceException,
+ AccessDeniedException, MergeException, RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getCorrespondingNodePath(java.lang.String)
+ * @throws RemoteException on RMI exceptions
+ */
+ public String getCorrespondingNodePath(String workspace) throws
+ ItemNotFoundException, NoSuchWorkspaceException, AccessDeniedException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getIndex()
+ * @throws RemoteException on RMI exceptions
+ */
+ public int getIndex() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#restore(java.lang.String, boolean)
+ * @throws RemoteException on RMI exceptions
+ */
+ public void restore(String version, boolean removeExisting) throws
+ VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ InvalidItemStateException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#restoreByLabel(java.lang.String, boolean)
+ * @throws RemoteException on RMI exceptions
+ */
+ public void restoreByLabel(String label, boolean removeExisting) throws
+ VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ InvalidItemStateException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#unlock()
+ * @throws RemoteException on RMI exceptions
+ */
+ public void unlock() throws UnsupportedRepositoryOperationException,
+ LockException, AccessDeniedException, RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Node#holdsLock()
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean holdsLock() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#isLocked()
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean isLocked() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#isCheckedOut()
+ * @throws RemoteException on RMI exceptions
+ */
+ public boolean isCheckedOut() throws
+ UnsupportedRepositoryOperationException, RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Node#setProperty(java.lang.String, javax.jcr.Value[], int)
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteProperty setProperty(String name, Value[] values, int type)
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#lock(boolean, boolean)
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteLock lock(boolean isDeep, boolean isSessionScoped) throws
+ UnsupportedRepositoryOperationException, LockException,
+ AccessDeniedException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Node#getLock()
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemoteLock getLock() throws UnsupportedRepositoryOperationException,
+ LockException, AccessDeniedException, RepositoryException,
+ RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeDef.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeDef.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeDef.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.rmi.RemoteException;
+
+/**
+ * Remote version of the JCR {@link javax.jcr.nodetype.NodeDef NodeDef}
+ * interface. Used by the
+ * {@link org.apache.jackrabbit.rmi.server.ServerNodeDef ServerNodeDef} and
+ * {@link org.apache.jackrabbit.rmi.client.ClientNodeDef ClientNodeDef}
+ * adapters to provide transparent RMI access to remote node definitions.
+ * <p>
+ * 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 signalled with RemoteExceptions.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.NodeDef
+ * @see org.apache.jackrabbit.rmi.client.ClientNodeDef
+ * @see org.apache.jackrabbit.rmi.server.ServerNodeDef
+ */
+public interface RemoteNodeDef extends RemoteItemDef {
+
+ /**
+ * @see javax.jcr.nodetype.NodeDef#getRequiredPrimaryTypes()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeType[] getRequiredPrimaryTypes() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeDef#getDefaultPrimaryType()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeType getDefaultPrimaryType() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeDef#allowSameNameSibs()
+ * @throws RemoteException on RMI errors
+ */
+ public boolean allowSameNameSibs() throws RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeType.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeType.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeType.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.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.
+ * <p>
+ * 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 retunred as remote
+ * references to the corresponding remote interfaces. RMI errors are
+ * signalled with RemoteExceptions.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.NodeType
+ * @see org.apache.jackrabbit.rmi.client.ClientNodeType
+ * @see org.apache.jackrabbit.rmi.server.ServerNodeType
+ */
+public interface RemoteNodeType extends Remote {
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#getName()
+ * @throws RemoteException on RMI errors
+ */
+ public String getName() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#isMixin()
+ * @throws RemoteException on RMI errors
+ */
+ public boolean isMixin() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#hasOrderableChildNodes()
+ * @throws RemoteException on RMI errors
+ */
+ public boolean hasOrderableChildNodes() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#getSupertypes()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeType[] getSupertypes() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#getDeclaredSupertypes()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeType[] getDeclaredSupertypes() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#isNodeType(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public boolean isNodeType(String type) throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#getPropertyDefs()
+ * @throws RemoteException on RMI errors
+ */
+ public RemotePropertyDef[] getPropertyDefs() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#getDeclaredPropertyDefs()
+ * @throws RemoteException on RMI errors
+ */
+ public RemotePropertyDef[] getDeclaredPropertyDefs() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#getChildNodeDefs()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeDef[] getChildNodeDefs() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#getDeclaredChildNodeDefs()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeDef[] getDeclaredChildNodeDefs() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#canSetProperty(java.lang.String, javax.jcr.Value)
+ * @throws RemoteException on RMI errors
+ */
+ public boolean canSetProperty(String name, Value value) throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#canSetProperty(java.lang.String, javax.jcr.Value[])
+ * @throws RemoteException on RMI errors
+ */
+ public boolean canSetProperty(String name, Value[] values) throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#canAddChildNode(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public boolean canAddChildNode(String name) throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#canAddChildNode(java.lang.String, java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public boolean canAddChildNode(String name, String type) throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#canRemoveItem(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public boolean canRemoveItem(String name) throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeType#getPrimaryItemName()
+ * @throws RemoteException on RMI errors
+ */
+ public String getPrimaryItemName() throws RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeTypeManager.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeTypeManager.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteNodeTypeManager.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+
+/**
+ * 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.
+ * <p>
+ * 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 signalled with RemoteExceptions.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.NodeTypeManager
+ * @see org.apache.jackrabbit.rmi.client.ClientNodeTypeManager
+ * @see org.apache.jackrabbit.rmi.server.ServerNodeTypeManager
+ */
+public interface RemoteNodeTypeManager extends Remote {
+
+ /**
+ * @see javax.jcr.nodetype.NodeTypeManager#getNodeType(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeType getNodeType(String name)
+ throws NoSuchNodeTypeException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeTypeManager#getAllNodeTypes()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeType[] getAllNodeTypes()
+ throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeTypeManager#getPrimaryNodeTypes()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeType[] getPrimaryNodeTypes()
+ throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.NodeTypeManager#getMixinNodeTypes()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeType[] getMixinNodeTypes()
+ throws RepositoryException, RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteProperty.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteProperty.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteProperty.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+
+
+/**
+ * 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.
+ * <p>
+ * 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.
+ * Compex {@link javax.jcr.nodetype.PropertyDef PropertyDef} return values
+ * are returned as remote references to the corresponding
+ * {@link org.apache.jackrabbit.rmi.remote.RemotePropertyDef RemotePropertyDef}
+ * interface. RMI errors are signalled with RemoteExceptions.
+ * <p>
+ * 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.remote.SerialValue SerialValue}
+ * decorator utility provides a convenient way to satisfy these
+ * requirements.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Property
+ * @see org.apache.jackrabbit.rmi.client.ClientProperty
+ * @see org.apache.jackrabbit.rmi.server.ServerProperty
+ */
+public interface RemoteProperty extends RemoteItem {
+
+ /**
+ * @see javax.jcr.Property#getValue()
+ * @throws RemoteException on RMI exceptions
+ */
+ public Value getValue()
+ throws ValueFormatException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Property#getValues()
+ * @throws RemoteException on RMI exceptions
+ */
+ public Value[] getValues()
+ throws ValueFormatException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Property#setValue(javax.jcr.Value)
+ * @throws RemoteException on RMI exceptions
+ */
+ public void setValue(Value value)
+ throws ValueFormatException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Property#setValue(javax.jcr.Value[])
+ * @throws RemoteException on RMI exceptions
+ */
+ public void setValue(Value[] values)
+ throws ValueFormatException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Property#getLength()
+ * @throws RemoteException on RMI exceptions
+ */
+ public long getLength()
+ throws ValueFormatException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Property#getLengths()
+ * @throws RemoteException on RMI exceptions
+ */
+ public long[] getLengths()
+ throws ValueFormatException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Property#getDefinition()
+ * @throws RemoteException on RMI exceptions
+ */
+ public RemotePropertyDef getDefinition() throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Property#getType()
+ * @throws RemoteException on RMI exceptions
+ */
+ public int getType() throws RepositoryException, RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemotePropertyDef.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemotePropertyDef.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemotePropertyDef.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Value;
+
+/**
+ * Remote version of the JCR {@link javax.jcr.nodetype.PropertyDef PropertyDef}
+ * interface. Used by the
+ * {@link org.apache.jackrabbit.rmi.server.ServerPropertyDef ServerPropertyDef}
+ * and
+ * {@link org.apache.jackrabbit.rmi.client.ClientPropertyDef ClientPropertyDef}
+ * adapters to provide transparent RMI access to remote property definitions.
+ * <p>
+ * 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 signalled with RemoteExceptions.
+ * <p>
+ * Note that returned Value objects must be serializable and implemented
+ * using classes available on both the client and server side. The
+ * {@link org.apache.jackrabbit.rmi.remote.SerialValue SerialValue}
+ * decorator utility provides a convenient way to satisfy these
+ * requirements.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.PropertyDef
+ * @see org.apache.jackrabbit.rmi.client.ClientPropertyDef
+ * @see org.apache.jackrabbit.rmi.server.ServerPropertyDef
+ */
+public interface RemotePropertyDef extends RemoteItemDef {
+
+ /**
+ * @see javax.jcr.nodetype.PropertyDef#getRequiredType()
+ * @throws RemoteException on RMI errors
+ */
+ public int getRequiredType() throws RemoteException;
+
+ /**
+ * @throws RemoteException on RMI errors
+ * @see javax.jcr.nodetype.PropertyDef#getValueConstraints()
+ */
+ public String[] getValueConstraints() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.PropertyDef#getDefaultValues()
+ * @throws RemoteException on RMI errors
+ */
+ public Value[] getDefaultValues() throws RemoteException;
+
+ /**
+ * @see javax.jcr.nodetype.PropertyDef#isMultiple()
+ * @throws RemoteException on RMI errors
+ */
+ public boolean isMultiple() throws RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteRepository.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteRepository.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteRepository.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jcr.Credentials;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.RepositoryException;
+
+/**
+ * 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.
+* <p>
+ * 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 org.apache.jackrabbit.rmi.remote.RemoteSession RemoteSession}
+ * interface. Simple return values and possible exceptions are simply copied
+ * over the network to the client. RMI errors are signalled with
+ * RemoteExceptions.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Repository
+ * @see org.apache.jackrabbit.rmi.client.ClientRepository
+ * @see org.apache.jackrabbit.rmi.server.ServerRepository
+ */
+public interface RemoteRepository extends Remote {
+
+ /**
+ * @see javax.jcr.Repository#getDescriptor(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public String getDescriptor(String name) throws RemoteException;
+
+ /**
+ * @see javax.jcr.Repository#getDescriptorKeys()
+ * @throws RemoteException on RMI errors
+ */
+ public String[] getDescriptorKeys() throws RemoteException;
+
+ /**
+ * @see javax.jcr.Repository#login()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteSession login() throws LoginException,
+ NoSuchWorkspaceException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Repository#login(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteSession login(String workspace) throws LoginException,
+ NoSuchWorkspaceException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Repository#login(javax.jcr.Credentials)
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteSession login(Credentials credentials) throws LoginException,
+ NoSuchWorkspaceException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Repository#login(javax.jcr.Credentials, java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteSession login(Credentials credentials, String workspace)
+ throws LoginException, NoSuchWorkspaceException, RepositoryException,
+ RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,260 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.io.IOException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.security.AccessControlException;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Credentials;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.InvalidSerializedDataException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.LoginException;
+import javax.jcr.NamespaceException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
+/**
+ * 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.
+ * <p>
+ * 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 signalled with RemoteExceptions.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Session
+ * @see org.apache.jackrabbit.rmi.client.ClientSession
+ * @see org.apache.jackrabbit.rmi.server.ServerSession
+ */
+public interface RemoteSession extends Remote {
+
+ /**
+ * @see javax.jcr.Session#getUserId()
+ * @throws RemoteException on RMI errors
+ */
+ public 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.
+ *
+ * @see javax.jcr.Session#getAttribute(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public Object getAttribute(String name) throws RemoteException;
+
+ /**
+ * @see javax.jcr.Session#getAttributeNames()
+ * @throws RemoteException on RMI errors
+ */
+ public String[] getAttributeNames() throws RemoteException;
+
+ /**
+ * @see javax.jcr.Session#getWorkspace()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteWorkspace getWorkspace() throws RemoteException;
+
+ /**
+ * @see javax.jcr.Session#impersonate(javax.jcr.Credentials)
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteSession impersonate(Credentials credentials) throws
+ LoginException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Session#getNodeByUUID(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNode getNodeByUUID(String uuid) throws ItemNotFoundException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Session#getItem(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteItem getItem(String path) throws PathNotFoundException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Session#itemExists(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public boolean itemExists(String path) throws RemoteException;
+
+ /**
+ * @see javax.jcr.Session#move(java.lang.String, java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public void move(String from, String to) throws ItemExistsException,
+ PathNotFoundException, ConstraintViolationException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Session#save()
+ * @throws RemoteException on RMI errors
+ */
+ public void save() throws AccessDeniedException, LockException,
+ ConstraintViolationException, InvalidItemStateException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Session#refresh(boolean)
+ * @throws RemoteException on RMI errors
+ */
+ public void refresh(boolean keepChanges) throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Session#logout()
+ * @throws RemoteException on RMI errors
+ */
+ public void logout() throws RemoteException;
+
+ /**
+ * @see javax.jcr.Session#getRootNode()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNode getRootNode() throws RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Session#hasPendingChanges()
+ * @throws RemoteException on RMI errors
+ */
+ public boolean hasPendingChanges() throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Session#checkPermission(java.lang.String, java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public void checkPermission(String path, String actions) throws
+ AccessControlException, 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.
+ *
+ * @see javax.jcr.Session#importXML(java.lang.String, java.io.InputStream)
+ * @throws RemoteException on RMI errors
+ */
+ public void importXML(String path, byte[] xml) throws IOException,
+ PathNotFoundException, ItemExistsException,
+ ConstraintViolationException, InvalidSerializedDataException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Session#setNamespacePrefix(java.lang.String, java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public void setNamespacePrefix(String prefix, String uri) throws
+ NamespaceException, RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Session#getNamespacePrefixes()
+ * @throws RemoteException on RMI errors
+ */
+ public String[] getNamespacePrefixes() throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Session#getNamespaceURI(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public String getNamespaceURI(String prefix) throws NamespaceException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Session#getNamespacePrefix(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public String getNamespacePrefix(String uri) throws NamespaceException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Session#addLockToken(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public void addLockToken(String name) throws RemoteException;
+
+ /**
+ * @see javax.jcr.Session#getLockTokens()
+ * @throws RemoteException on RMI errors
+ */
+ public String[] getLockTokens() throws RemoteException;
+
+ /**
+ * @see javax.jcr.Session#removeLockToken(java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public 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.
+ *
+ * @see javax.jcr.Workspace#exportSysView(java.lang.String, java.io.OutputStream, boolean, boolean)
+ * @throws RemoteException on RMI errors
+ */
+ public byte[] exportSysView(
+ String path, boolean binaryAsLink, boolean noRecurse)
+ throws PathNotFoundException, 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.
+ *
+ * @see javax.jcr.Workspace#exportDocView(java.lang.String, java.io.OutputStream, boolean, boolean)
+ * @throws RemoteException on RMI errors
+ */
+ public byte[] exportDocView(
+ String path, boolean binaryAsLink, boolean noRecurse)
+ throws InvalidSerializedDataException, PathNotFoundException,
+ IOException, RepositoryException, RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteWorkspace.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteWorkspace.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/RemoteWorkspace.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.io.IOException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidSerializedDataException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
+/**
+ * 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.
+ * <p>
+ * 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 simply copied over the network
+ * to the client. RMI errors are signalled with RemoteExceptions.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Workspace
+ * @see org.apache.jackrabbit.rmi.client.ClientWorkspace
+ * @see org.apache.jackrabbit.rmi.server.ServerWorkspace
+ */
+public interface RemoteWorkspace extends Remote {
+
+ /**
+ * @see javax.jcr.Workspace#getName()
+ * @throws RemoteException on RMI errors
+ */
+ public String getName() throws RemoteException;
+
+ /**
+ * @see javax.jcr.Workspace#copy(java.lang.String,java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public void copy(String from, String to) throws
+ ConstraintViolationException, AccessDeniedException,
+ PathNotFoundException, ItemExistsException, RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Workspace#copy(java.lang.String,java.lang.String,java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public void copy(String from, String to, String workspace) throws
+ NoSuchWorkspaceException, ConstraintViolationException,
+ AccessDeniedException, PathNotFoundException, ItemExistsException,
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Workspace#clone(java.lang.String, java.lang.String, java.lang.String, boolean)
+ * @throws RemoteException on RMI errors
+ */
+ public void clone(String from, String to, String workspace,
+ boolean removeExisting) throws NoSuchWorkspaceException,
+ ConstraintViolationException, AccessDeniedException,
+ PathNotFoundException, ItemExistsException, RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Workspace#move(java.lang.String, java.lang.String)
+ * @throws RemoteException on RMI errors
+ */
+ public void move(String from, String to) throws
+ ConstraintViolationException, AccessDeniedException,
+ PathNotFoundException, ItemExistsException, RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Workspace#getNodeTypeManager()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeTypeManager getNodeTypeManager() throws
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Workspace#getNamespaceRegistry()
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNamespaceRegistry getNamespaceRegistry() throws
+ RepositoryException, RemoteException;
+
+ /**
+ * @see javax.jcr.Workspace#getAccessibleWorkspaceNames()
+ * @throws RemoteException on RMI errors
+ */
+ public String[] getAccessibleWorkspaceNames() throws RepositoryException,
+ RemoteException;
+
+ /**
+ * @see javax.jcr.Workspace#importXML(java.lang.String, byte[], int)
+ * @throws RemoteException on RMI errors
+ */
+ public void importXML(String path, byte[] xml, int uuidBehaviour)
+ throws IOException, PathNotFoundException, ItemExistsException,
+ ConstraintViolationException, InvalidSerializedDataException,
+ LockException, RepositoryException, RemoteException;
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/SerialValue.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/SerialValue.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/SerialValue.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,252 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.remote;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Calendar;
+
+import javax.jcr.BinaryValue;
+import javax.jcr.BooleanValue;
+import javax.jcr.DateValue;
+import javax.jcr.DoubleValue;
+import javax.jcr.LongValue;
+import javax.jcr.NameValue;
+import javax.jcr.PathValue;
+import javax.jcr.PropertyType;
+import javax.jcr.ReferenceValue;
+import javax.jcr.RepositoryException;
+import javax.jcr.StringValue;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+
+/**
+ * Serializable {@link javax.jcr.Value Value} decorator. A SerialValue
+ * decorator makes it possible to serialize the contents of a Value object
+ * even if the object itself is not serializable.
+ * <p>
+ * Serialization is achieved by extracting and serializing the type and
+ * underlying data of the Value object. On deserialization the type and
+ * data information is used to create a standard JCR Value object as
+ * a copy of the original value. This makes it possible to copy even
+ * system-specific Value instances to a remote JVM that might not contain
+ * the implementation class of the original Value object.
+ * <p>
+ * The SerialValue decorator adds no other functionality to the Value
+ * interface. Normal method calls are simply forwarded to the decorated
+ * Value object.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Value
+ * @see java.io.Serializable
+ */
+public class SerialValue implements Value, Serializable {
+
+ /** Static serial version UID. */
+ static final long serialVersionUID = 8070492457339121953L;
+
+ /** The decorated value. */
+ private Value value;
+
+ /**
+ * Creates a SerialValue decorator for the given Value object.
+ *
+ * @param value the value to be decorated
+ */
+ public SerialValue(Value value) {
+ this.value = value;
+ }
+
+ /**
+ * Utility method for decorating an array of Value objects.
+ *
+ * @param values the Value objects to be decorated
+ * @return array of SerialValue decorators
+ */
+ public static Value[] makeSerialValueArray(Value[] values) {
+ if (values == null) {
+ return new Value[0];
+ }
+
+ Value[] serials = new Value[values.length];
+ for (int i = 0; i < values.length; i++) {
+ serials[i] = new SerialValue(values[i]);
+ }
+ return serials;
+ }
+
+ /**
+ * Serializes the underlying Value object. Instead of using
+ * the normal serialization mechanism, the essential state
+ * of the Value object is extracted and written to the serialization
+ * stream as a type-value pair.
+ *
+ * @param out the serialization stream
+ * @throws IOException on IO errors
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ try {
+ int type = value.getType();
+ out.writeInt(type);
+ switch (type) {
+ case PropertyType.BINARY:
+ InputStream data = value.getStream();
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ byte[] bytes = new byte[4096];
+ for (int n = data.read(bytes); n != -1; n = data.read(bytes)) {
+ buffer.write(bytes, 0, n);
+ }
+ out.writeInt(buffer.size());
+ buffer.writeTo(out);
+ break;
+ case PropertyType.BOOLEAN:
+ out.writeBoolean(value.getBoolean());
+ break;
+ case PropertyType.DATE:
+ out.writeObject(value.getDate());
+ break;
+ case PropertyType.DOUBLE:
+ out.writeDouble(value.getDouble());
+ break;
+ case PropertyType.LONG:
+ out.writeLong(value.getLong());
+ break;
+ case PropertyType.NAME:
+ case PropertyType.PATH:
+ case PropertyType.REFERENCE:
+ case PropertyType.STRING:
+ out.writeUTF(value.getString());
+ break;
+ default:
+ throw new IOException("Unknown value type");
+ }
+ } catch (RepositoryException ex) { // Is this possible?
+ throw new IOException(ex.getMessage());
+ }
+ }
+
+ /**
+ * Deserializes the underlying Value object. A new Value object
+ * is created based on the type and state data read fro the
+ * serialization stream.
+ *
+ * @param in the serialization stream
+ * @throws IOException on IO errors
+ */
+ private void readObject(ObjectInputStream in) throws IOException {
+ try {
+ int type = in.readInt();
+ switch (type) {
+ case PropertyType.BINARY:
+ byte[] bytes = new byte[in.readInt()];
+ in.readFully(bytes);
+ value = new BinaryValue(bytes);
+ break;
+ case PropertyType.BOOLEAN:
+ value = new BooleanValue(in.readBoolean());
+ break;
+ case PropertyType.DATE:
+ value = new DateValue((Calendar) in.readObject());
+ break;
+ case PropertyType.DOUBLE:
+ value = new DoubleValue(in.readDouble());
+ break;
+ case PropertyType.LONG:
+ value = new LongValue(in.readLong());
+ break;
+ case PropertyType.NAME:
+ value = NameValue.valueOf(in.readUTF());
+ break;
+ case PropertyType.PATH:
+ value = PathValue.valueOf(in.readUTF());
+ break;
+ case PropertyType.REFERENCE:
+ value = ReferenceValue.valueOf(in.readUTF());
+ break;
+ case PropertyType.STRING:
+ value = new StringValue(in.readUTF());
+ break;
+ default:
+ throw new IllegalStateException("Illegal serial value type");
+ }
+ } catch (ValueFormatException ex) {
+ throw new IOException(ex.getMessage());
+ } catch (ClassNotFoundException ex) {
+ throw new IOException(ex.getMessage());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jcr.Value#getBoolean()
+ */
+ public boolean getBoolean() throws ValueFormatException,
+ IllegalStateException, RepositoryException {
+ return value.getBoolean();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jcr.Value#getDate()
+ */
+ public Calendar getDate() throws ValueFormatException,
+ IllegalStateException, RepositoryException {
+ return value.getDate();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jcr.Value#getDouble()
+ */
+ public double getDouble() throws ValueFormatException,
+ IllegalStateException, RepositoryException {
+ return value.getDouble();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jcr.Value#getLong()
+ */
+ public long getLong() throws ValueFormatException, IllegalStateException,
+ RepositoryException {
+ return value.getLong();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jcr.Value#getStream()
+ */
+ public InputStream getStream() throws ValueFormatException,
+ IllegalStateException, RepositoryException {
+ return value.getStream();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jcr.Value#getString()
+ */
+ public String getString() throws ValueFormatException,
+ IllegalStateException, RepositoryException {
+ return value.getString();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jcr.Value#getType()
+ */
+ public int getType() {
+ return value.getType();
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/package.html
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/package.html?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/remote/package.html Sat Jan 29 03:20:38 2005
@@ -0,0 +1,19 @@
+<body>
+Remote interfaces of the transparent JCR-RMI layer.
+<p>
+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).
+<p>
+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.
+<p>
+The SerialValue class is a decorator utility used by both the client and
+server classes to safely pass Value objects over the network.
+</body>
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Item;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+import javax.jcr.lock.Lock;
+import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.nodetype.PropertyDef;
+
+import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteLock;
+import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+import org.apache.jackrabbit.rmi.remote.RemoteRepository;
+import org.apache.jackrabbit.rmi.remote.RemoteSession;
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+
+/**
+ * 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.
+ * <p>
+ * Note that the
+ * {@link org.apache.jackrabbit.rmi.server.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.
+ *
+ * @author Jukka Zitting
+ * @see org.apache.jackrabbit.rmi.client.LocalAdapterFactory
+ * @see org.apache.jackrabbit.rmi.server.ServerAdapterFactory
+ * @see org.apache.jackrabbit.rmi.server.ServerObject
+ */
+public interface RemoteAdapterFactory {
+
+ /**
+ * Factory method for creating a remote adapter for a local repository.
+ *
+ * @param repository local repository
+ * @return remote repository adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteRepository getRemoteRepository(Repository repository)
+ throws RemoteException;
+
+ /**
+ * Factory method for creating a remote adapter for a local session.
+ *
+ * @param session local session
+ * @return remote session adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteSession getRemoteSession(Session session)
+ throws RemoteException;
+
+ /**
+ * Factory method for creating a remote adapter for a local workspace.
+ *
+ * @param workspace local workspace
+ * @return remote workspace adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteWorkspace getRemoteWorkspace(Workspace workspace)
+ throws RemoteException;
+
+ /**
+ * Factory method for creating a remote adapter for a local namespace
+ * registry.
+ *
+ * @param registry local namespace registry
+ * @return remote namespace registry adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNamespaceRegistry getRemoteNamespaceRegistry(
+ NamespaceRegistry registry) throws RemoteException;
+
+ /**
+ * Factory method for creating a remote adapter for a local node type
+ * manager.
+ *
+ * @param manager local node type manager
+ * @return remote node type manager adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeTypeManager getRemoteNodeTypeManager(
+ NodeTypeManager manager) throws RemoteException;
+
+ /**
+ * Factory method for creating a remote adapter for a local item.
+ * Note that before calling this method, the server may want to
+ * introspect the local item to determine whether to use the
+ * {@link #getRemoteNode(Node) getRemoteNode} or
+ * {@link #getRemoteProperty(Property) getRemoteProperty} method
+ * instead, as the adapter returned by this method will only cover
+ * the basic {@link RemoteItem RemoteItem} interface.
+ *
+ * @param item local item
+ * @return remote item adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteItem getRemoteItem(Item item) throws RemoteException;
+
+ /**
+ * Factory method for creating a remote adapter for a local property.
+ *
+ * @param property local property
+ * @return remote property adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteProperty getRemoteProperty(Property property)
+ throws RemoteException;
+
+ /**
+ * Factory method for creating a remote adapter for a local node.
+ *
+ * @param node local node
+ * @return remote node adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNode getRemoteNode(Node node) throws RemoteException;
+
+ /**
+ * Factory method for creating a remote adapter for a local node type.
+ *
+ * @param type local node type
+ * @return remote node type adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeType getRemoteNodeType(NodeType type)
+ throws RemoteException;
+
+ /**
+ * Factory method for creating a remote adapter for a local node
+ * definition.
+ *
+ * @param def local node definition
+ * @return remote node definition adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteNodeDef getRemoteNodeDef(NodeDef def)
+ throws RemoteException;
+
+ /**
+ * Factory method for creating a remote adapter for a local property
+ * definition.
+ *
+ * @param def local property definition
+ * @return remote property definition adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemotePropertyDef getRemotePropertyDef(PropertyDef def)
+ throws RemoteException;
+
+ /**
+ * Factory method for creating a remote adapter for a local lock.
+ *
+ * @param lock local lock
+ * @return remote lock adapter
+ * @throws RemoteException on RMI errors
+ */
+ public RemoteLock getRemoteLock(Lock lock) throws RemoteException;
+
+}
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,178 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Item;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+import javax.jcr.lock.Lock;
+import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.nodetype.PropertyDef;
+
+import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteLock;
+import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+import org.apache.jackrabbit.rmi.remote.RemoteRepository;
+import org.apache.jackrabbit.rmi.remote.RemoteSession;
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+
+/**
+ * Default implementation of the
+ * {@link org.apache.jackrabbit.rmi.server.RemoteAdapterFactory RemoteAdapterFactory}
+ * interface. This factory uses the server 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.
+ *
+ * @author Jukka Zitting
+ */
+public class ServerAdapterFactory implements RemoteAdapterFactory {
+
+ /**
+ * Creates and returns a {@link ServerRepository ServerRepository} instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemoteRepository getRemoteRepository(Repository repository)
+ throws RemoteException {
+ return new ServerRepository(repository, this);
+ }
+
+ /**
+ * Creates and returns a {@link ServerSession ServerSession} instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemoteSession getRemoteSession(Session session)
+ throws RemoteException {
+ return new ServerSession(session, this);
+ }
+
+ /**
+ * Creates and returns a {@link ServerWorkspace ServerWorkspace} instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemoteWorkspace getRemoteWorkspace(Workspace workspace)
+ throws RemoteException {
+ return new ServerWorkspace(workspace, this);
+ }
+
+ /**
+ * Creates and returns a
+ * {@link ServerNamespaceRegistry ServerNamespaceRegistry} instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemoteNamespaceRegistry getRemoteNamespaceRegistry(
+ NamespaceRegistry registry) throws RemoteException {
+ return new ServerNamespaceRegistry(registry, this);
+ }
+
+ /**
+ * Creates and returns a
+ * {@link ServerNodeTypeManager ServerNodeTypeManager} instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemoteNodeTypeManager getRemoteNodeTypeManager(
+ NodeTypeManager manager) throws RemoteException {
+ return new ServerNodeTypeManager(manager, this);
+ }
+
+ /**
+ * Creates and returns a {@link ServerItem ServerItem} instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemoteItem getRemoteItem(Item item) throws RemoteException {
+ return new ServerItem(item, this);
+ }
+
+ /**
+ * Creates and returns a {@link ServerProperty ServerProperty} instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemoteProperty getRemoteProperty(Property property)
+ throws RemoteException {
+ return new ServerProperty(property, this);
+ }
+
+ /**
+ * Creates and returns a {@link ServerNode ServerNode} instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemoteNode getRemoteNode(Node node) throws RemoteException {
+ return new ServerNode(node, this);
+ }
+
+ /**
+ * Creates and returns a {@link ServerNodeType ServerNodeType} instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemoteNodeType getRemoteNodeType(NodeType type)
+ throws RemoteException {
+ return new ServerNodeType(type, this);
+ }
+
+ /**
+ * Creates and returns a {@link ServerNodeDef ServerNodeDef} instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemoteNodeDef getRemoteNodeDef(NodeDef def)
+ throws RemoteException {
+ return new ServerNodeDef(def, this);
+ }
+
+ /**
+ * Creates and returns a {@link ServerPropertyDef ServerPropertyDef}
+ * instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemotePropertyDef getRemotePropertyDef(PropertyDef def)
+ throws RemoteException {
+ return new ServerPropertyDef(def, this);
+ }
+
+ /**
+ * Creates and returns a {@link ServerLock ServerLock} instance.
+ *
+ * {@inheritDoc}
+ */
+ public RemoteLock getRemoteLock(Lock lock) throws RemoteException {
+ return new ServerLock(lock);
+ }
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItem.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItem.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItem.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.Item;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.ReferentialIntegrityException;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
+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.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Item
+ * @see org.apache.jackrabbit.rmi.remote.RemoteItem
+ */
+public class ServerItem extends ServerObject implements RemoteItem {
+
+ /** The adapted local item. */
+ protected 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 {
+ return item.getPath();
+ }
+
+ /** {@inheritDoc} */
+ public String getName() throws RepositoryException, RemoteException {
+ return item.getName();
+ }
+
+ /** {@inheritDoc} */
+ public void save() throws AccessDeniedException, LockException,
+ ConstraintViolationException, InvalidItemStateException,
+ ReferentialIntegrityException, RepositoryException, RemoteException {
+ item.save();
+ }
+
+ /** {@inheritDoc} */
+ public RemoteItem getAncestor(int level) throws ItemNotFoundException,
+ AccessDeniedException, RepositoryException, RemoteException {
+ return getRemoteItem(item.getAncestor(level));
+ }
+
+ /** {@inheritDoc} */
+ public int getDepth() throws RepositoryException, RemoteException {
+ return item.getDepth();
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNode getParent() throws ItemNotFoundException,
+ AccessDeniedException, RepositoryException, RemoteException {
+ return factory.getRemoteNode(item.getParent());
+ }
+
+ /** {@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 InvalidItemStateException,
+ RepositoryException, RemoteException {
+ item.refresh(keepChanges);
+ }
+
+ /** {@inheritDoc} */
+ public void remove() throws RepositoryException, RemoteException {
+ item.remove();
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItemDef.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItemDef.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItemDef.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.nodetype.ItemDef;
+
+import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+
+/**
+ * Remote adapter for the JCR {@link javax.jcr.nodetype.ItemDef ItemDef}
+ * interface. This class makes a local item definition available as an
+ * RMI service using the
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteItemDef RemoteItemDef}
+ * interface. Used mainly as the base class for the
+ * {@link org.apache.jackrabbit.rmi.server.ServerPropertyDef ServerPropertyDef}
+ * and
+ * {@link org.apache.jackrabbit.rmi.server.ServerNodeDef ServerNodeDef}
+ * adapters.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.ItemDef
+ * @see org.apache.jackrabbit.rmi.remote.RemoteItemDef
+ */
+public class ServerItemDef extends ServerObject implements RemoteItemDef {
+
+ /** The adapted local item definition. */
+ protected ItemDef 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 ServerItemDef(ItemDef def, RemoteAdapterFactory factory)
+ throws RemoteException {
+ super(factory);
+ this.def = def;
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNodeType getDeclaringNodeType() throws RemoteException {
+ return factory.getRemoteNodeType(def.getDeclaringNodeType());
+ }
+
+ /** {@inheritDoc} */
+ public String getName() throws RemoteException {
+ return def.getName();
+ }
+
+ /** {@inheritDoc} */
+ public boolean isAutoCreate() throws RemoteException {
+ return def.isAutoCreate();
+ }
+
+ /** {@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();
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerLock.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerLock.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerLock.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.Lock;
+import javax.jcr.lock.LockException;
+
+import org.apache.jackrabbit.rmi.remote.RemoteLock;
+
+/**
+ * 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.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.lock.Lock
+ * @see org.apache.jackrabbit.rmi.remote.RemoteLock
+ */
+public class ServerLock extends UnicastRemoteObject 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) throws RemoteException {
+ this.lock = lock;
+ }
+
+ /** {@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 RemoteException {
+ return lock.isLive();
+ }
+
+ /** {@inheritDoc} */
+ public void refresh() throws LockException, RepositoryException,
+ RemoteException {
+ lock.refresh();
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.NamespaceException;
+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.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.NamespaceRegistry
+ * @see org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry
+ */
+public class ServerNamespaceRegistry extends ServerObject implements
+ RemoteNamespaceRegistry {
+
+ /** The adapted local namespace registry. */
+ protected 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 NamespaceException, RepositoryException, RemoteException {
+ registry.registerNamespace(prefix, uri);
+ }
+
+ /** {@inheritDoc} */
+ public void unregisterNamespace(String prefix) throws NamespaceException,
+ RepositoryException, RemoteException {
+ registry.unregisterNamespace(prefix);
+ }
+
+ /** {@inheritDoc} */
+ public String[] getPrefixes() throws RepositoryException, RemoteException {
+ return registry.getPrefixes();
+ }
+
+ /** {@inheritDoc} */
+ public String[] getURIs() throws RepositoryException, RemoteException {
+ return registry.getURIs();
+ }
+
+ /** {@inheritDoc} */
+ public String getURI(String prefix) throws NamespaceException,
+ RepositoryException, RemoteException {
+ return registry.getURI(prefix);
+ }
+
+ /** {@inheritDoc} */
+ public String getPrefix(String uri) throws NamespaceException,
+ RepositoryException, RemoteException {
+ return registry.getPrefix(uri);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,317 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.MergeException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+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.version.VersionException;
+
+import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteLock;
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+
+/**
+ * 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.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Node
+ * @see org.apache.jackrabbit.rmi.remote.RemoteNode
+ */
+public class ServerNode extends ServerItem implements RemoteNode {
+
+ /** The adapted local node. */
+ protected 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 ItemExistsException,
+ PathNotFoundException, ConstraintViolationException,
+ RepositoryException, RemoteException {
+ return factory.getRemoteNode(node.addNode(path));
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNode addNode(String path, String type) throws
+ ItemExistsException, PathNotFoundException,
+ NoSuchNodeTypeException, ConstraintViolationException,
+ RepositoryException, RemoteException {
+ return factory.getRemoteNode(node.addNode(path, type));
+ }
+
+ /** {@inheritDoc} */
+ public RemoteProperty getProperty(String path) throws PathNotFoundException,
+ RepositoryException, RemoteException {
+ return factory.getRemoteProperty(node.getProperty(path));
+ }
+
+ /** {@inheritDoc} */
+ public RemoteProperty[] getProperties() throws RepositoryException,
+ RemoteException {
+ return getRemotePropertyArray(node.getProperties());
+ }
+
+ /** {@inheritDoc} */
+ public RemoteItem getPrimaryItem() throws ItemNotFoundException,
+ RepositoryException, RemoteException {
+ return getRemoteItem(node.getPrimaryItem());
+ }
+
+ /** {@inheritDoc} */
+ public RemoteProperty[] getProperties(String pattern)
+ throws RepositoryException, RemoteException {
+ return getRemotePropertyArray(node.getProperties(pattern));
+ }
+
+ /** {@inheritDoc} */
+ public RemoteProperty[] getReferences() throws RepositoryException,
+ RemoteException {
+ return getRemotePropertyArray(node.getReferences());
+ }
+
+ /** {@inheritDoc} */
+ public String getUUID() throws UnsupportedRepositoryOperationException,
+ RepositoryException, RemoteException {
+ return node.getUUID();
+ }
+
+ /** {@inheritDoc} */
+ public boolean hasNodes() throws RepositoryException, RemoteException {
+ return node.hasNodes();
+ }
+
+ /** {@inheritDoc} */
+ public boolean hasProperties() throws RepositoryException, RemoteException {
+ return node.hasProperties();
+ }
+
+ /** {@inheritDoc} */
+ public boolean hasProperty(String path) throws RepositoryException,
+ RemoteException {
+ return node.hasProperty(path);
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNodeType[] getMixinNodeTypes() throws RepositoryException,
+ RemoteException {
+ return getRemoteNodeTypeArray(node.getMixinNodeTypes());
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNodeType getPrimaryNodeType() throws RepositoryException,
+ RemoteException {
+ return factory.getRemoteNodeType(node.getPrimaryNodeType());
+ }
+
+ /** {@inheritDoc} */
+ public boolean isNodeType(String type) throws RepositoryException,
+ RemoteException {
+ return node.isNodeType(type);
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNode[] getNodes() throws RepositoryException, RemoteException {
+ return getRemoteNodeArray(node.getNodes());
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNode[] getNodes(String pattern) throws RepositoryException,
+ RemoteException {
+ return getRemoteNodeArray(node.getNodes(pattern));
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNode getNode(String path) throws PathNotFoundException,
+ RepositoryException, RemoteException {
+ return factory.getRemoteNode(node.getNode(path));
+ }
+
+ /** {@inheritDoc} */
+ public boolean hasNode(String path) throws RepositoryException,
+ RemoteException {
+ return node.hasNode(path);
+ }
+
+ /** {@inheritDoc} */
+ public RemoteProperty setProperty(String name, Value value)
+ throws ValueFormatException, RepositoryException, RemoteException {
+ return factory.getRemoteProperty(node.setProperty(name, value));
+ }
+
+ /** {@inheritDoc} */
+ public void addMixin(String name) throws NoSuchNodeTypeException,
+ ConstraintViolationException, RepositoryException, RemoteException {
+ node.addMixin(name);
+ }
+
+ /** {@inheritDoc} */
+ public boolean canAddMixin(String name) throws RepositoryException,
+ RemoteException {
+ return node.canAddMixin(name);
+ }
+
+ /** {@inheritDoc} */
+ public void removeMixin(String name) throws NoSuchNodeTypeException,
+ ConstraintViolationException, RepositoryException, RemoteException {
+ node.removeMixin(name);
+ }
+
+ /** {@inheritDoc} */
+ public void orderBefore(String src, String dst)
+ throws UnsupportedRepositoryOperationException,
+ ConstraintViolationException, ItemNotFoundException,
+ RepositoryException, RemoteException {
+ node.orderBefore(src, dst);
+ }
+
+ /** {@inheritDoc} */
+ public RemoteProperty setProperty(String name, Value[] values)
+ throws ValueFormatException, RepositoryException, RemoteException {
+ return factory.getRemoteProperty(node.setProperty(name, values));
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNodeDef getDefinition() throws RepositoryException,
+ RemoteException {
+ return factory.getRemoteNodeDef(node.getDefinition());
+ }
+
+ /** {@inheritDoc} */
+ public void checkout() throws UnsupportedRepositoryOperationException,
+ RepositoryException, RemoteException {
+ node.checkout();
+ }
+
+ /** {@inheritDoc} */
+ public String getCorrespondingNodePath(String workspace)
+ throws ItemNotFoundException, NoSuchWorkspaceException,
+ AccessDeniedException, RepositoryException, RemoteException {
+ return node.getCorrespondingNodePath(workspace);
+ }
+
+ /** {@inheritDoc} */
+ public int getIndex() throws RepositoryException, RemoteException {
+ return node.getIndex();
+ }
+
+ /** {@inheritDoc} */
+ public void merge(String workspace, boolean bestEffort)
+ throws UnsupportedRepositoryOperationException,
+ NoSuchWorkspaceException, AccessDeniedException, MergeException,
+ RepositoryException, RemoteException {
+ node.merge(workspace, bestEffort);
+ }
+
+ /** {@inheritDoc} */
+ public void restore(String version, boolean removeExisting)
+ throws VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ InvalidItemStateException, RepositoryException, RemoteException {
+ node.restore(version, removeExisting);
+ }
+
+ /** {@inheritDoc} */
+ public void restoreByLabel(String label, boolean removeExisting)
+ throws VersionException, ItemExistsException,
+ UnsupportedRepositoryOperationException, LockException,
+ InvalidItemStateException, RepositoryException, RemoteException {
+ node.restoreByLabel(label, removeExisting);
+ }
+
+ /** {@inheritDoc} */
+ public void update(String workspace) throws NoSuchWorkspaceException,
+ AccessDeniedException, RepositoryException, RemoteException {
+ node.update(workspace);
+ }
+
+ /** {@inheritDoc} */
+ public boolean holdsLock() throws RepositoryException, RemoteException {
+ return node.holdsLock();
+ }
+
+ /** {@inheritDoc} */
+ public boolean isCheckedOut() throws
+ UnsupportedRepositoryOperationException, RepositoryException,
+ RemoteException {
+ return node.isCheckedOut();
+ }
+
+ /** {@inheritDoc} */
+ public boolean isLocked() throws RepositoryException, RemoteException {
+ return node.isLocked();
+ }
+
+ /** {@inheritDoc} */
+ public RemoteProperty setProperty(String name, Value[] values, int type)
+ throws ValueFormatException, VersionException, LockException,
+ RepositoryException, RemoteException {
+ return factory.getRemoteProperty(node.setProperty(name, values, type));
+ }
+
+ /** {@inheritDoc} */
+ public void unlock() throws UnsupportedRepositoryOperationException,
+ LockException, AccessDeniedException, RepositoryException,
+ RemoteException {
+ node.unlock();
+ }
+
+ /** {@inheritDoc} */
+ public RemoteLock getLock() throws UnsupportedRepositoryOperationException,
+ LockException, AccessDeniedException, RepositoryException,
+ RemoteException {
+ return factory.getRemoteLock(node.getLock());
+ }
+
+ /** {@inheritDoc} */
+ public RemoteLock lock(boolean isDeep, boolean isSessionScoped)
+ throws UnsupportedRepositoryOperationException, LockException,
+ AccessDeniedException, RepositoryException, RemoteException {
+ return factory.getRemoteLock(node.lock(isDeep, isSessionScoped));
+ }
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeDef.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeDef.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeDef.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.nodetype.NodeDef;
+
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+
+/**
+ * Remote adapter for the JCR {@link javax.jcr.nodetype.NodeDef NodeDef}
+ * interface. This class makes a local node definition available as an
+ * RMI service using the
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteNodeDef RemoteNodeDef}
+ * interface.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.NodeDef
+ * @see org.apache.jackrabbit.rmi.remote.RemoteNodeDef
+ */
+public class ServerNodeDef extends ServerItemDef implements RemoteNodeDef {
+
+ /** The adapted node definition. */
+ protected NodeDef 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 ServerNodeDef(NodeDef 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 {
+ return factory.getRemoteNodeType(def.getDefaultPrimaryType());
+ }
+
+ /** {@inheritDoc} */
+ public boolean allowSameNameSibs() throws RemoteException {
+ return def.allowSameNameSibs();
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Value;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.PropertyDef;
+
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+
+/**
+ * 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.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.NodeType
+ * @see org.apache.jackrabbit.rmi.remote.RemoteNodeType
+ */
+public class ServerNodeType extends ServerObject implements RemoteNodeType {
+
+ /** The adapted local node type. */
+ protected 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;
+ }
+
+ /** {@inheritDoc} */
+ public String getName() throws RemoteException {
+ return type.getName();
+ }
+
+ /** {@inheritDoc} */
+ public boolean isMixin() throws RemoteException {
+ return type.isMixin();
+ }
+
+ /** {@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 RemotePropertyDef[] getPropertyDefs() throws RemoteException {
+ PropertyDef[] defs = type.getPropertyDefs();
+ return getRemotePropertyDefArray(defs);
+ }
+
+ /** {@inheritDoc} */
+ public RemotePropertyDef[] getDeclaredPropertyDefs() throws RemoteException {
+ PropertyDef[] defs = type.getDeclaredPropertyDefs();
+ return getRemotePropertyDefArray(defs);
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNodeDef[] getChildNodeDefs() throws RemoteException {
+ return getRemoteNodeDefArray(type.getChildNodeDefs());
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNodeDef[] getDeclaredChildNodeDefs() throws RemoteException {
+ return getRemoteNodeDefArray(type.getDeclaredChildNodeDefs());
+ }
+
+ /** {@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();
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeTypeManager;
+
+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.
+ *
+ * @author Jukka Zitting
+ * @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. */
+ protected 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
+ NoSuchNodeTypeException, RepositoryException, RemoteException {
+ return factory.getRemoteNodeType(manager.getNodeType(name));
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNodeType[] getAllNodeTypes() throws RepositoryException,
+ RemoteException {
+ return getRemoteNodeTypeArray(manager.getAllNodeTypes());
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNodeType[] getPrimaryNodeTypes() throws RepositoryException,
+ RemoteException {
+ return getRemoteNodeTypeArray(manager.getPrimaryNodeTypes());
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNodeType[] getMixinNodeTypes() throws RepositoryException,
+ RemoteException {
+ return getRemoteNodeTypeArray(manager.getMixinNodeTypes());
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+import javax.jcr.Item;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.PropertyDef;
+
+import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+
+/**
+ * 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.
+ *
+ * @author Jukka Zitting
+ */
+public class ServerObject extends UnicastRemoteObject {
+
+ /** Factory for creating server adapters. */
+ protected RemoteAdapterFactory factory;
+
+ /**
+ * Creates a basic server adapter that uses the given factory
+ * to create new adapters.
+ *
+ * @param factory remote adapter factory
+ */
+ protected ServerObject(RemoteAdapterFactory factory)
+ throws RemoteException {
+ this.factory = factory;
+ }
+
+ /**
+ * 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.
+ *
+ * @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 factory.getRemoteNode((Node) item);
+ } else {
+ return factory.getRemoteItem(item);
+ }
+ }
+
+ /**
+ * Utility method for creating an array of remote references for
+ * local properties. The remote references are created using the
+ * remote adapter factory.
+ * <p>
+ * A <code>null</code> input is treated as an empty iterator.
+ *
+ * @param iterator local property iterator
+ * @return remote property array
+ * @throws RemoteException on RMI errors
+ */
+ protected RemoteProperty[] getRemotePropertyArray(PropertyIterator iterator)
+ throws RemoteException {
+ if (iterator == null) {
+ return new RemoteProperty[0]; // for safety
+ }
+
+ RemoteProperty[] remotes = new RemoteProperty[(int) iterator.getSize()];
+ for (int i = 0; iterator.hasNext(); i++) {
+ remotes[i] = factory.getRemoteProperty(iterator.nextProperty());
+ }
+ return remotes;
+ }
+
+ /**
+ * Utility method for creating an array of remote references for
+ * local nodes. The remote references are created using the
+ * remote adapter factory.
+ * <p>
+ * A <code>null</code> input is treated as an empty iterator.
+ *
+ * @param iterator local node iterator
+ * @return remote node array
+ * @throws RemoteException on RMI errors
+ */
+ protected RemoteNode[] getRemoteNodeArray(NodeIterator iterator)
+ throws RemoteException {
+ if (iterator == null) {
+ return new RemoteNode[0]; // for safety
+ }
+
+ RemoteNode[] remotes = new RemoteNode[(int) iterator.getSize()];
+ for (int i = 0; iterator != null && iterator.hasNext(); i++) {
+ remotes[i] = factory.getRemoteNode(iterator.nextNode());
+ }
+ return remotes;
+ }
+
+ /**
+ * Utility method for creating an array of remote references for
+ * local node types. The remote references are created using the
+ * remote adapter factory.
+ * <p>
+ * A <code>null</code> 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) {
+ return new RemoteNodeType[0]; // for safety
+ }
+
+ RemoteNodeType[] remotes = new RemoteNodeType[types.length];
+ for (int i = 0; i < types.length; i++) {
+ remotes[i] = factory.getRemoteNodeType(types[i]);
+ }
+ return remotes;
+ }
+
+ /**
+ * Utility method for creating an array of remote references for
+ * local node types. The remote references are created using the
+ * remote adapter factory.
+ * <p>
+ * A <code>null</code> input is treated as an empty iterator.
+ *
+ * @param iterator local node type iterator
+ * @return remote node type array
+ * @throws RemoteException on RMI errors
+ */
+ protected RemoteNodeType[] getRemoteNodeTypeArray(NodeTypeIterator iterator)
+ throws RemoteException {
+ if (iterator == null) {
+ return new RemoteNodeType[0]; // for safety
+ }
+
+ RemoteNodeType[] remotes = new RemoteNodeType[(int) iterator.getSize()];
+ for (int i = 0; iterator.hasNext(); i++) {
+ remotes[i] = factory.getRemoteNodeType(iterator.nextNodeType());
+ }
+ return remotes;
+ }
+
+ /**
+ * Utility method for creating an array of remote references for
+ * local node definitions. The remote references are created using the
+ * remote adapter factory.
+ * <p>
+ * A <code>null</code> input is treated as an empty array.
+ *
+ * @param defs local node definition array
+ * @return remote node definition array
+ * @throws RemoteException on RMI errors
+ */
+ protected RemoteNodeDef[] getRemoteNodeDefArray(NodeDef[] defs)
+ throws RemoteException {
+ if (defs == null) {
+ return new RemoteNodeDef[0]; // for safety
+ }
+
+ RemoteNodeDef[] remotes = new RemoteNodeDef[defs.length];
+ for (int i = 0; i < defs.length; i++) {
+ remotes[i] = factory.getRemoteNodeDef(defs[i]);
+ }
+ return remotes;
+ }
+
+ /**
+ * Utility method for creating an array of remote references for
+ * local property definitions. The remote references are created using the
+ * remote adapter factory.
+ * <p>
+ * A <code>null</code> input is treated as an empty array.
+ *
+ * @param defs local property definition array
+ * @return remote property definition array
+ * @throws RemoteException on RMI errors
+ */
+ protected RemotePropertyDef[] getRemotePropertyDefArray(PropertyDef[] defs)
+ throws RemoteException {
+ if (defs == null) {
+ return new RemotePropertyDef[0]; // for safety
+ }
+
+ RemotePropertyDef[] remotes = new RemotePropertyDef[defs.length];
+ for (int i = 0; i < defs.length; i++) {
+ remotes[i] = factory.getRemotePropertyDef(defs[i]);
+ }
+ return remotes;
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerProperty.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerProperty.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerProperty.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+import org.apache.jackrabbit.rmi.remote.SerialValue;
+
+/**
+ * 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.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Property
+ * @see org.apache.jackrabbit.rmi.remote.RemoteProperty
+ */
+public class ServerProperty extends ServerItem implements RemoteProperty {
+
+ /** The adapted local property. */
+ protected 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 ValueFormatException, RepositoryException,
+ RemoteException {
+ return new SerialValue(property.getValue());
+ }
+
+ /** {@inheritDoc} */
+ public Value[] getValues() throws ValueFormatException,
+ RepositoryException, RemoteException {
+ return SerialValue.makeSerialValueArray(property.getValues());
+ }
+
+ /** {@inheritDoc} */
+ public void setValue(Value value) throws ValueFormatException,
+ RepositoryException, RemoteException {
+ property.setValue(value);
+ }
+
+ /** {@inheritDoc} */
+ public void setValue(Value[] values) throws ValueFormatException,
+ RepositoryException, RemoteException {
+ property.setValue(values);
+ }
+
+ /** {@inheritDoc} */
+ public long getLength() throws ValueFormatException, RepositoryException,
+ RemoteException {
+ return property.getLength();
+ }
+
+ /** {@inheritDoc} */
+ public long[] getLengths() throws ValueFormatException,
+ RepositoryException, RemoteException {
+ return property.getLengths();
+ }
+
+ /** {@inheritDoc} */
+ public RemotePropertyDef getDefinition() throws RepositoryException,
+ RemoteException {
+ return factory.getRemotePropertyDef(property.getDefinition());
+ }
+
+ /** {@inheritDoc} */
+ public int getType() throws RepositoryException, RemoteException {
+ return property.getType();
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerPropertyDef.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerPropertyDef.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerPropertyDef.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Value;
+import javax.jcr.nodetype.PropertyDef;
+
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+
+/**
+ * Remote adapter for the JCR
+ * {@link javax.jcr.nodetype.PropertyDef PropertyDef} interface. This
+ * class makes a local property definition available as an RMI service
+ * using the
+ * {@link org.apache.jackrabbit.rmi.remote.RemotePropertyDef RemotePropertyDef}
+ * interface.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.nodetype.PropertyDef
+ * @see org.apache.jackrabbit.rmi.remote.RemotePropertyDef
+ */
+public class ServerPropertyDef extends ServerItemDef
+ implements RemotePropertyDef {
+
+ /** The adapted local property definition. */
+ protected PropertyDef 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 ServerPropertyDef(PropertyDef 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 {
+ return def.getDefaultValues();
+ }
+
+ /** {@inheritDoc} */
+ public boolean isMultiple() throws RemoteException {
+ return def.isMultiple();
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Credentials;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.jackrabbit.rmi.remote.RemoteRepository;
+import org.apache.jackrabbit.rmi.remote.RemoteSession;
+
+/**
+ * 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.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Repository
+ * @see org.apache.jackrabbit.rmi.remote.RemoteRepository
+ */
+public class ServerRepository extends ServerObject implements RemoteRepository {
+
+ /** The adapted local repository. */
+ protected 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 LoginException,
+ NoSuchWorkspaceException, RepositoryException, RemoteException {
+ Session session = repository.login();
+ return factory.getRemoteSession(session);
+ }
+
+ /** {@inheritDoc} */
+ public RemoteSession login(String workspace) throws LoginException,
+ NoSuchWorkspaceException, RepositoryException, RemoteException {
+ Session session = repository.login(workspace);
+ return factory.getRemoteSession(session);
+ }
+
+ /** {@inheritDoc} */
+ public RemoteSession login(Credentials credentials) throws LoginException,
+ NoSuchWorkspaceException, RepositoryException, RemoteException {
+ Session session = repository.login(credentials);
+ return factory.getRemoteSession(session);
+ }
+
+ /** {@inheritDoc} */
+ public RemoteSession login(Credentials credentials, String workspace)
+ throws LoginException, NoSuchWorkspaceException,
+ RepositoryException, RemoteException {
+ Session session = repository.login(credentials, workspace);
+ return factory.getRemoteSession(session);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,223 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.rmi.RemoteException;
+import java.security.AccessControlException;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Credentials;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.InvalidSerializedDataException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.LoginException;
+import javax.jcr.NamespaceException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+
+import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteSession;
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+
+/**
+ * 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.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Session
+ * @see org.apache.jackrabbit.rmi.remote.RemoteSession
+ */
+public class ServerSession extends ServerObject implements RemoteSession {
+
+ /** The adapted local session. */
+ protected Session session;
+
+ /**
+ * 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 LoginException, RepositoryException, RemoteException {
+ return factory.getRemoteSession(session.impersonate(credentials));
+ }
+
+ /** {@inheritDoc} */
+ public RemoteWorkspace getWorkspace() throws RemoteException {
+ return factory.getRemoteWorkspace(session.getWorkspace());
+ }
+
+ /** {@inheritDoc} */
+ public void checkPermission(String path, String actions)
+ throws AccessControlException, RemoteException {
+ session.checkPermission(path, actions);
+ }
+
+ /** {@inheritDoc} */
+ public String getNamespacePrefix(String uri) throws NamespaceException,
+ RepositoryException, RemoteException {
+ return session.getNamespacePrefix(uri);
+ }
+
+ /** {@inheritDoc} */
+ public String[] getNamespacePrefixes() throws RepositoryException,
+ RemoteException {
+ return session.getNamespacePrefixes();
+ }
+
+ /** {@inheritDoc} */
+ public String getNamespaceURI(String prefix) throws NamespaceException,
+ RepositoryException, RemoteException {
+ return session.getNamespaceURI(prefix);
+ }
+
+ /** {@inheritDoc} */
+ public void setNamespacePrefix(String prefix, String uri)
+ throws NamespaceException, RepositoryException, RemoteException {
+ session.setNamespacePrefix(prefix, uri);
+ }
+
+ /** {@inheritDoc} */
+ public boolean itemExists(String path) throws RemoteException {
+ return session.itemExists(path);
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNode getNodeByUUID(String uuid) throws ItemNotFoundException,
+ RepositoryException, RemoteException {
+ return factory.getRemoteNode(session.getNodeByUUID(uuid));
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNode getRootNode() throws RepositoryException,
+ RemoteException {
+ return factory.getRemoteNode(session.getRootNode());
+ }
+
+ /** {@inheritDoc} */
+ public RemoteItem getItem(String path) throws PathNotFoundException,
+ RepositoryException, RemoteException {
+ return getRemoteItem(session.getItem(path));
+ }
+
+ /** {@inheritDoc} */
+ public boolean hasPendingChanges() throws RepositoryException,
+ RemoteException {
+ return session.hasPendingChanges();
+ }
+
+ /** {@inheritDoc} */
+ public void move(String from, String to) throws ItemExistsException,
+ PathNotFoundException, ConstraintViolationException,
+ RepositoryException, RemoteException {
+ session.move(from, to);
+ }
+
+ /** {@inheritDoc} */
+ public void save() throws AccessDeniedException, LockException,
+ ConstraintViolationException, InvalidItemStateException,
+ RepositoryException, RemoteException {
+ session.save();
+ }
+
+ /** {@inheritDoc} */
+ public void refresh(boolean keepChanges) throws RepositoryException,
+ RemoteException {
+ session.refresh(keepChanges);
+ }
+
+ /** {@inheritDoc} */
+ public void logout() throws RemoteException {
+ session.logout();
+ }
+
+ /** {@inheritDoc} */
+ public void importXML(String path, byte[] xml) throws IOException,
+ PathNotFoundException, ItemExistsException,
+ ConstraintViolationException, InvalidSerializedDataException,
+ RepositoryException, RemoteException {
+ session.importXML(path, new ByteArrayInputStream(xml));
+ }
+
+ /** {@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[] exportDocView(String path, boolean binaryAsLink,
+ boolean noRecurse) throws InvalidSerializedDataException,
+ PathNotFoundException, IOException, RepositoryException,
+ RemoteException {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ session.exportDocView(path, buffer, binaryAsLink, noRecurse);
+ return buffer.toByteArray();
+ }
+
+ /** {@inheritDoc} */
+ public byte[] exportSysView(String path, boolean binaryAsLink,
+ boolean noRecurse) throws PathNotFoundException, IOException,
+ RepositoryException, RemoteException {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ session.exportSysView(path, buffer, binaryAsLink, noRecurse);
+ return buffer.toByteArray();
+ }
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.rmi.RemoteException;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidSerializedDataException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Workspace;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NodeTypeManager;
+
+import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+
+/**
+ * Remote adapter for the JCR {@link javax.jcr.Workspace Workspace} interface.
+ * This class makes a local workspace available as an RMI service using the
+ * {@link org.apache.jackrabbit.rmi.remote.RemoteWorkspace RemoteWorkspace}
+ * interface.
+ *
+ * @author Jukka Zitting
+ * @see javax.jcr.Workspace
+ * @see org.apache.jackrabbit.rmi.remote.RemoteWorkspace
+ */
+public class ServerWorkspace extends ServerObject implements RemoteWorkspace {
+
+ /** The adapted local workspace. */
+ protected Workspace workspace;
+
+ /**
+ * 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 ConstraintViolationException, AccessDeniedException,
+ PathNotFoundException, ItemExistsException, RepositoryException,
+ RemoteException {
+ workspace.copy(from, to);
+ }
+
+ /** {@inheritDoc} */
+ public void copy(String from, String to, String workspace)
+ throws NoSuchWorkspaceException, ConstraintViolationException,
+ AccessDeniedException, PathNotFoundException, ItemExistsException,
+ RepositoryException, RemoteException {
+ this.workspace.copy(from, to, workspace);
+ }
+
+ /** {@inheritDoc} */
+ public void clone(String workspace, String from, String to,
+ boolean removeExisting) throws NoSuchWorkspaceException,
+ ConstraintViolationException, AccessDeniedException,
+ PathNotFoundException, ItemExistsException, RepositoryException,
+ RemoteException {
+ this.workspace.clone(workspace, from, to, removeExisting);
+ }
+
+ /** {@inheritDoc} */
+ public void move(String from, String to)
+ throws ConstraintViolationException, AccessDeniedException,
+ PathNotFoundException, ItemExistsException, RepositoryException,
+ RemoteException {
+ workspace.move(from, to);
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNodeTypeManager getNodeTypeManager()
+ throws RepositoryException, RemoteException {
+ NodeTypeManager manager = workspace.getNodeTypeManager();
+ return factory.getRemoteNodeTypeManager(manager);
+ }
+
+ /** {@inheritDoc} */
+ public RemoteNamespaceRegistry getNamespaceRegistry()
+ throws RepositoryException, RemoteException {
+ NamespaceRegistry registry = workspace.getNamespaceRegistry();
+ return factory.getRemoteNamespaceRegistry(registry);
+ }
+
+ /** {@inheritDoc} */
+ public String[] getAccessibleWorkspaceNames() throws RepositoryException,
+ RemoteException {
+ return workspace.getAccessibleWorkspaceNames();
+ }
+
+ /** {@inheritDoc} */
+ public void importXML(String path, byte[] xml, int uuidBehaviour)
+ throws IOException, PathNotFoundException, ItemExistsException,
+ ConstraintViolationException, InvalidSerializedDataException,
+ LockException, RepositoryException, RemoteException {
+ workspace.importXML(path, new ByteArrayInputStream(xml), uuidBehaviour);
+ }
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/package.html
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/package.html?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/package.html Sat Jan 29 03:20:38 2005
@@ -0,0 +1,64 @@
+<body>
+Server implementation of the transparent JCR-RMI layer.
+<p>
+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.
+<p>
+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.
+
+<h2>Setting up a JCR-RMI server</h2>
+<p>
+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.):
+
+<pre>
+ 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
+</pre>
+
+<h2>Extending the JCR-RMI server</h2>
+<p>
+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.
+<p>
+The following example code adds transparent logging of all session logins
+and logouts:
+
+<pre>
+ 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
+</pre>
+
+</body>
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/ImportContentHandler.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/ImportContentHandler.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/ImportContentHandler.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.xml;
+
+import java.io.ByteArrayOutputStream;
+
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+/**
+ * Base class for a SAX content handler for importing XML data. This
+ * class provides a general mechanism for converting a SAX event stream
+ * to raw XML data and feeding the received byte array into an import
+ * method. Subclasses can provide different import mechanisms simply by
+ * implementing the abstract {@link #importXML(byte[]) importXML(byte[])}
+ * method.
+ *
+ * @author Jukka Zitting
+ */
+public abstract class ImportContentHandler implements ContentHandler {
+
+ /** Internal buffer for the XML byte stream. */
+ private ByteArrayOutputStream buffer;
+
+ /** The internal XML serializer. */
+ private ContentHandler handler;
+
+ /**
+ * Creates a SAX content handler for importing XML data.
+ */
+ public ImportContentHandler() {
+ this.buffer = new ByteArrayOutputStream();
+ this.handler = new XMLSerializer(buffer, new OutputFormat());
+ }
+
+ /**
+ * Imports the given XML data. This method is called by the
+ * {@link #endDocument() endDocument()} method after the received
+ * XML stream has been serialized.
+ * <p>
+ * Subclasses must implement this method to provide the actual
+ * import mechanism.
+ *
+ * @param xml the XML data to import
+ * @throws Exception on import errors
+ */
+ protected abstract void importXML(byte[] xml) throws Exception;
+
+ /** {@inheritDoc} */
+ public void setDocumentLocator(Locator locator) {
+ handler.setDocumentLocator(locator);
+ }
+
+ /** {@inheritDoc} */
+ public void startDocument() throws SAXException {
+ handler.startDocument();
+ }
+
+ /** {@inheritDoc} */
+ public void endDocument() throws SAXException {
+ handler.endDocument();
+ try {
+ importXML(buffer.toByteArray());
+ } catch (Exception ex) {
+ throw new SAXException(ex);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void startPrefixMapping(String prefix, String uri)
+ throws SAXException {
+ handler.startPrefixMapping(prefix, uri);
+ }
+
+ /** {@inheritDoc} */
+ public void endPrefixMapping(String prefix) throws SAXException {
+ handler.endPrefixMapping(prefix);
+ }
+
+ /** {@inheritDoc} */
+ public void startElement(String uri, String localName, String qName,
+ Attributes atts) throws SAXException {
+ handler.startElement(uri, localName, qName, atts);
+ }
+
+ /** {@inheritDoc} */
+ public void endElement(String uri, String localName, String qName)
+ throws SAXException {
+ handler.endElement(uri, localName, qName);
+ }
+
+ /** {@inheritDoc} */
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ handler.characters(ch, start, length);
+ }
+
+ /** {@inheritDoc} */
+ public void ignorableWhitespace(char[] ch, int start, int length)
+ throws SAXException {
+ handler.ignorableWhitespace(ch, start, length);
+ }
+
+ /** {@inheritDoc} */
+ public void processingInstruction(String target, String data)
+ throws SAXException {
+ handler.processingInstruction(target, data);
+ }
+
+ /** {@inheritDoc} */
+ public void skippedEntity(String name) throws SAXException {
+ handler.skippedEntity(name);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/SessionImportContentHandler.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/SessionImportContentHandler.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/SessionImportContentHandler.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.xml;
+
+import java.io.ByteArrayInputStream;
+
+import javax.jcr.Session;
+
+
+/**
+ * SAX content handler for importing XML data to a JCR {@link Session Session}.
+ * This utility class can be used to implement the
+ * {@link Session#getImportContentHandler(String) Session.getImportContentHandler(String)}
+ * method in terms of the
+ * {@link Session#importXML(String, java.io.InputStream) Session.importXML(String, InputStream)}
+ * method.
+ *
+ * @author Jukka Zitting
+ */
+public class SessionImportContentHandler extends ImportContentHandler {
+
+ /** The repository session. */
+ private Session session;
+
+ /** The import content path. */
+ private String path;
+
+ /**
+ * Creates a SAX content handler for importing XML data to the given
+ * session and path.
+ *
+ * @param session repository session
+ * @param path import content path
+ */
+ public SessionImportContentHandler(Session session, String path) {
+ this.session = session;
+ this.path = path;
+ }
+
+ /**
+ * Imports the serialized XML stream using the standard
+ * {@link Session#importXML(String, java.io.InputStream) Session.importXML(String, InputStream)}
+ * method.
+ *
+ * {@inheritDoc}
+ */
+ protected void importXML(byte[] xml) throws Exception {
+ session.importXML(path, new ByteArrayInputStream(xml));
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/WorkspaceImportContentHandler.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/WorkspaceImportContentHandler.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/WorkspaceImportContentHandler.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.xml;
+
+import java.io.ByteArrayInputStream;
+
+import javax.jcr.Workspace;
+
+
+/**
+ * SAX content handler for importing XML data to a JCR {@link Workspace Workspace}.
+ * This utility class can be used to implement the
+ * {@link Workspace#getImportContentHandler(String, int) Workspace.getImportContentHandler(String, int)}
+ * method in terms of the
+ * {@link Workspace#importXML(String, java.io.InputStream, int) Workspace.importXML(String, InputStream, int)}
+ * method.
+ *
+ * @author Jukka Zitting
+ */
+public class WorkspaceImportContentHandler extends ImportContentHandler {
+
+ /** The repository workspace. */
+ private Workspace workspace;
+
+ /** The import content path. */
+ private String path;
+
+ /** The UUID behaviour. */
+ private int uuidBehaviour;
+
+ /**
+ * Creates a SAX content handler for importing XML data to the given
+ * workspace and path using the given UUID behaviour.
+ *
+ * @param workspace repository workspace
+ * @param path import content path
+ * @param uuidBehaviour UUID behaviour
+ */
+ public WorkspaceImportContentHandler(Workspace workspace, String path, int uuidBehaviour) {
+ this.workspace = workspace;
+ this.path = path;
+ this.uuidBehaviour = uuidBehaviour;
+ }
+
+ /**
+ * Imports the serialized XML stream using the standard
+ * {@link Workspace#importXML(String, java.io.InputStream, int) Workspace.importXML(String, InputStream, int)}
+ * method.
+ *
+ * {@inheritDoc}
+ */
+ protected void importXML(byte[] xml) throws Exception {
+ workspace.importXML(path, new ByteArrayInputStream(xml), uuidBehaviour);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/package.html
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/package.html?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/xml/package.html Sat Jan 29 03:20:38 2005
@@ -0,0 +1,15 @@
+<body>
+Utility classes for importing SAX event streams.
+<p>
+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.
+<p>
+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.
+</body>
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteItemDefTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteItemDefTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteItemDefTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.nodetype.ItemDef;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientItemDef;
+import org.apache.jackrabbit.rmi.remote.RemoteItemDef;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerItemDef;
+import org.easymock.MockControl;
+
+public class RemoteItemDefTest extends TestCase {
+
+ private MockControl control;
+
+ private ItemDef mock;
+
+ private ItemDef def;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(ItemDef.class);
+ mock = (ItemDef) control.getMock();
+
+ RemoteItemDef remote =
+ new ServerItemDef(mock, new ServerAdapterFactory());
+ def = new ClientItemDef(remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(ItemDef.class);
+ helper.testRemoteMethods(def, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteItemTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteItemTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteItemTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.Item;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientItem;
+import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerItem;
+import org.easymock.MockControl;
+
+public class RemoteItemTest extends TestCase {
+
+ private MockControl control;
+
+ private Item mock;
+
+ private Item item;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(Item.class);
+ mock = (Item) control.getMock();
+
+ RemoteItem remote = new ServerItem(mock, new ServerAdapterFactory());
+ item = new ClientItem(null, remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(Item.class);
+ helper.ignoreMethod("accept"); // implemented in subclasses
+ helper.ignoreMethod("getSession"); // implemented locally
+ helper.ignoreMethod("isNode"); // implemented in subclasses
+ helper.ignoreMethod("isSame"); // implemented locally
+ helper.testRemoteMethods(item, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteLockTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteLockTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteLockTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.lock.Lock;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientLock;
+import org.apache.jackrabbit.rmi.remote.RemoteLock;
+import org.apache.jackrabbit.rmi.server.ServerLock;
+import org.easymock.MockControl;
+
+public class RemoteLockTest extends TestCase {
+
+ private MockControl control;
+
+ private Lock mock;
+
+ private Lock lock;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(Lock.class);
+ mock = (Lock) control.getMock();
+
+ RemoteLock remote = new ServerLock(mock);
+ lock = new ClientLock(null, remote);
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(Lock.class);
+ helper.ignoreMethod("getNode"); // implemented locally
+ helper.testRemoteMethods(lock, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNamespaceRegistryTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNamespaceRegistryTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNamespaceRegistryTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.NamespaceRegistry;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientNamespaceRegistry;
+import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerNamespaceRegistry;
+import org.easymock.MockControl;
+
+public class RemoteNamespaceRegistryTest extends TestCase {
+
+ private MockControl control;
+
+ private NamespaceRegistry mock;
+
+ private NamespaceRegistry registry;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(NamespaceRegistry.class);
+ mock = (NamespaceRegistry) control.getMock();
+
+ RemoteNamespaceRegistry remote =
+ new ServerNamespaceRegistry(mock, new ServerAdapterFactory());
+ registry =
+ new ClientNamespaceRegistry(remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(NamespaceRegistry.class);
+ helper.testRemoteMethods(registry, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeDefTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeDefTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeDefTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.nodetype.NodeDef;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientNodeDef;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeDef;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerNodeDef;
+import org.easymock.MockControl;
+
+public class RemoteNodeDefTest extends TestCase {
+
+ private MockControl control;
+
+ private NodeDef mock;
+
+ private NodeDef def;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(NodeDef.class);
+ mock = (NodeDef) control.getMock();
+
+ RemoteNodeDef remote =
+ new ServerNodeDef(mock, new ServerAdapterFactory());
+ def = new ClientNodeDef(remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(NodeDef.class);
+ helper.testRemoteMethods(def, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.Node;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientNode;
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerNode;
+import org.easymock.MockControl;
+
+public class RemoteNodeTest extends TestCase {
+
+ private MockControl control;
+
+ private Node mock;
+
+ private Node node;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(Node.class);
+ mock = (Node) control.getMock();
+
+ RemoteNode remote = new ServerNode(mock, new ServerAdapterFactory());
+ node = new ClientNode(null, remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(Node.class);
+ helper.ignoreMethod("cancelMerge"); // TODO
+ helper.ignoreMethod("doneMerge"); // TODO
+ helper.ignoreMethod("checkin"); // TODO
+ helper.ignoreMethod("restore"); // multiple methods
+ helper.ignoreMethod("getVersionHistory"); // TODO
+ helper.ignoreMethod("getBaseVersion"); // TODO
+ helper.ignoreMethod("setProperty"); // multiple methods
+ helper.testRemoteMethods(node, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTypeManagerTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTypeManagerTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTypeManagerTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.nodetype.NodeTypeManager;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientNodeTypeManager;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerNodeTypeManager;
+import org.easymock.MockControl;
+
+public class RemoteNodeTypeManagerTest extends TestCase {
+
+ private MockControl control;
+
+ private NodeTypeManager mock;
+
+ private NodeTypeManager manager;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(NodeTypeManager.class);
+ mock = (NodeTypeManager) control.getMock();
+
+ RemoteNodeTypeManager remote =
+ new ServerNodeTypeManager(mock, new ServerAdapterFactory());
+ manager = new ClientNodeTypeManager(remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(NodeTypeManager.class);
+ helper.testRemoteMethods(manager, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTypeTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTypeTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteNodeTypeTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.nodetype.NodeType;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientNodeType;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerNodeType;
+import org.easymock.MockControl;
+
+public class RemoteNodeTypeTest extends TestCase {
+
+ private MockControl control;
+
+ private NodeType mock;
+
+ private NodeType type;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(NodeType.class);
+ mock = (NodeType) control.getMock();
+
+ RemoteNodeType remote =
+ new ServerNodeType(mock, new ServerAdapterFactory());
+ type = new ClientNodeType(remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(NodeType.class);
+ helper.ignoreMethod("canSetProperty"); // wrapped Value object
+ helper.testRemoteMethods(type, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemotePropertyDefTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemotePropertyDefTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemotePropertyDefTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.nodetype.PropertyDef;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientPropertyDef;
+import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerPropertyDef;
+import org.easymock.MockControl;
+
+public class RemotePropertyDefTest extends TestCase {
+
+ private MockControl control;
+
+ private PropertyDef mock;
+
+ private PropertyDef def;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(PropertyDef.class);
+ mock = (PropertyDef) control.getMock();
+
+ RemotePropertyDef remote =
+ new ServerPropertyDef(mock, new ServerAdapterFactory());
+ def = new ClientPropertyDef(remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(PropertyDef.class);
+ helper.testRemoteMethods(def, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemotePropertyTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemotePropertyTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemotePropertyTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.Property;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientProperty;
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerProperty;
+import org.easymock.MockControl;
+
+public class RemotePropertyTest extends TestCase {
+
+ private MockControl control;
+
+ private Property mock;
+
+ private Property property;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(Property.class);
+ mock = (Property) control.getMock();
+
+ RemoteProperty remote =
+ new ServerProperty(mock, new ServerAdapterFactory());
+ property = new ClientProperty(null, remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(Property.class);
+ helper.ignoreMethod("getBoolean"); // implemented locally
+ helper.ignoreMethod("getLong"); // implemented locally
+ helper.ignoreMethod("getDouble"); // implemented locally
+ helper.ignoreMethod("getDate"); // implemented locally
+ helper.ignoreMethod("getString"); // implemented locally
+ helper.ignoreMethod("getStream"); // implemented locally
+ helper.ignoreMethod("getNode"); // implemented locally
+ helper.ignoreMethod("setValue"); // multiple methods
+ helper.testRemoteMethods(property, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteRepositoryTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteRepositoryTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteRepositoryTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.Repository;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientRepository;
+import org.apache.jackrabbit.rmi.remote.RemoteRepository;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerRepository;
+import org.easymock.MockControl;
+
+public class RemoteRepositoryTest extends TestCase {
+
+ private MockControl control;
+
+ private Repository mock;
+
+ private Repository repository;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(Repository.class);
+ mock = (Repository) control.getMock();
+
+ RemoteRepository remote =
+ new ServerRepository(mock, new ServerAdapterFactory());
+ repository = new ClientRepository(remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(Repository.class);
+ helper.testRemoteMethods(repository, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteSessionTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteSessionTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteSessionTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.Session;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientSession;
+import org.apache.jackrabbit.rmi.remote.RemoteSession;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerSession;
+import org.easymock.MockControl;
+
+public class RemoteSessionTest extends TestCase {
+
+ private MockControl control;
+
+ private Session mock;
+
+ private Session session;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(Session.class);
+ mock = (Session) control.getMock();
+
+ RemoteSession remote =
+ new ServerSession(mock, new ServerAdapterFactory());
+ session = new ClientSession(null, remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(Session.class);
+ helper.ignoreMethod("getRepository"); // implemented locally
+ helper.ignoreMethod("importXML"); // wrapped stream
+ helper.ignoreMethod("getImportContentHandler"); // implemented locally
+ helper.ignoreMethod("exportSysView"); // multiple methods
+ helper.ignoreMethod("exportDocView"); // multiple method
+ helper.testRemoteMethods(session, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteTestHelper.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteTestHelper.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteTestHelper.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.easymock.MockControl;
+
+/**
+ * TODO
+ */
+public class RemoteTestHelper {
+
+ private Map methods;
+
+ public RemoteTestHelper(Class iface) {
+ methods = new HashMap();
+ Method[] m = iface.getDeclaredMethods();
+ for (int i = 0; i < m.length; i++) {
+ methods.put(m[i].getName(), m[i]);
+ }
+ }
+
+ public void ignoreMethod(String name) {
+ methods.remove(name);
+ }
+
+ private Object[] getParameters(Method method) {
+ Class[] types = method.getParameterTypes();
+ Object[] parameters = new Object[types.length];
+ for (int i = 0; i < types.length; i++) {
+ if (!types[i].isPrimitive()) {
+ parameters[i] = null;
+ } else if ("int".equals(types[i].getName())) {
+ parameters[i] = new Integer(0);
+ } else if ("boolean".equals(types[i].getName())) {
+ parameters[i] = new Boolean(false);
+ } else {
+ System.out.println(types[i].getName());
+ parameters[i] = null;
+ }
+ }
+ return parameters;
+ }
+
+ private void setReturnValue(Method method, MockControl control) {
+ Class type = method.getReturnType();
+ if (!type.isPrimitive()) {
+ control.setReturnValue(null);
+ } else if ("void".equals(type.getName())) {
+ control.setVoidCallable();
+ } else if ("int".equals(type.getName())) {
+ control.setReturnValue((int) 0);
+ } else if ("long".equals(type.getName())) {
+ control.setReturnValue((long) 0);
+ } else if ("boolean".equals(type.getName())) {
+ control.setReturnValue(false);
+ } else {
+ System.out.println(type.getName());
+ control.setReturnValue(null);
+ }
+ }
+
+ public void testRemoteMethods(Object frontend, Object backend,
+ MockControl control) throws Exception {
+ Iterator iterator = methods.values().iterator();
+ while (iterator.hasNext()) {
+ Method method = (Method) iterator.next();
+ Object[] parameters = getParameters(method);
+
+ method.invoke(backend, parameters);
+ setReturnValue(method, control);
+ control.replay();
+
+ method.invoke(frontend, parameters);
+ control.verify();
+
+ control.reset();
+ }
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteWorkspaceTest.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteWorkspaceTest.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteWorkspaceTest.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import javax.jcr.Workspace;
+
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.client.ClientWorkspace;
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerWorkspace;
+import org.easymock.MockControl;
+
+public class RemoteWorkspaceTest extends TestCase {
+
+ private MockControl control;
+
+ private Workspace mock;
+
+ private Workspace workspace;
+
+ protected void setUp() throws Exception {
+ control = MockControl.createControl(Workspace.class);
+ mock = (Workspace) control.getMock();
+
+ RemoteWorkspace remote =
+ new ServerWorkspace(mock, new ServerAdapterFactory());
+ workspace = new ClientWorkspace(null, remote, new ClientAdapterFactory());
+ }
+
+ public void testRemoteMethods() throws Exception {
+ RemoteTestHelper helper = new RemoteTestHelper(Workspace.class);
+ helper.ignoreMethod("getQueryManager"); // TODO
+ helper.ignoreMethod("getObservationManager"); // TODO
+ helper.ignoreMethod("restore"); // TODO
+ helper.ignoreMethod("getSession"); // implemented locally
+ helper.ignoreMethod("copy"); // multiple methods
+ helper.ignoreMethod("importXML"); // wrapped stream
+ helper.ignoreMethod("getImportContentHandler"); // implemented locally
+ helper.testRemoteMethods(workspace, mock, control);
+ }
+
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/TestAll.java Sat Jan 29 03:20:38 2005
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.test.rmi;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Test suite that contains all JCR-RMI test cases.
+ */
+public class TestAll {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Tests for org.apache.jackrabbit.rmi");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(RemoteRepositoryTest.class);
+ suite.addTestSuite(RemoteSessionTest.class);
+ suite.addTestSuite(RemoteWorkspaceTest.class);
+ suite.addTestSuite(RemoteItemTest.class);
+ suite.addTestSuite(RemoteNodeTest.class);
+ suite.addTestSuite(RemotePropertyTest.class);
+ suite.addTestSuite(RemoteNamespaceRegistryTest.class);
+ // .nodetype
+ suite.addTestSuite(RemoteItemDefTest.class);
+ suite.addTestSuite(RemoteNodeDefTest.class);
+ suite.addTestSuite(RemotePropertyDefTest.class);
+ suite.addTestSuite(RemoteNodeTypeTest.class);
+ suite.addTestSuite(RemoteNodeTypeManagerTest.class);
+ // .lock
+ suite.addTestSuite(RemoteLockTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+}
Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/package.html
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/package.html?view=auto&rev=149025
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/package.html Sat Jan 29 03:20:38 2005
@@ -0,0 +1,6 @@
+<body>
+Test cases for the JCR-RMI wrapper. The test cases use the EasyMock library
+to generate mock objects that are then wrapped into the remote client-server
+wrappers. The test cases then access the client wrappers and verify that the
+corresponding operations are performed also on the underlying mock objects.
+</body>
Modified: incubator/jackrabbit/trunk/project.xml
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/project.xml?view=diff&rev=149025&p1=incubator/jackrabbit/trunk/project.xml&r1=149024&p2=incubator/jackrabbit/trunk/project.xml&r2=149025
==============================================================================
--- incubator/jackrabbit/trunk/project.xml (original)
+++ incubator/jackrabbit/trunk/project.xml Sat Jan 29 03:20:38 2005
@@ -199,6 +199,15 @@
</developers>
<contributors>
<contributor>
+ <name>Jukka Zitting</name>
+ <email>jz@yukatan.fi</email>
+ <organization>Yukatan</organization>
+ <roles>
+ <role>Java Developer</role>
+ </roles>
+ <timezone>+2</timezone>
+ </contributor>
+ <contributor>
<name>Felix Meschberger</name>
<email/>
<organization/>