branches: Removed contrib folders fromold branches to avoid svn:externals troubles. The contribs were never released so it is OK to remove them from the branches.
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/branches/1.0@514281 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/contrib/bdb-persistence/HEADER.txt b/contrib/bdb-persistence/HEADER.txt
deleted file mode 100644
index 1c10dad..0000000
--- a/contrib/bdb-persistence/HEADER.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
\ No newline at end of file
diff --git a/contrib/bdb-persistence/LICENSE.txt b/contrib/bdb-persistence/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/contrib/bdb-persistence/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- 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.
diff --git a/contrib/bdb-persistence/README.txt b/contrib/bdb-persistence/README.txt
deleted file mode 100644
index 4ec4816..0000000
--- a/contrib/bdb-persistence/README.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-// bdb-persistence
-// jcr (jsr170) support for the spring framework
-
-// berkeleydb je support for jackrabbit persistence
-
-~~ About
-
-A berkeleydb persistence manager for the Apache Jackrabbit project
- http://jackrabbit.apache.org/
-It use the berkeleydb java edition
-
-~~ Installation/Configuration
-
-Just use org.apache.jackrabbit.core.state.bdb.BerkeleyDBPersistenceManager as persistence managers in your repository.xml configuration file
diff --git a/contrib/bdb-persistence/applications/test/jaas.config b/contrib/bdb-persistence/applications/test/jaas.config
deleted file mode 100644
index 1fc3c36..0000000
--- a/contrib/bdb-persistence/applications/test/jaas.config
+++ /dev/null
@@ -1,3 +0,0 @@
-Jackrabbit {
- org.apache.jackrabbit.core.security.SimpleLoginModule required anonymousId="anonymous";
-};
\ No newline at end of file
diff --git a/contrib/bdb-persistence/applications/test/log4j.properties b/contrib/bdb-persistence/applications/test/log4j.properties
deleted file mode 100644
index 570d2eb..0000000
--- a/contrib/bdb-persistence/applications/test/log4j.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, file
-#log4j.rootLogger=DEBUG, stdout, file
-#log4j.rootLogger=ERROR, stdout, file
-
-log4j.logger.org.apache.jackrabbit.test=DEBUG
-log4j.logger.org.apache.jackrabbit.core.state.bdb=DEBUG
-
-# 'stdout' is set to be a ConsoleAppender.
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-
-# 'stdout' uses PatternLayout
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
-
-# 'file' is set to be a FileAppender.
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.File=jcr.log
-
-# 'file' uses PatternLayout.
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
diff --git a/contrib/bdb-persistence/applications/test/repository.xml b/contrib/bdb-persistence/applications/test/repository.xml
deleted file mode 100644
index 512786a..0000000
--- a/contrib/bdb-persistence/applications/test/repository.xml
+++ /dev/null
@@ -1,220 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE Repository [
- <!--
- the Repository element configures a repository instance;
- individual workspaces of the repository are configured through
- separate configuration files called workspace.xml which are
- located in a subfolder of the workspaces root directory
- (see Workspaces element).
-
- it consists of
-
- a FileSystem element (the virtual file system
- used by the repository to persist global state such as
- registered namespaces, custom node types, etc..
-
- a Security element that specifies the name of the app-entry
- in the JAAS config and the access manager
-
- a Workspaces element that specifies to the location of
- workspaces root directory and the name of default workspace
-
- a Workspace element that is used as a workspace configuration
- template; it is used to create the initial workspace if there's
- no workspace yet and for creating additional workspaces through
- the api
-
- a SearchIndex element that is used for configuring per workspace
- Indexing-related settings
-
- a Versioning element that is used for configuring
- versioning-related settings
- -->
- <!ELEMENT Repository (FileSystem,Security,Workspaces,Workspace,Versioning,SearchIndex?)>
-
- <!--
- a virtual file system
- -->
- <!ELEMENT FileSystem (param*)>
- <!ATTLIST FileSystem
- class CDATA #REQUIRED>
-
- <!--
- the Security element specifies the name (appName attribute)
- of the JAAS configuration app-entry for this repository.
-
- it also specifies the access manager to be used (AccessManager element).
- -->
- <!ELEMENT Security (AccessManager, LoginModule?)>
- <!ATTLIST Security
- appName CDATA #REQUIRED>
-
- <!--
- the AccessManager element configures the access manager to be used by
- this repository instance; the class attribute specifies the FQN of the
- class implementing the AccessManager interface
- -->
- <!ELEMENT AccessManager (param*)>
- <!ATTLIST AccessManager
- class CDATA #REQUIRED>
-
- <!--
- generic parameter (name/value pair)
- -->
- <!ELEMENT param EMPTY>
- <!ATTLIST param
- name CDATA #REQUIRED
- value CDATA #REQUIRED>
-
- <!--
- the LoginModule element optionally specifies a JAAS login module to
- authenticate users. This feature allows the use of Jackrabbit in a
- non-JAAS environment.
- -->
- <!ELEMENT LoginModule (param*)>
- <!ATTLIST LoginModule
- class CDATA #REQUIRED>
-
- <!--
- the Workspaces element specifies the workspaces root directory
- (rootPath attribute) and the name of the default workspace
- (defaultWorkspace attribute).
-
- individual workspaces are configured through individual workspace.xml
- files located in a subfolder each of the workspaces root directory.
- -->
- <!ELEMENT Workspaces EMPTY>
- <!ATTLIST Workspaces
- rootPath CDATA #REQUIRED
- defaultWorkspace CDATA #REQUIRED>
-
- <!--
- the Workspace element serves as a workspace configuration template;
- it is used to create the initial workspace if there's no workspace yet
- and for creating additional workspaces through the api
- -->
- <!ELEMENT Workspace (FileSystem,PersistenceManager,SearchIndex?)>
- <!ATTLIST Workspace
- name CDATA #REQUIRED>
-
- <!--
- the PersistenceManager element configures the persistence manager
- to be used for the workspace; the class attribute specifies the
- FQN of the class implementing the PersistenceManager interface
- -->
- <!ELEMENT PersistenceManager (param*)>
- <!ATTLIST PersistenceManager
- class CDATA #REQUIRED>
-
- <!--
- the SearchIndex element specifies the locaction of the search index
- (used by the QueryHandler); the class attribute specifies the
- FQN of the class implementing the QueryHandler interface.
- -->
- <!ELEMENT SearchIndex (param*,FileSystem?)>
- <!ATTLIST SearchIndex
- class CDATA #REQUIRED>
-
- <!--
- the Versioning element configures the persistence manager
- to be used for persisting version state
- -->
- <!ELEMENT Versioning (FileSystem, PersistenceManager)>
- <!ATTLIST Versioning
- rootPath CDATA #REQUIRED
- >
-]>
-<!-- Example Repository Configuration File -->
-<Repository>
- <!--
- virtual file system where the repository stores global state
- (e.g. registered namespaces, custom node types, etc.)
- -->
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${rep.home}/repository"/>
- </FileSystem>
-
- <!--
- security configuration
- -->
- <Security appName="Jackrabbit">
- <!--
- access manager:
- class: FQN of class implementing the AccessManager interface
- -->
- <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
- <!-- <param name="config" value="${rep.home}/access.xml"/> -->
- </AccessManager>
-
- <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
- <!-- anonymous user name ('anonymous' is the default value) -->
- <param name="anonymousId" value="anonymous"/>
- </LoginModule>
- </Security>
-
- <!--
- location of workspaces root directory and name of default workspace
- -->
- <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
- <!--
- workspace configuration template:
- used to create the initial workspace if there's no workspace yet
- -->
- <Workspace name="${wsp.name}">
- <!--
- virtual file system of the workspace:
- class: FQN of class implementing the FileSystem interface
- -->
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/data"/>
- </FileSystem>
- <!--
- persistence manager of the workspace:
- class: FQN of class implementing the PersistenceManager interface
- -->
- <PersistenceManager class="org.apache.jackrabbit.core.state.bdb.BerkeleyDBPersistenceManager"/>
- <!--
- Search index and the file system it uses.
- class: FQN of class implementing the QueryHandler interface
- -->
- <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="path" value="${wsp.home}/index"/>
- </SearchIndex>
- </Workspace>
-
- <!--
- Configures the versioning
- -->
- <Versioning rootPath="${rep.home}/version">
- <!--
- Configures the filesystem to use for versioning for the respective
- persistence manager
- -->
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${rep.home}/version" />
- </FileSystem>
-
- <!--
- Configures the persistence manager to be used for persisting version state.
- Please note that the current versioning implementation is based on
- a 'normal' persistence manager, but this could change in future
- implementations.
- -->
- <PersistenceManager class="org.apache.jackrabbit.core.state.bdb.BerkeleyDBPersistenceManager"/>
-
- </Versioning>
-
- <!--
- Search index for content that is shared repository wide
- (/jcr:system tree, contains mainly versions)
-
- The same parameters are supported as in the search index configuration
- inside the workspace definition element.
-
- This element is optional. If omitted, the /jcr:system tree will not be
- indexed and no results will be returned for that tree!
- -->
- <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="path" value="${rep.home}/repository/index"/>
- </SearchIndex>
-</Repository>
diff --git a/contrib/bdb-persistence/applications/test/repository/nodetypes/custom_nodetypes.xml b/contrib/bdb-persistence/applications/test/repository/nodetypes/custom_nodetypes.xml
deleted file mode 100644
index c78e5d9..0000000
--- a/contrib/bdb-persistence/applications/test/repository/nodetypes/custom_nodetypes.xml
+++ /dev/null
@@ -1,247 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- -->
-<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:test="http://www.apache.org/jackrabbit/test" xmlns:mix="http://www.jcp.org/jcr/mix/1.0">
- <nodeType name="test:versionable" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>mix:versionable</supertype>
- <supertype>nt:base</supertype>
- </supertypes>
- <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false" />
- <propertyDefinition name="test:copyOnParentVersionProp" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false" />
- <propertyDefinition name="test:versionOnParentVersionProp" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="VERSION" protected="false" multiple="false" />
- <propertyDefinition name="test:initializeOnParentVersionProp" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="INITIALIZE" protected="false" multiple="false" />
- <propertyDefinition name="test:computeOnParentVersionProp" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COMPUTE" protected="false" multiple="false" />
- <propertyDefinition name="test:ignoreOnParentVersionProp" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="IGNORE" protected="false" multiple="false" />
- <propertyDefinition name="test:abortOnParentVersionProp" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="ABORT" protected="false" multiple="false" />
- <childNodeDefinition name="*" defaultPrimaryType="test:versionable" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>nt:base</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="test:copyOnParentVersion" defaultPrimaryType="nt:unstructured" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>nt:base</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="test:versionOnParentVersion" defaultPrimaryType="nt:unstructured" autoCreated="false" mandatory="false" onParentVersion="VERSION" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>nt:base</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="test:initializeOnParentVersion" defaultPrimaryType="nt:unstructured" autoCreated="false" mandatory="false" onParentVersion="INITIALIZE" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>nt:base</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="test:computeOnParentVersion" defaultPrimaryType="nt:unstructured" autoCreated="false" mandatory="false" onParentVersion="COMPUTE" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>nt:base</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="test:ignoreOnParentVersion" defaultPrimaryType="nt:unstructured" autoCreated="false" mandatory="false" onParentVersion="IGNORE" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>nt:base</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="test:abortOnParentVersion" defaultPrimaryType="nt:unstructured" autoCreated="false" mandatory="false" onParentVersion="ABORT" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>nt:base</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </nodeType>
-
- <!-- Defines a referenceable nodetype for testing purposes -->
- <nodeType name="test:refTargetNode" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>mix:versionable</supertype>
- <supertype>nt:base</supertype>
- </supertypes>
- <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
- </nodeType>
-
- <!-- Defines a nodetype for tests of NodeType.canSetProperty(), Property.setValue() and Node.setProperty() -->
- <nodeType name="test:canSetProperty" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <propertyDefinition name="String" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
- <propertyDefinition name="StringMultiple" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
- <propertyDefinition name="StringConstraints" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints>
- <valueConstraint>abc</valueConstraint>
- <valueConstraint>def</valueConstraint>
- <valueConstraint>ghi</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="StringMultipleConstraints" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints>
- <valueConstraint>abc</valueConstraint>
- <valueConstraint>def</valueConstraint>
- <valueConstraint>ghi</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="Binary" requiredType="Binary" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
- <propertyDefinition name="BinaryMultiple" requiredType="Binary" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
- <propertyDefinition name="BinaryConstraints" requiredType="Binary" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints>
- <valueConstraint>(,100)</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="BinaryMultipleConstraints" requiredType="Binary" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints>
- <valueConstraint>(,100)</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="Date" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
- <propertyDefinition name="DateMultiple" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
- <propertyDefinition name="DateConstraints" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints>
- <valueConstraint>(1974-02-15T00:00:00.000Z,)</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="DateMultipleConstraints" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints>
- <valueConstraint>(,1974-02-15T00:00:00.000Z)</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="Double" requiredType="Double" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
- <propertyDefinition name="DoubleMultiple" requiredType="Double" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
- <propertyDefinition name="DoubleConstraints" requiredType="Double" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints>
- <valueConstraint>(100,)</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="DoubleMultipleConstraints" requiredType="Double" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints>
- <valueConstraint>(,100)</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="Long" requiredType="Long" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
- <propertyDefinition name="LongMultiple" requiredType="Long" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
- <propertyDefinition name="LongConstraints" requiredType="Long" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints>
- <valueConstraint>(100,)</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="LongMultipleConstraints" requiredType="Long" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints>
- <valueConstraint>(,100)</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="Boolean" requiredType="Boolean" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
- <propertyDefinition name="BooleanMultiple" requiredType="Boolean" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
- <propertyDefinition name="BooleanConstraints" requiredType="Boolean" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints>
- <valueConstraint>true</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="BooleanMultipleConstraints" requiredType="Boolean" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints>
- <valueConstraint>true</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="Name" requiredType="Name" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
- <propertyDefinition name="NameMultiple" requiredType="Name" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
- <propertyDefinition name="NameConstraints" requiredType="Name" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints>
- <valueConstraint>abc</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="NameMultipleConstraints" requiredType="Name" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints>
- <valueConstraint>abc</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="Path" requiredType="Path" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
- <propertyDefinition name="PathMultiple" requiredType="Path" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
- <propertyDefinition name="PathConstraints" requiredType="Path" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints>
- <valueConstraint>/abc</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="PathMultipleConstraints" requiredType="Path" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints>
- <valueConstraint>/abc</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="ReferenceConstraints" requiredType="Reference" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
- <valueConstraints>
- <valueConstraint>test:canSetProperty</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- <propertyDefinition name="ReferenceMultipleConstraints" requiredType="Reference" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
- <valueConstraints>
- <valueConstraint>test:canSetProperty</valueConstraint>
- </valueConstraints>
- </propertyDefinition>
- </nodeType>
-
- <!-- Defines a nodetype for testing NodeType.canAddChildNode() -->
- <nodeType name="test:canAddChildNode" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <childNodeDefinition name="testChildWithDefaultType" defaultPrimaryType="nt:base" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>nt:base</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="testChildWithoutDefaultType" defaultPrimaryType="" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>nt:base</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </nodeType>
-
- <!-- Defines a nodetype for testing Node.setProperty(). -->
- <nodeType name="test:setProperty" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false" />
- <propertyDefinition name="test:multiProperty" requiredType="undefined" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true" />
- <childNodeDefinition name="*" defaultPrimaryType="test:setProperty" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false" />
- </nodeType>
-
- <!-- Defines a nodetype to test assuming the PropertyType at Node.setProperty(). -->
- <nodeType name="test:setPropertyAssumingType" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <propertyDefinition name="test:singleProperty" requiredType="undefined" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false" />
- <propertyDefinition name="test:multiProperty" requiredType="undefined" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true" />
- <childNodeDefinition name="*" defaultPrimaryType="test:setPropertyAssumingType" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false" />
- </nodeType>
-
- <!-- Defines a nodetype with a childNodeDefinition that does not allow same name siblings -->
- <nodeType name="test:sameNameSibsFalseChildNodeDefinition" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
- <childNodeDefinition name="*" defaultPrimaryType="test:sameNameSibsFalseChildNodeDefinition" autoCreated="false" mandatory="false" onParentVersion="COMPUTE" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>nt:base</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </nodeType>
-
-</nodeTypes>
-
diff --git a/contrib/bdb-persistence/applications/test/repositoryStubImpl.properties b/contrib/bdb-persistence/applications/test/repositoryStubImpl.properties
deleted file mode 100644
index 793e2fe..0000000
--- a/contrib/bdb-persistence/applications/test/repositoryStubImpl.properties
+++ /dev/null
@@ -1,432 +0,0 @@
-#
-# This is the configuration file for the jackrabbit repository test stub.
-#
-
-# Stub implementation class
-javax.jcr.tck.repository_stub_impl=org.apache.jackrabbit.core.JackrabbitRepositoryStub
-
-# repository specific configuration
-org.apache.jackrabbit.repository.config=applications/test/repository.xml
-org.apache.jackrabbit.repository.name=repo
-org.apache.jackrabbit.repository.home=applications/test
-org.apache.jackrabbit.repository.jaas.config=applications/test/jaas.config
-
-# credential configuration
-javax.jcr.tck.superuser.name=superuser
-javax.jcr.tck.superuser.pwd=
-javax.jcr.tck.readwrite.name=user
-javax.jcr.tck.readwrite.pwd=
-javax.jcr.tck.readonly.name=anonymous
-javax.jcr.tck.readonly.pwd=
-
-# global test configuration
-javax.jcr.tck.testroot=/testroot
-javax.jcr.tck.nodetype=nt:unstructured
-javax.jcr.tck.nodename1=node1
-javax.jcr.tck.nodename2=node2
-javax.jcr.tck.nodename3=node3
-javax.jcr.tck.nodename4=node4
-javax.jcr.tck.propertyname1=prop1
-javax.jcr.tck.propertyname2=prop2
-javax.jcr.tck.workspacename=test
-
-# namespace configuration
-javax.jcr.tck.namespaces=test
-javax.jcr.tck.namespaces.test=http://www.apache.org/jackrabbit/test
-
-# sample for per test case config overriding
-# Test class: AddNodeText
-# Test method: testName
-javax.jcr.tck.AddNodeTest.testName.nodename1=myname
-
-# ==============================================================================
-# JAVAX.JCR CONFIGURATION
-# ==============================================================================
-
-# Test class: ItemDefTest
-javax.jcr.tck.ItemDefTest.testroot=/testdata
-
-# Test class: ItemReadMethodsTest
-javax.jcr.tck.ItemReadMethodsTest.testroot=/testdata
-
-# Test class: NodeReadMethodsTest
-javax.jcr.tck.NodeReadMethodsTest.testroot=/testdata
-
-# Test class: PropertyTypeTest
-javax.jcr.tck.PropertyTypeTest.testroot=/testdata
-
-# Test class: BinaryPropertyTest
-javax.jcr.tck.BinaryPropertyTest.testroot=/testdata
-
-# Test class: BooleanPropertyTest
-javax.jcr.tck.BooleanPropertyTest.testroot=/testdata
-
-# Test class: DatePropertyTest
-javax.jcr.tck.DatePropertyTest.testroot=/testdata
-
-# Test class: DoublePropertyTest
-javax.jcr.tck.DoublePropertyTest.testroot=/testdata
-
-# Test class: LongPropertyTest
-javax.jcr.tck.LongPropertyTest.testroot=/testdata
-
-# Test class: NamePropertyTest
-javax.jcr.tck.NamePropertyTest.testroot=/testdata
-
-# Test class: PathPropertyTest
-javax.jcr.tck.PathPropertyTest.testroot=/testdata
-
-# Test class: ReferencePropertyTest
-javax.jcr.tck.ReferencePropertyTest.testroot=/testdata
-
-# Test class: StringPropertyTest
-javax.jcr.tck.StringPropertyTest.testroot=/testdata
-
-# Test class: SetValueVersionExceptionTest
-# nodetype2: nodetype with a reference property
-javax.jcr.tck.SetValueVersionExceptionTest.nodetype2=nt:linkedFile
-# propertyname3: name of the single value reference property
-javax.jcr.tck.SetValueVersionExceptionTest.propertyname3=jcr:content
-
-# Test class: UndefinedPropertyTest
-javax.jcr.tck.UndefinedPropertyTest.testroot=/testdata
-
-# Test class: PropertyReadMethodsTest
-javax.jcr.tck.PropertyReadMethodsTest.testroot=/testdata
-
-# Test class: NodeIteratorTest
-javax.jcr.tck.NodeIteratorTest.testroot=/testdata
-
-# Test class: NodeDiscoveringNodeTypesTest
-javax.jcr.tck.NodeDiscoveringNodeTypesTest.testroot=/testdata
-
-# Test class: RepositoryDescriptorTest
-javax.jcr.tck.RepositoryDescriptorTest.testroot=/testdata
-
-# Test class: WorkspaceReadMethodsTest
-javax.jcr.tck.WorkspaceReadMethodsTest.testroot=/testdata
-
-# Test class: SessionReadMethodsTest
-javax.jcr.tck.SessionReadMethodsTest.testroot=/testdata
-
-# Test class: NamespaceRegistryReadMethodsTest
-javax.jcr.tck.NamespaceRegistryReadMethodsTest.testroot=/testdata
-
-# Test class: NamespaceRemappingTest
-javax.jcr.tck.NamespaceRemappingTest.testroot=/testdata
-
-# Test class: SessionTest
-# Test method: testMoveItemExistsException
-# nodetype that does not allow same name siblings
-javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype2=nt:folder
-# valid node type that can be added as child of nodetype2
-javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype3=nt:hierarchyNode
-
-# Test class: SessionTest
-# Test method: testSaveContstraintViolationException
-# nodetype that has a property that is mandatory but not autocreated
-javax.jcr.tck.SessionTest.testSaveContstraintViolationException.nodetype2=nt:file
-
-# Test class: SessionUUIDTest
-# node type that has a property of type PropertyType.REFERENCE
-javax.jcr.tck.SessionUUIDTest.nodetype=nt:unstructured
-# name of the property that is of type PropertyType.REFERENCE
-javax.jcr.tck.SessionUUIDTest.propertyname1=foobar
-# nodetype that has nodetype mix:referenceable assigned
-javax.jcr.tck.SessionUUIDTest.nodetype2=test:refTargetNode
-
-# Test class: SessionUUIDTest
-# Test method: testSaveMovedRefNode
-# name of the property that can be modified
-javax.jcr.tck.SessionUUIDTest.testSaveMovedRefNode.propertyname1=foobar
-
-# Test class: NodeTest
-# Test method: testAddNodeItemExistsException
-# nodetype that does not allow same name siblings and allows child nodes of
-# the same type
-javax.jcr.tck.NodeTest.testAddNodeItemExistsException.nodetype=nt:folder
-
-# Test class: NodeTest
-# Test method: testRemoveMandatoryNode
-# nodetype that has a mandatory child node definition
-javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodetype2=nt:file
-# nodetype of the mandatory child
-javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodetype3=nt:base
-# name of the mandatory node
-javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodename3=jcr:content
-
-# Test class: NodeTest
-# Test method: testSaveContstraintViolationException
-# nodetype that has a property that is mandatory but not autocreated
-javax.jcr.tck.NodeTest.testSaveContstraintViolationException.nodetype2=nt:file
-
-# Test class: NodeUUIDTest
-# node type that has a property of type PropertyType.REFERENCE
-javax.jcr.tck.NodeUUIDTest.nodetype=nt:unstructured
-# name of the property that is of type PropertyType.REFERENCE
-javax.jcr.tck.NodeUUIDTest.propertyname1=ref
-# nodetype that has nodetype mix:referenceable assigned
-javax.jcr.tck.NodeUUIDTest.nodetype2=test:refTargetNode
-
-# Test class: NodeUUIDTest
-# Test method: testSaveMovedRefNode
-# name of the property that can be modified
-javax.jcr.tck.NodeUUIDTest.testSaveMovedRefNode.propertyname1=foobar
-# nodetype that has nodetype mix:referenceable assigned
-
-# Test class: NodeOrderableChildNodesTest
-# nodetype that supports orderable child nodes
-javax.jcr.tck.NodeOrderableChildNodesTest.nodetype2=nt:unstructured
-# valid node type that can be added as child of nodetype 2
-javax.jcr.tck.NodeOrderableChildNodesTest.nodetype3=nt:unstructured
-
-# Test class: NodeOrderableChildNodesTest
-# Test method: testOrderBeforeUnsupportedRepositoryOperationException
-# nodetype that does not allow ordering of child nodes
-javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype2=nt:folder
-# valid node type that can be added as child of nodetype 2
-javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype3=nt:hierarchyNode
-
-# Test class: SetPropertyNodeTest
-# nodetype which is referenceable
-javax.jcr.tck.SetPropertyNodeTest.nodetype=test:setProperty
-
-# Test class: SetPropertyValueTest
-# property that allows multiple values
-javax.jcr.tck.SetPropertyValueTest.propertyname2=test:multiProperty
-javax.jcr.tck.SetPropertyValueTest.nodetype=test:setProperty
-
-# Test class: SetPropertyStringTest
-# property that allows multiple values
-javax.jcr.tck.SetPropertyStringTest.propertyname2=test:multiProperty
-javax.jcr.tck.SetPropertyStringTest.nodetype=test:setProperty
-
-# Test class: WorkspaceCloneSameNameSibsTest
-javax.jcr.tck.WorkspaceCloneSameNameSibsTest.sameNameSibsFalseNodeType=test:sameNameSibsFalseChildNodeDefinition
-javax.jcr.tck.WorkspaceCloneSameNameSibsTest.sameNameSibsTrueNodeType=nt:unstructured
-
-# Test class: WorkspaceCopyBetweenWorkspacesSameNameSibsTest
-javax.jcr.tck.WorkspaceCopyBetweenWorkspacesSameNameSibsTest.sameNameSibsFalseNodeType=test:sameNameSibsFalseChildNodeDefinition
-javax.jcr.tck.WorkspaceCopyBetweenWorkspacesSameNameSibsTest.sameNameSibsTrueNodeType=nt:unstructured
-
-# Test class: WorkspaceCopySameNameSibsTest
-javax.jcr.tck.WorkspaceCopySameNameSibsTest.sameNameSibsFalseNodeType=test:sameNameSibsFalseChildNodeDefinition
-javax.jcr.tck.WorkspaceCopySameNameSibsTest.sameNameSibsTrueNodeType=nt:unstructured
-
-# Test class: WorkspaceMoveSameNameSibsTest
-javax.jcr.tck.WorkspaceMoveSameNameSibsTest.sameNameSibsFalseNodeType=test:sameNameSibsFalseChildNodeDefinition
-javax.jcr.tck.WorkspaceMoveSameNameSibsTest.sameNameSibsTrueNodeType=nt:unstructured
-
-# Test class: RepositoryLoginTest
-javax.jcr.tck.RepositoryLoginTest.testroot=/testdata
-
-# Test class: RootNodeTest
-javax.jcr.tck.RootNodeTest.testroot=/testdata
-
-# Test class: ReferenceableRootNodesTest
-javax.jcr.tck.ReferenceableRootNodesTest.testroot=/testdata
-
-# Test class: ExportDocViewTest
-javax.jcr.tck.ExportDocViewTest.testroot=/testdata
-
-# ------------------------------------------------------------------------------
-# observation configuration
-# ------------------------------------------------------------------------------
-
-# Test class: AddEventListenerTest
-# Test method: testNodeType
-javax.jcr.tck.AddEventListenerTest.testNodeType.nodetype2=nt:folder
-
-# Configuration settings for the serialization.
-# Note that the serialization test tries to use as many features of the repository
-# as possible, but fails silently if a feature is not available. You have to
-# specify all of the following configuration entries, even if your repository does
-# not support the feature that is associated with them.
-
-# Root node for the example tree
-javax.jcr.tck.SerializationTest.testroot=/testdata/serialization
-
-# Node type to use for the example tree. Specify a node type that allows complex trees and all property types if possible
-javax.jcr.tck.SerializationTest.nodetype=nt:unstructured
-
-# Name of the nodes for source and target tree
-javax.jcr.tck.SerializationTest.sourceFolderName=source
-javax.jcr.tck.SerializationTest.targetFolderName=target
-javax.jcr.tck.SerializationTest.rootNodeName=test
-
-# List the properties whose values may change during serialization/deserialization. For example,
-# the UUID of a node is unique in the repository, so it will have to change when you re-import
-# a tree at a different location.
-javax.jcr.tck.SerializationTest.propertyValueMayChange= jcr:created jcr:uuid jcr:versionHistory jcr:baseVersion jcr:predecessors P_Reference
-
-# List all properties which are skipped during xml import according specification chapter 7.3.3
-javax.jcr.tck.SerializationTest.propertySkipped=
-
-# The name of the test node types. For easier diagnostics, the node types have names
-# that tell you the kind of information they store
-javax.jcr.tck.SerializationTest.nodeTypesTestNode=NodeTypes
-javax.jcr.tck.SerializationTest.mixinTypeTestNode=MixinTypes
-javax.jcr.tck.SerializationTest.propertyTypesTestNode=PropertyTypes
-javax.jcr.tck.SerializationTest.sameNameChildrenTestNode=SameNameChildren
-javax.jcr.tck.SerializationTest.multiValuePropertiesTestNode=MultiValueProperties
-javax.jcr.tck.SerializationTest.referenceableNodeTestNode=ReferenceableNode
-javax.jcr.tck.SerializationTest.orderChildrenTestNode=OrderChildren
-javax.jcr.tck.SerializationTest.namespaceTestNode=Namespace
-
-# The name of the test property types.
-javax.jcr.tck.SerializationTest.stringTestProperty=P_String
-javax.jcr.tck.SerializationTest.binaryTestProperty=P_Binary
-javax.jcr.tck.SerializationTest.dateTestProperty=P_Date
-javax.jcr.tck.SerializationTest.longTestProperty=P_Long
-javax.jcr.tck.SerializationTest.doubleTestProperty=P_Double
-javax.jcr.tck.SerializationTest.booleanTestProperty=P_Boolean
-javax.jcr.tck.SerializationTest.nameTestProperty=P_Name
-javax.jcr.tck.SerializationTest.pathTestProperty=P_Path
-javax.jcr.tck.SerializationTest.referenceTestProperty=P_Reference
-javax.jcr.tck.SerializationTest.multiValueTestProperty=P_MultiValue
-
-# node type not allowing same name sibs
-javax.jcr.tck.SerializationTest.sameNameSibsFalseChildNodeDefinition=test:sameNameSibsFalseChildNodeDefinition
-
-# Test method: testVersioningExceptionSessionFileChild
-# specified nodetype must be versionable and allow child nodes of the same type.
-javax.jcr.tck.SerializationTest.testVersioningExceptionSessionFileChild.nodetype=test:versionable
-
-# Test method: testVersioningExceptionSessionFileParent
-# specified nodetype must be versionable and allow child nodes of the same type.
-javax.jcr.tck.SerializationTest.testVersioningExceptionSessionFileParent.nodetype=test:versionable
-
-# Test method: testSessionImportXmlOverwriteException
-# requires a node type that does not allow same name siblings
-javax.jcr.tck.SerializationTest.testSessionImportXmlOverwriteException.nodetype=nt:folder
-
-# Test class: ExportSysViewTest
-javax.jcr.tck.ExportSysViewTest.testroot=/testdata
-
-# ==============================================================================
-# JAVAX.JCR.QUERY CONFIGURATION
-# ==============================================================================
-
-javax.jcr.tck.nodetype.testroot=/testdata
-
-# ==============================================================================
-# JAVAX.JCR.QUERY CONFIGURATION
-# ==============================================================================
-
-# Test class: SaveTest
-# Test method: testConstraintViolationException
-# Specified node type must not allow child nodes.
-javax.jcr.tck.SaveTest.testConstraintViolationException.nodetype=nt:query
-
-# Test class: XPathQueryLevel1Test
-javax.jcr.tck.XPathQueryLevel1Test.testroot=/testdata/query
-
-# Test class: XPathDocOrderTest
-javax.jcr.tck.XPathDocOrderTest.testroot=/testdata/query
-
-# Test class: XPathPosIndexTest
-javax.jcr.tck.XPathPosIndexTest.testroot=/testdata/query
-
-# Test class: XPathOrderByTest
-javax.jcr.tck.XPathOrderByTest.testroot=/testdata/query
-
-# Test class: XPathSyntaxTest
-javax.jcr.tck.XPathSyntaxTest.testroot=/testdata/query
-
-# Test class: XPathJcrPathTest
-javax.jcr.tck.XPathJcrPathTest.testroot=/testdata
-
-# Test class: SQLQueryLevel1Test
-javax.jcr.tck.SQLQueryLevel1Test.testroot=/testdata/query
-
-# Test class: SQLSyntaxTest
-javax.jcr.tck.SQLSyntaxTest.testroot=/testdata/query
-
-# Test class: SQLOrderByTest
-javax.jcr.tck.SQLOrderByTest.testroot=/testdata/query
-
-# Test class: DerefQueryLevel1Test
-javax.jcr.tck.DerefQueryLevel1Test.testroot=/testdata
-
-# Test class: GetLanguageTest
-javax.jcr.tck.GetLanguageTest.testroot=/testdata
-
-# Test class: GetPersistentQueryPathLevel1Test
-javax.jcr.tck.GetPersistentQueryPathLevel1Test.testroot=/testdata
-
-# Test class: GetPropertyNamesTest
-javax.jcr.tck.GetPropertyNamesTest.testroot=/testdata
-
-# Test class: GetStatementTest
-javax.jcr.tck.GetStatementTest.testroot=/testdata
-
-# Test class: GetSupportedQueryLanguagesTest
-javax.jcr.tck.GetSupportedQueryLanguagesTest.testroot=/testdata
-
-# Test class: SQLJcrPathTest
-javax.jcr.tck.SQLJcrPathTest.testroot=/testdata
-
-# Test class: SQLPathTest
-javax.jcr.tck.SQLPathTest.testroot=/testdata
-
-# Test class: PredicatesTest
-javax.jcr.tck.PredicatesTest.testroot=/testdata
-
-# Test class: SimpleSelectionTest
-javax.jcr.tck.SimpleSelectionTest.testroot=/testdata
-
-# ==============================================================================
-# JAVAX.JCR.VERSIONING CONFIGURATION
-# ==============================================================================
-
-# nodetye that is versionable. if it is not, an attempt is made to create versionable nodes
-# by adding a mix:versionable mixin-type.
-# NOTE: javax.jcr.tck.nodetype must define a non-versionable nodetype!
-javax.jcr.tck.version.versionableNodeType=test:versionable
-javax.jcr.tck.version.propertyValue=aPropertyValue
-
-# testroot for the version package
-# the test root must allow versionable and non-versionable nodes being created below
-javax.jcr.tck.version.testroot=/testroot
-
-# 3 nodes (nodeName1, nodeName2, nodeName3 with nt=versionableNodeType / nt=nonVersionableNodeType will be cloned to 2nd workspace
-# nodename1 > used to persistently create versionable node below testroot
-# nodename2 > used to create second versionable node below testroot (used for restore/workspace.restore with uuid-conflict)
-# nodename3 > used to persistently create non-versionable node below testroot
-javax.jcr.tck.version.nodename1=versionableNodeName1
-javax.jcr.tck.version.nodename2=versionableNodeName2
-javax.jcr.tck.version.nodename3=nonVersionableNodeName1
-
-# nodename 4: versionabel child-node of the first versionable node with nodeName1 and nodetype 'versionableNodeType'
-# used for:
-# + creation of a node in the 2nd workspace, that does not exist in the first workspace
-# + creation of a node in the 2nd workspace, in order to test uuid-conflicts with Workspace.restore.
-# + creation of a sub-node in the default workspace, in order to test uuid-conflicts with Node.restore.
-# + NOTE: the nodetype with 'versionableNodeType' must define its children nodes to either have COPY or VERSION
-# OPV behaviour in order to successfully test Node.restore and Workspace.restore with uuid conflict.
-javax.jcr.tck.version.nodename4=childNodeName
-
-# path to existing String-properties and a new value for the property, that allows to test the indicated OPV behaviour
-javax.jcr.tck.OnParentVersionAbortTest.propertyname1=test:abortOnParentVersionProp
-javax.jcr.tck.OnParentVersionComputeTest.propertyname1=test:computeOnParentVersionProp
-javax.jcr.tck.OnParentVersionCopyTest.propertyname1=test:copyOnParentVersionProp
-javax.jcr.tck.OnParentVersionIgnoreTest.propertyname1=test:ignoreOnParentVersionProp
-javax.jcr.tck.OnParentVersionInitializeTest.propertyname1=test:initializeOnParentVersionProp
-
-# Test class: RestoreTest
-# Test method: testRestoreWithUUIDConflict
-# nodename4 must be the name of a child node with a OPV definition COPY or VERSION
-javax.jcr.tck.RestoreTest.testRestoreWithUUIDConflict.nodename4=test:versionOnParentVersion
-
-# config for nodes that show the indicated OPV behaviour:
-# nodes are added in order to test the versioning behaviour indicated by the test-class name.
-# NOTE:
-# - nodename4 is uses as name for the childnode
-# - nodetype is used as nodetype name for the childnode
-# - the specified child node is created below nodename1 with versionableNodeType
-# the versionableNodeType and/or nodename1 may be overwritten with the individual
-# testclass below.
-javax.jcr.tck.OnParentVersionCopyTest.nodename4=test:copyOnParentVersion
-javax.jcr.tck.OnParentVersionCopyTest.nodetype=nt:unstructured
-javax.jcr.tck.OnParentVersionAbortTest.nodename4=test:abortOnParentVersion
-javax.jcr.tck.OnParentVersionAbortTest.nodetype=nt:unstructured
diff --git a/contrib/bdb-persistence/applications/test/workspaces/default/workspace.xml b/contrib/bdb-persistence/applications/test/workspaces/default/workspace.xml
deleted file mode 100644
index 49d87de..0000000
--- a/contrib/bdb-persistence/applications/test/workspaces/default/workspace.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<Workspace name="default">
- <!--
- virtual file system of the workspace:
- class: FQN of class implementing FileSystem interface
- -->
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/data" />
- </FileSystem>
- <!--
- persistence of the workspace:
- class: FQN of class implementing PersistenceManager interface
- -->
- <PersistenceManager class="org.apache.jackrabbit.core.state.bdb.BerkeleyDBPersistenceManager"/>
- <!--
- Search index and the file system it uses.
- -->
- <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="path" value="${wsp.home}/index" />
- </SearchIndex>
-</Workspace>
-
diff --git a/contrib/bdb-persistence/applications/test/workspaces/test/workspace.xml b/contrib/bdb-persistence/applications/test/workspaces/test/workspace.xml
deleted file mode 100644
index a9c80af..0000000
--- a/contrib/bdb-persistence/applications/test/workspaces/test/workspace.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<Workspace name="test">
- <!--
- virtual file system of the workspace:
- class: FQN of class implementing FileSystem interface
- -->
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/data" />
- </FileSystem>
- <!--
- persistence of the workspace:
- class: FQN of class implementing PersistenceManager interface
- -->
- <PersistenceManager class="org.apache.jackrabbit.core.state.bdb.BerkeleyDBPersistenceManager"/>
- <!--
- Search index and the file system it uses.
- -->
- <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="path" value="${wsp.home}/index" />
- </SearchIndex>
-</Workspace>
-
diff --git a/contrib/bdb-persistence/checkstyle.xml b/contrib/bdb-persistence/checkstyle.xml
deleted file mode 100644
index df9e380..0000000
--- a/contrib/bdb-persistence/checkstyle.xml
+++ /dev/null
@@ -1,170 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. The ASF licenses this file to You
- under the Apache License, Version 2.0 (the "License"); you may not
- use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
-
-<!--
- Checkstyle checks configured for Maven.
--->
-
-<module name="Checker">
-
- <!-- Checks that a package.html file exists for each package. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
- <module name="PackageHtml"/>
-
- <!-- Checks whether files end with a new line. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
- <module name="NewlineAtEndOfFile"/>
-
- <!-- Checks that property files contain the same keys. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
- <module name="Translation"/>
-
- <module name="TreeWalker">
-
- <property name="cacheFile" value="${checkstyle.cache.file}"/>
-
- <!-- ************************************************************** -->
- <!-- Checks that are different from the sun coding conventions ones -->
- <!-- ************************************************************** -->
-
- <module name="Header">
- <property name="headerFile" value="${basedir}/HEADER.txt"/>
- </module>
- <!-- <property name="tabWidth" value="4"/> -->
- <module name="LeftCurly">
- <property name="option" value="eol"/>
- </module>
- <module name="LineLength">
- <property name="max" value="132"/>
- <property name="ignorePattern" value="\* \$"/>
- </module>
- <module name="MethodLength">
- <property name="max" value="175"/>
- </module>
- <module name="ConstantName">
- <property name="format" value="log|^[a-zA-Z][a-zA-Z0-9_]*$"/>
- </module>
-
- <!-- ************************************************************** -->
- <!-- Default Sun coding conventions checks -->
- <!-- ************************************************************** -->
-
- <!-- Checks for Javadoc comments. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html -->
- <module name="JavadocMethod"/>
- <module name="JavadocType"/>
- <module name="JavadocVariable"/>
-
- <!-- Checks for Naming Conventions. -->
- <!-- See http://checkstyle.sf.net/config_naming.html -->
- <module name="LocalFinalVariableName"/>
- <module name="LocalVariableName"/>
- <module name="MethodName"/>
- <module name="PackageName"/>
- <module name="ParameterName"/>
- <module name="StaticVariableName"/>
- <module name="TypeName"/>
- <module name="MemberName"/>
-
- <!-- Checks for imports -->
- <!-- See http://checkstyle.sf.net/config_import.html -->
- <module name="AvoidStarImport"/>
- <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
- <module name="RedundantImport"/>
- <module name="UnusedImports"/>
-
-
- <!-- Checks for Size Violations. -->
- <!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="FileLength"/>
- <module name="ParameterNumber"/>
-
-
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <module name="EmptyForIteratorPad"/>
- <module name="NoWhitespaceAfter"/>
- <module name="NoWhitespaceBefore"/>
- <module name="OperatorWrap"/>
- <module name="TabCharacter"/>
- <module name="WhitespaceAfter"/>
- <module name="WhitespaceAround"/>
-
-
- <!-- Modifier Checks -->
- <!-- See http://checkstyle.sf.net/config_modifiers.html -->
- <module name="ModifierOrder"/>
- <module name="RedundantModifier"/>
-
-
- <!-- Checks for blocks. You know, those {}'s -->
- <!-- See http://checkstyle.sf.net/config_blocks.html -->
- <module name="AvoidNestedBlocks"/>
- <module name="NeedBraces"/>
-
- <!-- Checks for common coding problems -->
- <!-- See http://checkstyle.sf.net/config_coding.html -->
- <!-- <module name="AvoidInlineConditionals"/> --> <!-- DISABLED-->
- <module name="DoubleCheckedLocking"/>
- <module name="EqualsHashCode"/>
- <module name="IllegalInstantiation"/>
- <module name="InnerAssignment"/>
- <module name="MissingSwitchDefault"/>
- <module name="RedundantThrows">
- <property name="allowUnchecked" value="true"/> <!-- DISABLED -->
- <property name="allowSubclasses" value="true"/> <!-- DISABLED -->
- </module>
- <module name="SimplifyBooleanExpression"/>
- <module name="SimplifyBooleanReturn"/>
-
- <!-- Checks for class design -->
- <!-- See http://checkstyle.sf.net/config_design.html -->
- <module name="DesignForExtension">
- <property name="severity" value="ignore"/> <!-- DISABLED -->
- </module>
- <module name="HideUtilityClassConstructor"/>
- <module name="InterfaceIsType"/>
- <module name="VisibilityModifier">
- <!-- Protected member variables are widely used in Jackrabbit -->
- <property name="protectedAllowed" value="true"/>
- </module>
-
-
- <!-- Miscellaneous other checks. -->
- <!-- See http://checkstyle.sf.net/config_misc.html -->
- <module name="ArrayTypeStyle"/>
- <module name="FinalParameters">
- <property name="severity" value="ignore"/> <!-- DISABLED -->
- </module>
- <module name="GenericIllegalRegexp">
- <property name="format" value="\s+$"/>
- <property name="message" value="Line has trailing spaces."/>
- </module>
- <module name="TodoComment"/>
- <module name="UpperEll"/>
-
- </module>
-
- <module name="SuppressionFilter">
- <property name="file" value="checkstyle-suppressions.xml"/>
- </module>
-
-</module>
diff --git a/contrib/bdb-persistence/maven.xml b/contrib/bdb-persistence/maven.xml
deleted file mode 100644
index f0f7d4d..0000000
--- a/contrib/bdb-persistence/maven.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. The ASF licenses this file to You
- under the Apache License, Version 2.0 (the "License"); you may not
- use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<project
- default="jar:jar"
- xmlns:deploy="deploy"
- xmlns:j="jelly:core"
- xmlns:ant="jelly:ant">
-
- <!-- Additionally cleans the test data created -->
- <postGoal name="clean">
- <attainGoal name="test:clean"/>
- </postGoal>
-
- <!-- deletes the test data -->
- <goal name="test:clean">
- <ant:delete includeEmptyDirs="true">
- <ant:fileset dir="applications/test/repository">
- <ant:include name="**/*"/>
- <ant:exclude name="**/custom_nodetypes.xml"/>
- </ant:fileset>
- </ant:delete>
- <ant:delete includeEmptyDirs="true">
- <ant:fileset dir="applications/test/workspaces">
- <ant:include name="**/*"/>
- <ant:exclude name="**/workspace.xml"/>
- </ant:fileset>
- </ant:delete>
- <ant:delete dir="applications/test/tx"/>
- <ant:delete dir="applications/test/version"/>
- <ant:delete file="applications/test/.lock"/>
- </goal>
-
- <!--
- Creates a jar file with the JackrabbitRepositoryStub class which is
- needed for running test cases
- -->
- <goal name="jackrabbit:test-stub">
- <attainGoal name="test:compile"/>
- <ant:jar destfile="./target/jackrabbit-test-stub-${pom.currentVersion}.jar"
- basedir="target/test-classes"
- includes="org/apache/jackrabbit/core/JackrabbitRepositoryStub.class"/>
- </goal>
-
- <!--
- Run Jackrabbit init tests first.
- -->
- <preGoal name="test:test">
- <j:if test="${context.getVariable('maven.test.skip') != 'true'}">
- <attainGoal name="jackrabbit:test-init"/>
- </j:if>
- </preGoal>
-
- <!--
- Runs the init test cases to fill the repository with data for
- read-only tests.
- -->
- <goal name="jackrabbit:test-init">
- <j:set var="testcase" value="org.apache.jackrabbit.init.TestAll"/>
- <attainGoal name="test:single"/>
- </goal>
-
-</project>
diff --git a/contrib/bdb-persistence/project.properties b/contrib/bdb-persistence/project.properties
deleted file mode 100644
index 7bcd2d0..0000000
--- a/contrib/bdb-persistence/project.properties
+++ /dev/null
@@ -1,93 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. The ASF licenses this file to You
-# under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-######################################################################
-# Apache Central Repository
-######################################################################
-maven.repo.central=www.apache.org
-maven.repo.central.directory=/www/www.apache.org/dist/java-repository
-maven.remote.group=apcvs
-maven.changelog.factory = org.apache.maven.svnlib.SvnChangeLogFactory
-
-######################################################################
-# JUnit Testing
-######################################################################
-maven.test.failure = false
-maven.junit.fork=true
-#maven.test.search.classdir=true
-maven.junit.jvmargs=-Xmx128m
-#maven.junit.sysproperties=org.xml.sax.driver java.security.auth.login.config
-maven.junit.sysproperties=org.xml.sax.driver
-org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
-#java.security.auth.login.config=applications/test/jaas.config
-
-
-#If you wish to skip tests when doing builds, uncomment
-#maven.test.skip = true
-
-######################################################################
-# Checkstyle
-######################################################################
-maven.checkstyle.properties= checkstyle.xml
-maven.linkcheck.enable=false
-
-######################################################################
-# JavaDoc
-#
-# javadoc urls can be added here, multiple urls are appended using a comma
-#
-# maven.javadoc.links = http://foo/bar/api,\
-# http://flim/flam/api/
-######################################################################
-maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api/,\
- http://jackrabbit.apache.org/apidocs/,\
- http://www.day.com/maven/jsr170/javadocs/jcr-1.0/
-maven.javadoc.author=false
-maven.javadoc.version=false
-
-######################################################################
-# Other opts
-######################################################################
-# uncomment the next line to work in offline mode (no jar download & no linkcheck)
-#maven.mode.online=
-
-maven.compile.debug=on
-maven.compile.deprecation=off
-maven.compile.optimize=off
-
-maven.compile.source=1.4
-maven.compile.target=1.4
-
-maven.jarResources.basedir=src/java
-maven.jar.excludes=**/package.html
-
-# specifying additional remote repository for downloading dependencies
-# not available at www.ibiblio.org/maven/
-maven.repo.remote = http://www.ibiblio.org/maven/,http://www.day.com/maven/
-
-######################################################################
-# Site L&F
-######################################################################
-# maven.xdoc.jsl=
-maven.xdoc.date=
-maven.xdoc.poweredby.image=maven-feather.png
-maven.xdoc.version=${pom.currentVersion}
-maven.xdoc.developmentProcessUrl=http://jackrabbit.apache.org/
-maven.changelog.range=60
-maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory
-
-######################################################################
-# Site Deploy (into ../jackrabbit-site for checkout on jackrabbit.apache.org)
-######################################################################
-maven.site.deploy.method=fs
diff --git a/contrib/bdb-persistence/project.xml b/contrib/bdb-persistence/project.xml
deleted file mode 100644
index 3ec6bac..0000000
--- a/contrib/bdb-persistence/project.xml
+++ /dev/null
@@ -1,184 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. The ASF licenses this file to You
- under the Apache License, Version 2.0 (the "License"); you may not
- use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project>
- <pomVersion>3</pomVersion>
- <artifactId>jackrabbit-bdb</artifactId>
- <groupId>org.apache.jackrabbit</groupId>
- <name>Jackrabbit BerkeleyDB Persistence Manager</name>
- <currentVersion>1.0-SNAPSHOT</currentVersion>
- <organization>
- <name>The Apache Software Foundation</name>
- <url>http://www.apache.org/</url>
- <logo>http://www.apache.org/images/asf_logo_wide.png</logo>
- </organization>
- <inceptionYear>2005</inceptionYear>
- <package>org.apache.jackrabbit.*</package>
- <logo>/images/jackrabbitlogo.gif</logo>
- <description>
- A BerkeleyDB persistence manager for jackrabbit. It uses the
- BerkeleyDB Java Edition
- (http://www.sleepycat.com/products/je.shtml)
- </description>
- <shortDescription>
- A BerkeleyDB persistence manager for jackrabbit
- </shortDescription>
-
- <repository>
- <connection>scm:svn:http://svn.apache.org/repos/asf/jackrabbit/trunk/contrib/bdb-persistence</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/jackrabbit/trunk/contrib/bdb-persistence</developerConnection>
- <url>http://svn.apache.org/viewcvs</url>
- </repository>
- <developers>
- <developer>
- <name>Guillaume Bort</name>
- <email>guillaume.bort@zenexity.fr</email>
- <organization>zenexity.fr</organization>
- <timezone>+1</timezone>
- </developer>
- </developers>
-
- <dependencies>
- <!--
- compile-time dependencies of the BerkeleyDB persistence manager
- -->
- <dependency>
- <groupId>berkeleydb</groupId>
- <artifactId>je</artifactId>
- <version>1.7.1</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>jsr170</groupId>
- <artifactId>jcr</artifactId>
- <version>1.0</version>
- <type>jar</type>
- <url>http://www.day.com/maven/jsr170/jars/jcr-1.0.jar</url>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-core</artifactId>
- <version>${pom.currentVersion}</version>
- <type>jar</type>
- </dependency>
-
- <!--
- compile-time dependencies of the jUnit test-cases
- in the core project
- -->
- <dependency>
- <groupId>concurrent</groupId>
- <artifactId>concurrent</artifactId>
- <version>1.3.4</version>
- </dependency>
- <dependency>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-jta</artifactId>
- <version>1.0-M1</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.8</version>
- </dependency>
-
- <!--
- runtime dependencies of jackrabbit/jUnit test-cases
- -->
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.8</version>
- </dependency>
- <dependency>
- <groupId>lucene</groupId>
- <artifactId>lucene</artifactId>
- <version>1.4.3</version>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.6.2</version>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xmlParserAPIs</artifactId>
- <version>2.0.2</version>
- </dependency>
- </dependencies>
-
- <build>
- <sourceDirectory>src/java</sourceDirectory>
- <unitTestSourceDirectory>../../src/test</unitTestSourceDirectory>
- <unitTest>
- <includes>
- <include>**/*TestAll.java</include>
- </includes>
- <excludes>
- <exclude>**/init/*</exclude>
- </excludes>
- <resources>
- <resource>
- <directory>applications/test</directory>
- <includes>
- <include>*.properties</include>
- <include>*.xml</include>
- </includes>
- </resource>
- <resource>
- <directory>../../src/test</directory>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.txt</include>
- </includes>
- </resource>
- </resources>
- </unitTest>
- <resources>
- <resource>
- <directory>src/java</directory>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- <include>**/*.TextFilterService</include>
- </includes>
- </resource>
- </resources>
- </build>
-
- <reports>
- <report>maven-changelog-plugin</report>
- <report>maven-changes-plugin</report>
- <report>maven-checkstyle-plugin</report>
- <report>maven-javadoc-plugin</report>
- <report>maven-junit-report-plugin</report>
- <report>maven-jxr-plugin</report>
- <report>maven-license-plugin</report>
- <report>maven-tasklist-plugin</report>
- </reports>
-
-</project>
diff --git a/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/BerkeleyDBPersistenceManager.java b/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/BerkeleyDBPersistenceManager.java
deleted file mode 100644
index f228303..0000000
--- a/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/BerkeleyDBPersistenceManager.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.bdb;
-
-import com.sleepycat.je.Database;
-import com.sleepycat.je.DatabaseConfig;
-import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.Environment;
-import com.sleepycat.je.EnvironmentConfig;
-import com.sleepycat.je.LockMode;
-import com.sleepycat.je.OperationStatus;
-import com.sleepycat.je.Transaction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
-import org.apache.jackrabbit.core.fs.FileSystem;
-import org.apache.jackrabbit.core.fs.local.LocalFileSystem;
-import org.apache.jackrabbit.core.state.AbstractPersistenceManager;
-import org.apache.jackrabbit.core.state.ChangeLog;
-import org.apache.jackrabbit.core.state.ItemStateException;
-import org.apache.jackrabbit.core.state.NoSuchItemStateException;
-import org.apache.jackrabbit.core.state.NodeReferences;
-import org.apache.jackrabbit.core.state.NodeReferencesId;
-import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.PMContext;
-import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.util.BLOBStore;
-import org.apache.jackrabbit.core.state.util.FileSystemBLOBStore;
-
-import java.io.File;
-
-public class BerkeleyDBPersistenceManager extends AbstractPersistenceManager {
-
- private static Log log = LogFactory.getLog(BerkeleyDBPersistenceManager.class);
-
- protected static final String ENCODING = "UTF-8";
-
- private boolean initialized = false;
- private Environment environment;
- private Database database;
- // file system where BLOB data is stored
- private FileSystem blobFS;
- // BLOBStore that manages BLOB data in the file system
- private BLOBStore blobStore;
-
- private ThreadLocal localTransaction = new ThreadLocal(); // ?? are persistence managers thread-safes ???
-
- //
-
- public void init(PMContext context) throws Exception {
- if (initialized) {
- throw new IllegalStateException("already initialized");
- }
-
- // prepare the db directory
- File envDir = new File(context.getHomeDir(), "db");
- if (!envDir.exists()) {
- envDir.mkdirs();
- }
-
- log.debug("init berkeleyDb environment at " + envDir.getAbsolutePath());
-
- // create environnement
- EnvironmentConfig config = new EnvironmentConfig();
- config.setAllowCreate(true);
- config.setTransactional(true);
- environment = new Environment(envDir, config);
-
- // open database
- DatabaseConfig dbConfig = new DatabaseConfig();
- dbConfig.setAllowCreate(true);
- dbConfig.setSortedDuplicates(false);
- dbConfig.setTransactional(true);
- database = environment.openDatabase(null, "jcrStore", dbConfig);
-
- /**
- * store BLOB data in local file system in a sub directory
- * of the workspace home directory
- */
- LocalFileSystem blobFS = new LocalFileSystem();
- blobFS.setRoot(new File(context.getHomeDir(), "blobs"));
- blobFS.init();
- this.blobFS = blobFS;
- blobStore = new FileSystemBLOBStore(blobFS);
-
- initialized = true;
- }
-
- public void close() throws Exception {
- if (!initialized) {
- throw new IllegalStateException("not initialized");
- }
-
- log.debug("close berkeleyDb environment");
-
- // close database
- database.close();
-
- // close environnement
- environment.close();
-
- // close BLOB file system
- blobFS.close();
- blobFS = null;
- blobStore = null;
-
- initialized = false;
- }
-
- //
-
- public NodeState load(NodeId id) throws NoSuchItemStateException, ItemStateException {
- try {
- DatabaseEntry key = new DatabaseEntry();
- DatabaseEntry value = new DatabaseEntry();
- NodeStateTupleBinding tupleBinding = new NodeStateTupleBinding(id);
- key.setData(id.toString().getBytes(ENCODING));
- OperationStatus operationStatus = database.get(null, key, value, LockMode.DEFAULT);
- if (operationStatus.equals(OperationStatus.NOTFOUND)) {
- throw new NoSuchItemStateException(id.toString());
- }
- return (NodeState) tupleBinding.entryToObject(value);
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-
- public PropertyState load(PropertyId id) throws NoSuchItemStateException, ItemStateException {
- try {
- DatabaseEntry key = new DatabaseEntry();
- DatabaseEntry value = new DatabaseEntry();
- PropertyStateTupleBinding tupleBinding = new PropertyStateTupleBinding(id, blobStore);
- key.setData(id.toString().getBytes(ENCODING));
- OperationStatus operationStatus = database.get(null, key, value, LockMode.DEFAULT);
- if (operationStatus.equals(OperationStatus.NOTFOUND)) {
- throw new NoSuchItemStateException(id.toString());
- }
- return (PropertyState) tupleBinding.entryToObject(value);
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-
- public NodeReferences load(NodeReferencesId id) throws NoSuchItemStateException, ItemStateException {
- try {
- DatabaseEntry key = new DatabaseEntry();
- DatabaseEntry value = new DatabaseEntry();
- NodeReferencesTupleBinding tupleBinding = new NodeReferencesTupleBinding(id);
- key.setData((id.toString() + ".references").getBytes(ENCODING));
- OperationStatus operationStatus = database.get(null, key, value, LockMode.DEFAULT);
- if (operationStatus.equals(OperationStatus.NOTFOUND)) {
- throw new NoSuchItemStateException(id.toString());
- }
- return (NodeReferences) tupleBinding.entryToObject(value);
- } catch (NoSuchItemStateException e) {
- throw e;
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-
- public boolean exists(NodeId id) throws ItemStateException {
- try {
- DatabaseEntry key = new DatabaseEntry();
- DatabaseEntry value = new DatabaseEntry();
- key.setData(id.toString().getBytes(ENCODING));
- OperationStatus operationStatus = database.get(null, key, value, LockMode.DEFAULT);
- return operationStatus.equals(OperationStatus.SUCCESS);
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-
- public boolean exists(PropertyId id) throws ItemStateException {
- try {
- DatabaseEntry key = new DatabaseEntry();
- DatabaseEntry value = new DatabaseEntry();
- key.setData(id.toString().getBytes(ENCODING));
- OperationStatus operationStatus = database.get(null, key, value, LockMode.DEFAULT);
- return operationStatus.equals(OperationStatus.SUCCESS);
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-
- public boolean exists(NodeReferencesId targetId) throws ItemStateException {
- try {
- DatabaseEntry key = new DatabaseEntry();
- DatabaseEntry value = new DatabaseEntry();
- key.setData((targetId.toString() + ".references").getBytes(ENCODING));
- OperationStatus operationStatus = database.get(null, key, value, LockMode.DEFAULT);
- return operationStatus.equals(OperationStatus.SUCCESS);
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-
- //
-
- public synchronized void store(ChangeLog changeLog) throws ItemStateException {
- Transaction transaction = null;
- try {
- transaction = environment.beginTransaction(null, null);
- localTransaction.set(transaction);
- super.store(changeLog);
- transaction.commit();
- } catch (Exception e) {
- try {
- if (transaction != null) {
- transaction.abort();
- }
- } catch (Exception fe) {
- log.fatal(fe);
- }
- throw new ItemStateException(e.getMessage(), e);
- } finally {
- localTransaction.set(null);
- }
- }
-
- //
-
- protected void store(NodeState state) throws ItemStateException {
- try {
- Transaction transaction = (Transaction) localTransaction.get();
- DatabaseEntry key = new DatabaseEntry();
- DatabaseEntry value = new DatabaseEntry();
- NodeStateTupleBinding tupleBinding = new NodeStateTupleBinding();
- key.setData(state.getId().toString().getBytes(ENCODING));
- tupleBinding.objectToEntry(state, value);
- OperationStatus operationStatus = database.put(transaction, key, value);
- if (!operationStatus.equals(OperationStatus.SUCCESS)) {
- throw new ItemStateException(operationStatus.toString());
- }
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-
- protected void store(PropertyState state) throws ItemStateException {
- try {
- Transaction transaction = (Transaction) localTransaction.get();
- DatabaseEntry key = new DatabaseEntry();
- DatabaseEntry value = new DatabaseEntry();
- PropertyStateTupleBinding tupleBinding = new PropertyStateTupleBinding(blobStore);
- key.setData(state.getId().toString().getBytes(ENCODING));
- tupleBinding.objectToEntry(state, value);
- OperationStatus operationStatus = database.put(transaction, key, value);
- if (!operationStatus.equals(OperationStatus.SUCCESS)) {
- throw new ItemStateException(operationStatus.toString());
- }
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-
- protected void store(NodeReferences refs) throws ItemStateException {
- try {
- Transaction transaction = (Transaction) localTransaction.get();
- DatabaseEntry key = new DatabaseEntry();
- DatabaseEntry value = new DatabaseEntry();
- NodeReferencesTupleBinding tupleBinding = new NodeReferencesTupleBinding();
- key.setData((refs.getTargetId().toString() + ".references").getBytes(ENCODING));
- tupleBinding.objectToEntry(refs, value);
- OperationStatus operationStatus = database.put(transaction, key, value);
- if (!operationStatus.equals(OperationStatus.SUCCESS)) {
- throw new ItemStateException(operationStatus.toString());
- }
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-
- protected void destroy(NodeState state) throws ItemStateException {
- try {
- Transaction transaction = (Transaction) localTransaction.get();
- DatabaseEntry key = new DatabaseEntry();
- key.setData(state.getId().toString().getBytes(ENCODING));
- OperationStatus operationStatus = database.delete(transaction, key);
- if (!operationStatus.equals(OperationStatus.SUCCESS)) {
- throw new ItemStateException(operationStatus.toString());
- }
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-
- protected void destroy(PropertyState state) throws ItemStateException {
- try {
- Transaction transaction = (Transaction) localTransaction.get();
- DatabaseEntry key = new DatabaseEntry();
- key.setData(state.getId().toString().getBytes(ENCODING));
- OperationStatus operationStatus = database.delete(transaction, key);
- if (!operationStatus.equals(OperationStatus.SUCCESS)) {
- throw new ItemStateException(operationStatus.toString());
- }
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-
- protected void destroy(NodeReferences refs) throws ItemStateException {
- try {
- Transaction transaction = (Transaction) localTransaction.get();
- DatabaseEntry key = new DatabaseEntry();
- key.setData((refs.getTargetId().toString() + ".references").getBytes(ENCODING));
- OperationStatus operationStatus = database.delete(transaction, key);
- if (!operationStatus.equals(OperationStatus.SUCCESS)) {
- throw new ItemStateException(operationStatus.toString());
- }
- } catch (Exception e) {
- log.error(e);
- throw new ItemStateException(e.getMessage(), e);
- }
- }
-}
diff --git a/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/NodeReferencesTupleBinding.java b/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/NodeReferencesTupleBinding.java
deleted file mode 100644
index 67536b7..0000000
--- a/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/NodeReferencesTupleBinding.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.bdb;
-
-import com.sleepycat.bind.tuple.TupleBinding;
-import com.sleepycat.bind.tuple.TupleInput;
-import com.sleepycat.bind.tuple.TupleOutput;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.core.state.NodeReferences;
-import org.apache.jackrabbit.core.state.NodeReferencesId;
-import org.apache.jackrabbit.core.state.util.Serializer;
-
-public class NodeReferencesTupleBinding extends TupleBinding {
-
- private Log log = LogFactory.getLog(NodeReferencesTupleBinding.class);
-
- private NodeReferencesId id;
-
- public NodeReferencesTupleBinding(NodeReferencesId id) {
- this.id = id;
- }
-
- public NodeReferencesTupleBinding() {
- }
-
- public Object entryToObject(TupleInput in) {
-
- NodeReferences refs = new NodeReferences(id);
-
- try {
- Serializer.deserialize(refs, in);
- } catch (Exception e) {
- // since the TupleInput methods do not throw any
- // exceptions the above call should neither...
- String msg = "error while deserializing node references";
- log.debug(msg);
- throw new RuntimeException(msg, e);
- }
-
- return refs;
- }
-
- public void objectToEntry(Object o, TupleOutput out) {
- try {
- Serializer.serialize((NodeReferences) o, out);
- } catch (Exception e) {
- // since the TupleOutput methods do not throw any
- // exceptions the above call should neither...
- String msg = "error while serializing node references";
- log.debug(msg);
- throw new RuntimeException(msg, e);
- }
- }
-}
diff --git a/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/NodeStateTupleBinding.java b/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/NodeStateTupleBinding.java
deleted file mode 100644
index 74c3a36..0000000
--- a/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/NodeStateTupleBinding.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.bdb;
-
-import com.sleepycat.bind.tuple.TupleBinding;
-import com.sleepycat.bind.tuple.TupleInput;
-import com.sleepycat.bind.tuple.TupleOutput;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.util.Serializer;
-
-public class NodeStateTupleBinding extends TupleBinding {
-
- private Log log = LogFactory.getLog(NodeStateTupleBinding.class);
-
- private NodeId id;
-
- public NodeStateTupleBinding(NodeId nodeId) {
- this.id = nodeId;
- }
-
- public NodeStateTupleBinding() {
- }
-
- public Object entryToObject(TupleInput in) {
-
- NodeState state = new NodeState(id, null, null, NodeState.STATUS_NEW, false);
-
- try {
- Serializer.deserialize(state, in);
- } catch (Exception e) {
- // since the TupleInput methods do not throw any
- // exceptions the above call should neither...
- String msg = "error while deserializing node state";
- log.debug(msg);
- throw new RuntimeException(msg, e);
- }
-
- return state;
- }
-
- public void objectToEntry(Object o, TupleOutput out) {
- try {
- Serializer.serialize((NodeState) o, out);
- } catch (Exception e) {
- // since the TupleOutput methods do not throw any
- // exceptions the above call should neither...
- String msg = "error while serializing node state";
- log.debug(msg);
- throw new RuntimeException(msg, e);
- }
- }
-
-}
diff --git a/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/PropertyStateTupleBinding.java b/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/PropertyStateTupleBinding.java
deleted file mode 100644
index 66fb860..0000000
--- a/contrib/bdb-persistence/src/java/org/apache/jackrabbit/core/state/bdb/PropertyStateTupleBinding.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.state.bdb;
-
-import com.sleepycat.bind.tuple.TupleBinding;
-import com.sleepycat.bind.tuple.TupleInput;
-import com.sleepycat.bind.tuple.TupleOutput;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.core.PropertyId;
-import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.util.BLOBStore;
-import org.apache.jackrabbit.core.state.util.Serializer;
-
-public class PropertyStateTupleBinding extends TupleBinding {
-
- private Log log = LogFactory.getLog(PropertyStateTupleBinding.class);
-
- private BLOBStore blobStore;
- private PropertyId id;
-
- public PropertyStateTupleBinding(BLOBStore blobStore) {
- this.blobStore = blobStore;
- }
-
- public PropertyStateTupleBinding(PropertyId propertyId, BLOBStore blobStore) {
- this.blobStore = blobStore;
- this.id = propertyId;
- }
-
- public Object entryToObject(TupleInput in) {
-
- PropertyState state = new PropertyState(id, PropertyState.STATUS_NEW, false);
-
- try {
- Serializer.deserialize(state, in, blobStore);
- } catch (Exception e) {
- // since the TupleInput methods do not throw any
- // exceptions the above call should neither...
- String msg = "error while deserializing property state";
- log.debug(msg);
- throw new RuntimeException(msg, e);
- }
-
- return state;
- }
-
- public void objectToEntry(Object o, TupleOutput out) {
- try {
- Serializer.serialize((PropertyState) o, out, blobStore);
- } catch (Exception e) {
- // since the TupleOutput methods do not throw any
- // exceptions the above call should neither...
- String msg = "error while serializing property state";
- log.debug(msg);
- throw new RuntimeException(msg, e);
- }
- }
-}
diff --git a/contrib/classloader/HEADER.txt b/contrib/classloader/HEADER.txt
deleted file mode 100644
index 1c10dad..0000000
--- a/contrib/classloader/HEADER.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
\ No newline at end of file
diff --git a/contrib/classloader/LICENSE.txt b/contrib/classloader/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/contrib/classloader/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- 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.
diff --git a/contrib/classloader/project.properties b/contrib/classloader/project.properties
deleted file mode 100644
index 820b610..0000000
--- a/contrib/classloader/project.properties
+++ /dev/null
@@ -1,106 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. The ASF licenses this file to You
-# under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-######################################################################
-# Apache Central Repository
-######################################################################
-maven.repo.central=www.apache.org
-maven.repo.central.directory=/www/www.apache.org/dist/java-repository
-maven.remote.group=apcvs
-maven.changelog.factory = org.apache.maven.svnlib.SvnChangeLogFactory
-
-######################################################################
-# JUnit Testing
-######################################################################
-maven.test.failure = false
-maven.junit.fork=true
-maven.junit.dir=${maven.build.dir}
-#maven.junit.sysproperties=org.xml.sax.driver java.security.auth.login.config
-maven.junit.sysproperties=org.xml.sax.driver
-org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
-#java.security.auth.login.config=applications/test/jaas.config
-
-
-#If you wish to skip tests when doing builds, uncomment
-#maven.test.skip = true
-
-######################################################################
-# Checkstyle
-######################################################################
-maven.checkstyle.properties= checkstyle.xml
-maven.linkcheck.enable=false
-
-######################################################################
-# JavaDoc
-#
-# javadoc urls can be added here, multiple urls are appended using a comma
-#
-# maven.javadoc.links = http://foo/bar/api,\
-# http://flim/flam/api/
-######################################################################
-maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api/,http://www.day.com/maven/jsr170/javadocs/jcr-0.16.4.1/
-maven.javadoc.author=false
-maven.javadoc.version=false
-
-######################################################################
-# Other opts
-######################################################################
-# uncomment the next line to work in offline mode (no jar download & no linkcheck)
-#maven.mode.online=
-
-maven.compile.debug=on
-maven.compile.deprecation=off
-maven.compile.optimize=off
-maven.compile.source=1.4
-maven.compile.target=1.4
-
-maven.jarResources.basedir=src/java
-maven.jar.excludes=**/package.html
-
-# Location of the generated query language parsers. Needed for
-# the Maven Eclipse plugin to automatically locate the generated
-# source files. Note that this value matches the hardcoded path
-# in the Maven JavaCC plugin. Therefore, do not change this value!
-maven.gen.src=${maven.build.dir}/generated-src/main
-
-# specifying additional remote repository for downloading dependencies
-# not available at www.ibiblio.org/maven/
-maven.repo.remote = http://www.ibiblio.org/maven/,http://www.day.com/maven/
-
-######################################################################
-# Site L&F
-######################################################################
-# maven.xdoc.jsl=
-maven.xdoc.date=
-maven.xdoc.poweredby.image=maven-feather.png
-maven.xdoc.version=${pom.currentVersion}
-maven.xdoc.developmentProcessUrl=http://jackrabbit.apache.org/
-maven.changelog.range=60
-maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory
-maven.multiproject.overviewPage.title=Jackrabbit components
-
-# ------------------------------------------------------------------------
-# M A V E N J A R O V E R R I D E
-# ------------------------------------------------------------------------
-#maven.jar.override = on
-#maven.jar.jcr = ${basedir}/lib/jcr.jar
-
-######################################################################
-# Site Deploy (into ../jackrabbit-site for checkout on jackrabbit.apache.org)
-######################################################################
-maven.site.deploy.method=fs
-
-# IDE settings
-maven.eclipse.resources.addtoclasspath=true
-
diff --git a/contrib/classloader/project.xml b/contrib/classloader/project.xml
deleted file mode 100644
index 2541deb..0000000
--- a/contrib/classloader/project.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. The ASF licenses this file to You
- under the Apache License, Version 2.0 (the "License"); you may not
- use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<project>
- <pomVersion>1</pomVersion>
- <groupId>org.apache.jackrabbit</groupId>
- <currentVersion>1.0-SNAPSHOT</currentVersion>
- <organization>
- <name>The Apache Software Foundation</name>
- <url>http://www.apache.org/</url>
- <logo>http://www.apache.org/images/asf_logo_wide.png</logo>
- </organization>
- <inceptionYear>2005</inceptionYear>
- <package>org.apache.jackrabbit.classloader</package>
- <description>Classloader is an independent subproject of the Jackrabbit project. It provides support for loading classes from from Java Content Repository for Java Technology API (JCR) implementations. Although implemented as a contribution to the Jackrabbit project, the Jackrabbit Repository Classloader layer is independent of the underlying JCR repository implementation, with a small exception regarding node type creation.</description>
- <shortDescription>Java Classloader for JCR Repositories</shortDescription>
- <repository />
- <developers>
- <developer>
- <name>Felix Meschberger</name>
- <id>1</id>
- <email>fmeschbe@apache.org</email>
- <organization>Day Software</organization>
- <timezone>+1</timezone>
- </developer>
- </developers>
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>/LICENSE.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <reports>
- <report>maven-javadoc-plugin</report>
- <report>maven-jdepend-plugin</report>
- <report>maven-license-plugin</report>
- </reports>
- <artifactId>classloader</artifactId>
- <name>Jackrabbit Repository Classloader</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-core</artifactId>
- <version>1.0-SNAPSHOT</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>jsr170</groupId>
- <artifactId>jcr</artifactId>
- <version>1.0</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0</version>
- <type>jar</type>
- </dependency>
-
- <!-- Unit Testing -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.0</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.8</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.1</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>concurrent</groupId>
- <artifactId>concurrent</artifactId>
- <version>1.3.4</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>lucene</groupId>
- <artifactId>lucene</artifactId>
- <version>1.4.3</version>
- <type>jar</type>
- </dependency>
- </dependencies>
- <build>
- <sourceDirectory>src/main/java</sourceDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
- <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
- <unitTest>
- <includes>
- <include>**/*TestAll.java</include>
- </includes>
- <resources>
- <resource>
- <directory>src/test/resources</directory>
- </resource>
- </resources>
- </unitTest>
- </build>
-</project>
-
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ArchiveClassPathEntry.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ArchiveClassPathEntry.java
deleted file mode 100644
index aab6e14..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ArchiveClassPathEntry.java
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-import java.util.jar.Manifest;
-
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.net.URLFactory;
-
-
-/**
- * The <code>ArchiveClassPathEntry</code> implements the {@link ClassPathEntry}
- * abstract class with support for archives containing classes and other
- * resources. The path used to construct the instance is the path of an item
- * resolving to a property containing the jar archive to access.
- *
- * @author Felix Meschberger
- */
-class ArchiveClassPathEntry extends ClassPathEntry {
-
- /** Default logger */
- private static final Log log =
- LogFactory.getLog(ArchiveClassPathEntry.class);
-
- /** The property containing the archive */
- private final Property prop;
-
- /**
- * Cache all entries in the archive for faster decision on whether such
- * an entry is contained.
- */
- private Map entryMap;
-
- /**
- * The JAR file manifest. Set on demand by the {@link #getManifest()}
- * method.
- */
- private Manifest jarManifest;
-
- /**
- * Flag to indicate, whether the {@link #jarManifest} has already been read
- * from the archive. This field is used and set by the
- * {@link #getManifest()} to decide, whether to try to read the manifest.
- */
- private boolean jarManifestRead;
-
- /**
- * Creates an instance of the <code>ArchiveClassPathEntry</code> class.
- *
- * @param prop The <code>Property</code> containing the archive and
- * the session used to access the repository.
- * @param path The original class path entry leading to the creation of
- * this instance. This is not necessairily the same path as the
- * properties path if the property was found through the primary
- * item chain.
- *
- * @throws RepositoryException If an error occurrs retrieving the session
- * from the property.
- */
- ArchiveClassPathEntry(Property prop, String path) throws RepositoryException {
- super(prop.getSession(), path);
- this.prop = prop;
- }
-
- /**
- * Clones the indicated <code>ArchiveClassPathEntry</code> object by
- * taking over its path, session and property.
- *
- * @param base The base <code>ArchiveClassPath</code> entry to clone.
- *
- * @see ClassPathEntry#ClassPathEntry(ClassPathEntry)
- */
- protected ArchiveClassPathEntry(ArchiveClassPathEntry base) {
- super(base);
- this.prop = base.prop;
- }
-
- /**
- * Returns the <code>Property</code> containing the JAR file of this
- * archive class path entry.
- */
- protected Property getProperty() {
- return prop;
- }
-
- /**
- * Returns a {@link ClassLoaderResource} for the named resource if it
- * can be found in the archive identified by the path given at
- * construction time. Note that if the archive property would exist but is
- * not readable by the current session, no resource is returned.
- * <p>
- * This method accesses the archive through an <code>InputStream</code>
- * retrievedfrom the property. This <code>InputStream</code> is closed before
- * returning to the caller to release the resources behind the stream
- * such that it might be updated, etc. For this reason the resource
- * instance returned will again open an <code>InputStream</code> on the
- * archive property to access the resource. Users of the resource
- * <code>InputStream</code> are encouraged to close the stream when no
- * longer used to prevent lockups in the Repository.
- *
- * @param name The name of the resource to return. If the resource would
- * be a class the name must already be modified to denote a valid
- * path, that is dots replaced by slashes and the <code>.class</code>
- * extension attached.
- *
- * @return The {@link ClassLoaderResource} identified by the name or
- * <code>null</code> if no resource is found for that name.
- */
- public ClassLoaderResource getResource(final String name) {
-
- JarInputStream zins = null;
- try {
- // get the archive and try to find the entry
- zins = getJarInputStream(prop);
- JarEntry entry = findEntry(zins, name);
-
- // if found create the resource to return
- if (entry != null) {
- return new ArchiveClassPathResource(this, entry);
- }
-
- log.debug("getResource: resource " + name + " not found"
- + " in archive " + path);
-
- } catch (IOException ioe) {
-
- log.warn("getResource: problem accessing the archive " + path
- + " for " + name + ": " + ioe.toString());
-
- } catch (RepositoryException re) {
-
- log.warn("getResource: problem accessing the archive " + path
- + " for " + name + ": " + re.toString());
-
- } finally {
-
- // make sure streams are closed at the end
- if (zins != null) {
- try {
- zins.close();
- } catch (IOException ignore) {
- }
- }
-
- }
- // invariant : not found or problem accessing the archive
-
- return null;
- }
-
- /**
- * Returns a <code>ClassPathEntry</code> with the same configuration as
- * this <code>ClassPathEntry</code>.
- * <p>
- * The <code>ArchiveClassPathEntry</code> class has internal state.
- * Therefore a new instance is created from the unmodifiable configuration
- * of this instance.
- */
- ClassPathEntry copy() {
- return new ArchiveClassPathEntry(this);
- }
-
- /**
- * Returns a JAR URL with no entry as the base URL of this class path entry.
- */
- public URL toURL() {
- if (baseURL == null) {
- try {
- baseURL = URLFactory.createJarURL(session, path, null);
- } catch (MalformedURLException mue) {
- log.warn("Problem creating baseURI for " + path, mue);
- }
- }
-
- return baseURL;
- }
-
- //----------- internal helper to find the entry ------------------------
-
- /**
- * Returns a JAR URL to access the named resource within the archive
- * underlying this class path entry. This is a helper method for the
- * {@link ClassLoaderResource} instance returned by
- * {@link #getResource(String)} method.
- * <p>
- * This method does not check, whether the named entry actually exists in
- * the underlying archive.
- *
- * @param name The name of the resource for which to create the JAR URL.
- */
- protected URL getURL(String name) {
- try {
- return URLFactory.createJarURL(session, path, name);
- } catch (MalformedURLException mue) {
- log.error("getURL: Cannot create URL for " + name, mue);
- }
- return null;
- }
-
- /**
- * Returns an URL to access the underlying archive itself of this class
- * path entry. The URL returned may be used as the code source for Java
- * securtiy protection domains. This is a helper method for the
- * {@link ClassLoaderResource} instance returned by
- * {@link #getResource(String)} method.
- *
- * @return The URL to access the underlying archive.
- */
- protected URL getCodeSourceURL() {
- try {
- return URLFactory.createURL(session, path);
- } catch (MalformedURLException mue) {
- log.warn("getCodeSourceURL: Cannot getURL" + " for " + path, mue);
- }
- return null;
- }
-
- /**
- * Returns a <code>JarInputStream</code> from the property.
- *
- * @param property The <code>Property</code> containing the archive to
- * access.
- *
- * @return A valid <code>JarInputStream</code>.
- *
- * @throws RepositoryException If an <code>InputStream</code> cannot be
- * retrieved from the property.
- * @throws IOException If the <code>JarInputStream</code> cannot be
- * created.
- */
- static JarInputStream getJarInputStream(Property property)
- throws RepositoryException, IOException {
- return new JarInputStream(property.getStream());
- }
-
- /**
- * Returns the <code>Manifest</code> object of the JAR archive file
- * underlying this archive class path entry. If no manifest exists in the
- * JAR file or if the archive is not a JAR file at - e.g. a plain ZIP
- * file - this method returns <code>null</code>. If an error occurrs
- * trying to access the manifest, <code>null</code> is also returned. Later
- * calls to this method, will not try again to read the manifest file,
- * though.
- * <p>
- * This method is synchronized to prevent two threads from trying to access
- * the manifest at the same time, which might result in false negative
- * returned.
- *
- * @return The manifest contained in the underlying JAR file or
- * <code>null</code> if none exists or an error occurrs trying to
- * load the manifest.
- */
- protected synchronized Manifest getManifest() {
- if (jarManifest == null && !jarManifestRead) {
-
- // immediately mark the manifest read, to prevent repeated read
- // in the case of missing manifest
- jarManifestRead = true;
-
- JarInputStream zipIns = null;
- try {
- zipIns = new JarInputStream(prop.getStream());
- jarManifest = zipIns.getManifest();
- } catch (RepositoryException re) {
- log.warn("Cannot access JAR file " + getPath(), re);
- } catch (IOException ioe) {
- log.warn("Cannot access manifest of JAR file " + getPath(), ioe);
- } finally {
- if (zipIns != null) {
- try {
- zipIns.close();
- } catch (IOException ignore) {
- }
- }
- }
- }
-
- return jarManifest;
- }
-
- /**
- * Returns the <code>JarEntry</code> for the path from the
- * <code>JarInputStream</code> or <code>null</code> if the path cannot
- * be found in the archive.
- *
- * @param zins The <code>JarInputStream</code> to search in.
- * @param path The path of the <code>JarEntry</code> to return.
- *
- * @return The <code>JarEntry</code> for the path or <code>null</code>
- * if no such entry can be found.
- *
- * @throws IOException if a problem occurrs reading from the stream.
- */
- JarEntry findEntry(JarInputStream zins, String path)
- throws IOException {
-
- if (entryMap == null) {
-
- // make sure to not build the list twice
- synchronized (this) {
-
- /**
- * make sure, we still need to build the list. this
- * implementation surely does not cure all problems of the
- * double-checked-locking problem, but it surely remmedies
- * the main problem where the reference is already written
- * to the field before the constructor has finished. Also
- * this only assigns the field when the contents has been
- * filled.
- */
- if (entryMap == null) {
-
- // prepare an empty entry map to be filled
- Map tmpEntryMap = new HashMap();
-
- try {
- // build the name-to-index map
- log.debug("findEntry: Building map while searching");
-
- JarEntry result = null;
- JarEntry entry = zins.getNextJarEntry();
- for (int i=0; entry != null; i++) {
-
- // add the entry to the map
- String name = entry.getName();
- Integer entryNumO = new Integer(i);
- tmpEntryMap.put(name, entryNumO);
- log.debug("findEntry: Entry " + name + " ==> " +
- entryNumO);
-
- // if we found our entry, keep it to be returned later
- if (result == null && path.equals(name)) {
- log.debug("findEntry: Found the entry, " +
- "continue indexing");
- result = entry;
- }
-
- // on to the next entry
- entry = zins.getNextJarEntry();
- }
- // invariant: path has the entry found or null
-
- // return what we found
- log.debug("findEntry: Indexing complete, " +
- "returning " + result);
- return result;
-
- } finally {
-
- /**
- * assign the finished tmp entryMap to the field now.
- * theoretically, this may still be null, which
- * is no issue because it will be tried to be
- * rebuilt - over and over again, though - by the
- * next call to findEntry.
- * in the case of build problems, the map be empty
- * in which case it will not be rebuilt, which is
- * ok, too, given that reading will still yield
- * problems.
- */
-
- entryMap = tmpEntryMap;
- }
-
- }
- }
- }
- // invariant: entryMap is not null, but might be empty
- // ( in case of problems creating the tmpEntryMap above, e.g.
- // OutOfMemoryError, the entryMap might be null, but then we
- // are thrown out of the method any way ... this is no issue
- // here )
-
- // map exists, lets try to get via number
- Number entryNumO = (Number) entryMap.get(path);
- if (entryNumO == null) {
- log.debug("findEntry: This archive does not contain " + path);
- return null;
- }
-
- // find the indexed entry
- log.debug("findEntry: " + path + " is entry #" + entryNumO);
- int entryNum = entryNumO.intValue();
- JarEntry entry = zins.getNextJarEntry();
- while (entryNum > 0 && entry != null) {
- entry = zins.getNextJarEntry();
- entryNum--;
- }
- return entry;
- }
-
- /**
- * The <code>ArchiveClassPathResource</code> extends the
- * {@link ClassLoaderResource} with support to extract resources from a
- * JAR or ZIP archive.
- *
- * @author Felix Meschberger
- */
- private static class ArchiveClassPathResource extends ClassLoaderResource {
-
- /**
- * The JAR/ZIP file entry providing the name, size and modification
- * time information.
- */
- private final JarEntry jarEntry;
-
- /**
- * Creates an instance of this resource for the given
- * {@link ArchiveClassPathEntry} and JAR/ZIP file entry.
- *
- * @param pathEntry The {@link ArchiveClassPathEntry} from which this
- * resource has been loaded.
- * @param jarEntry The JAR/ZIP file entry describing this resource.
- */
- private ArchiveClassPathResource(ArchiveClassPathEntry pathEntry,
- JarEntry jarEntry) {
- super(pathEntry, jarEntry.getName(), pathEntry.getProperty());
- this.jarEntry = jarEntry;
- }
-
- /**
- * Returns an URL to access this resource.
- *
- * @see ArchiveClassPathEntry#getURL(String)
- */
- public URL getURL() {
- return getArchiveClassPathEntry().getURL(getName());
- }
-
- /**
- * Returns an URL identifying the archive from which this resource is
- * loaded.
- *
- * @see ArchiveClassPathEntry#getCodeSourceURL()
- */
- public URL getCodeSourceURL() {
- return getArchiveClassPathEntry().getCodeSourceURL();
- }
-
- /**
- * Returns an <code>InputStream</code> to read the contents of the
- * resource. Calling this method actually accesses the JAR/ZIP file
- * and seeks through the file until the entry is found.
- * <p>
- * Clients of this method must make sure to close the stream returned
- * if not used anymore to prevent resource drain.
- *
- * @throws RepositoryException If an error occurrs accessing or reading
- * the archive.
- *
- * @see ArchiveClassPathEntry#findEntry(JarInputStream, String)
- */
- public InputStream getInputStream() throws RepositoryException {
- /**
- * Cannot reuse the ClassPathEntry instances entry and
- * JarInputStream, because this is shared and has to be
- * closed to release the property resource.
- */
- JarInputStream zipIns = null;
- JarEntry entry = null;
-
- try {
-
- zipIns = getJarInputStream(getProperty());
- entry = getArchiveClassPathEntry().findEntry(zipIns, getName());
- if (entry != null) {
- return zipIns;
- }
-
- // otherwise
- log.warn("Cannot find entry " + getName() + " in the archive "
- + getClassPathEntry().getPath() + " anymore!");
- return null;
-
- } catch (IOException ioe) {
-
- // log
- throw new RepositoryException(ioe);
-
- } finally {
-
- // if thrown during findEntry(), entry is null but
- // the stream is open. As we exit by an exception,
- // the InputStream is not returned and must be
- // closed to release it.
-
- if (entry == null && zipIns != null) {
- try {
- zipIns.close();
- } catch (IOException ignored) {
- }
- }
-
- }
- }
-
- /**
- * Returns the value of the <code>size</code> field of the JAR/ZIP
- * file entry of this resource. If the size is not known to the entry,
- * <code>-1</code> may be returned.
- */
- public int getContentLength() {
- return (int) jarEntry.getSize();
- }
-
- /**
- * Returns the path to the property containing the archive or the
- * path with which the {@link ArchiveClassPathEntry} was created if the
- * former cannot be retrieved.
- */
- public String getPath() {
- try {
- return getProperty().getPath();
- } catch (RepositoryException re) {
- String archivePath = getClassPathEntry().getPath();
- log.warn("Cannot access the path of the archive " +
- "property below " + archivePath, re);
- return archivePath;
- }
- }
-
- /**
- * Returns the value of the <code>time</code> field of the JAR/ZIP
- * file entry of this resource. If the time is not known to the entry,
- * <code>-1</code> may be returned.
- */
- public long getLastModificationTime() {
- return jarEntry.getTime();
- }
-
- /**
- * Returns the manifest of the archive from which this resource was
- * loaded or <code>null</code> if no such manifest exists or an error
- * occurrs reading the manifest.
- *
- * @see ArchiveClassPathEntry#getManifest()
- */
- public Manifest getManifest() {
- return getArchiveClassPathEntry().getManifest();
- }
-
- /**
- * Returns the {@link ArchiveClassPathEntry} from which this resource
- * was loaded.
- */
- protected ArchiveClassPathEntry getArchiveClassPathEntry() {
- return (ArchiveClassPathEntry) getClassPathEntry();
- }
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ClassLoaderResource.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ClassLoaderResource.java
deleted file mode 100644
index 4761458..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ClassLoaderResource.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.security.cert.Certificate;
-import java.util.Date;
-import java.util.jar.Manifest;
-
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.net.URLFactory;
-
-
-/**
- * The <code>ClassLoaderResource</code> class represents a resource looked up
- * by the {@link ClassPathEntry}s of the {@link RepositoryClassLoader}. The
- * class provides transparent access to the resource irrespective of the fact
- * on whether the resource is contained in a repository property or in an
- * JAR or ZIP archive.
- * <p>
- * This class is extended to implement depending features such as storing
- * resources in repository properties or JAR or ZIP archives.
- *
- * @author Felix Meschberger
- */
-class ClassLoaderResource {
-
- /** default log category */
- private static final Log log = LogFactory.getLog(ClassLoaderResource.class);
-
- /**
- * The class path entry which loaded this class loader resource
- */
- private final ClassPathEntry pathEntry;
-
- /**
- * The name of this resource.
- */
- private final String name;
-
- /**
- * The repository property providing the resource's contents. This may be
- * <code>null</code> if the resource was loaded from a JAR/ZIP archive.
- */
- private final Property resProperty;
-
- /**
- * The class optionally loaded/defined through this resource.
- *
- * @see #getLoadedClass()
- * @see #setLoadedClass(Class)
- */
- private Class loadedClass;
-
- /**
- * The time in milliseconds at which this resource has been loaded from
- * the repository.
- */
- private final long loadTime;
-
- /**
- * Creates an instance of this class for the class path entry.
- *
- * @param pathEntry The {@link ClassPathEntry} of the code source of this
- * class loader resource.
- * @param name The path name of this resource.
- * @param resProperty The <code>Property</code>providing the content's of
- * this resource. This may be <code>null</code> if the resource
- * was loaded from an JAR or ZIP archive.
- */
- /* package */ ClassLoaderResource(ClassPathEntry pathEntry, String name,
- Property resProperty) {
- this.pathEntry = pathEntry;
- this.name = name;
- this.resProperty = resProperty;
- this.loadTime = System.currentTimeMillis();
- }
-
- /**
- * Returns the {@link ClassPathEntry} which loaded this resource.
- */
- protected ClassPathEntry getClassPathEntry() {
- return pathEntry;
- }
-
- /**
- * Returns the name of this resource. This is the name used to find the
- * resource, for example the class name or the properties file path.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns the <code>Property</code> with which this resource is created.
- */
- protected Property getProperty() {
- return resProperty;
- }
-
- /**
- * Returns the time in milliseconds at which this resource has been loaded
- */
- protected long getLoadTime() {
- return loadTime;
- }
-
- /**
- * Returns the URL to access this resource, for example a JCR or a JAR URL.
- * If the URL cannot be created from the resource data, <code>null</code> is
- * returned.
- */
- public URL getURL() {
- try {
- return URLFactory.createURL(getClassPathEntry().session, getPath());
- } catch (Exception e) {
- log.warn("getURL: Cannot getURL for " + getPath(), e);
- }
- return null;
- }
-
- /**
- * Returns the URL to the code source of this entry. If there is no code
- * source available, <code>null</code> is returned.
- * <p>
- * This base class implementation returns the result of calling
- * {@link ClassPathEntry#toURL()} on the class path entry from which this
- * resource was loaded.
- */
- public URL getCodeSourceURL() {
- return getClassPathEntry().toURL();
- }
-
- /**
- * Returns an <code>InputStream</code> to read from the resource.
- * <p>
- * This base class implementation returns the result of calling the
- * <code>getStream()</code> method on the resource's property or
- * <code>null</code> if the property is not set.
- */
- public InputStream getInputStream() throws RepositoryException {
- return (getProperty() != null) ? getProperty().getStream() : null;
- }
-
- /**
- * Returns the size of the resource or -1 if the size cannot be found out.
- * <p>
- * This base class implementation returns the result of calling the
- * <code>getLength()</code> method on the resource's property or -1 if
- * the property is not set.
- *
- * @throws RepositoryException If an error occurrs trying to find the length
- * of the property.
- */
- public int getContentLength() throws RepositoryException {
- return (getProperty() != null) ? (int) getProperty().getLength() : -1;
- }
-
- /**
- * Returns the path of the property containing the resource.
- * <p>
- * This base class implementation returns the absolute path of the
- * resource's property. If the property is not set or if an error occurrs
- * accesing the property's path, the concatentation of the class path
- * entry's path and the resource's name is returned.
- */
- public String getPath() {
- if (getProperty() != null) {
- try {
- return getProperty().getPath();
- } catch (RepositoryException re) {
- // fallback
- log.warn("getPath: Cannot retrieve path of entry " + getName(),
- re);
- }
- }
-
- // fallback if no resource property or an error accessing the path of
- // the property
- return getClassPathEntry().getPath() + getName();
- }
-
- /**
- * Returns the time of the the last modification of the resource or -1 if
- * the last modification time cannot be evaluated.
- * <p>
- * This base class implementation returns the result of calling the
- * {@link Util#getLastModificationTime(Property)} method on the resource's
- * property if not <code>null</code>. In case of an error or if the
- * property is <code>null</code>, -1 is returned.
- */
- public long getLastModificationTime() {
- if (getProperty() != null) {
- try {
- return Util.getLastModificationTime(getProperty());
- } catch (RepositoryException re) {
- log.info("getLastModificationTime of resource property", re);
- }
- }
-
- // cannot find the resource modification time, use epoch
- return -1;
- }
-
- /**
- * Returns the resource as an array of bytes
- */
- public byte[] getBytes() throws IOException, RepositoryException {
- InputStream in = null;
- byte[] buf = null;
-
- log.debug("getBytes");
-
- try {
- in = getInputStream();
- log.debug("getInputStream() returned " + in);
-
- int length = getContentLength();
- log.debug("getContentLength() returned " + String.valueOf(length));
-
- if (length >= 0) {
-
- buf = new byte[length];
- for (int read; length > 0; length -= read) {
- read = in.read(buf, buf.length - length, length);
- if (read == -1) {
- throw new IOException("unexpected EOF");
- }
- }
-
- } else {
-
- buf = new byte[1024];
- int count = 0;
- int read;
-
- // read enlarging buffer
- while ((read = in.read(buf, count, buf.length - count)) != -1) {
- count += read;
- if (count >= buf.length) {
- byte buf1[] = new byte[count * 2];
- System.arraycopy(buf, 0, buf1, 0, count);
- buf = buf1;
- }
- }
-
- // resize buffer if too big
- if (count != buf.length) {
- byte buf1[] = new byte[count];
- System.arraycopy(buf, 0, buf1, 0, count);
- buf = buf1;
- }
-
- }
-
- } finally {
-
- if (in != null) {
- try {
- in.close();
- } catch (IOException ignore) {
- }
- }
-
- }
-
- return buf;
- }
-
- /**
- * Returns the manifest from the jar file for this class resource. If this
- * resource is not from a jar file, the method returns <code>null</code>,
- * which is what the default implementation does.
- */
- public Manifest getManifest() {
- return null;
- }
-
- /**
- * Returns the certificates from the jar file for this class resource. If
- * this resource is not from a jar file, the method returns
- * <code>null</code>, which is what the default implementation does.
- */
- public Certificate[] getCertificates() {
- return null;
- }
-
- /**
- * Returns the <code>Property</code> which is used to check whether this
- * resource is expired or not.
- * <p>
- * This base class method returns the same property as returned by the
- * {@link #getProperty()} method. This method may be overwritten by
- * implementations as appropriate.
- *
- * @see #isExpired()
- */
- protected Property getExpiryProperty() {
- return getProperty();
- }
-
- /**
- * Returns <code>true</code> if the last modification date of the expiry
- * property of this resource is loaded is later than the time at which this
- * resource has been loaded. If the last modification time of the expiry
- * property cannot be calculated or if an error occurrs checking the expiry
- * propertiy's last modification time, <code>true</code> is returned.
- */
- public boolean isExpired() {
- try {
- // creation time of version if loaded now
- long currentPropTime = 0;
- Property prop = getExpiryProperty();
- if (prop != null) {
- currentPropTime = Util.getLastModificationTime(prop);
- }
-
- // creation time of version currently loaded
- long loadTime = getLoadTime();
-
- // expire if a new version would be loaded
- boolean exp = currentPropTime > loadTime;
- if (exp && log.isDebugEnabled()) {
- log.debug("expireResource: Resource created " +
- new Date(loadTime) + " superceded by version created " +
- new Date(currentPropTime));
- }
-
- // return the result of checking
- return exp;
- } catch (RepositoryException re) {
- log.debug("expireResource: Cannot get current version for " +
- toString() + ", will expire: " + re);
- return true;
- }
- }
-
- /**
- * Returns the class which was loaded through this resource. It is expected
- * that the class loader sets the class which was loaded through this
- * resource by calling the {@link #setLoadedClass(Class)} method. If this
- * class was not used to load a class or if the class loader failed to
- * set the class loaded through this resoource, this method will return
- * <code>null</code>.
- *
- * @return The class loaded through this resource, which may be
- * <code>null</code> if this resource was never used to load a class
- * or if the loader failed to set class through the
- * {@link #setLoadedClass(Class)} method.
- *
- * @see #setLoadedClass(Class)
- */
- public Class getLoadedClass() {
- return loadedClass;
- }
-
- /**
- * Sets the class which was loaded through this resource. This method does
- * not check, whether it is plausible that this class was actually loaded
- * from this resource, nor does this method check whether the class object
- * is <code>null</code> or not.
- *
- * @param loadedClass The class to be loaded.
- */
- public void setLoadedClass(Class loadedClass) {
- this.loadedClass = loadedClass;
- }
-
- /**
- * Returns the <code>String</code> representation of this resource.
- */
- public String toString() {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append(": path=");
- buf.append(getPath());
- buf.append(", name=");
- buf.append(getName());
- return buf.toString();
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ClassPathEntry.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ClassPathEntry.java
deleted file mode 100644
index 114123b..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ClassPathEntry.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.AccessControlException;
-import java.util.jar.JarException;
-import java.util.jar.JarInputStream;
-
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.net.URLFactory;
-
-/**
- * The <code>ClassPathEntry</code> class encapsulates entries in the class path
- * of the {@link DynamicRepositoryClassLoader}. The main task is to retrieve
- * {@link ClassLoaderResource} instances for classes or resources to load from it.
- * <p>
- * This implementation is not currently integrated with Java security. That is
- * protection domains and security managers are not supported yet.
- * <p>
- * This class is not intended to be subclassed or instantiated by clients.
- *
- * @author Felix Meschberger
- */
-abstract class ClassPathEntry {
-
- /** default logging */
- private static final Log log = LogFactory.getLog(ClassPathEntry.class);
-
- /** The session assigned to this class path entry */
- protected final Session session;
-
- /** The path to the item of this class path entry */
- protected final String path;
-
- /** The base URL for the class path entry to later construct resource URLs */
- protected URL baseURL;
-
- //---------- construction --------------------------------------------------
-
- /**
- * Creates an instance of the <code>ClassPathEntry</code> assigning the
- * session and path.
- *
- * @param session The <code>Session</code> to access the Repository.
- * @param path The path of the class path entry, this is either the
- * path of a node containing a jar archive or is the path
- * of the root of a hierarchy to look up resources in.
- */
- protected ClassPathEntry(Session session, String path) {
- this.path = path;
- this.session = session;
- }
-
- /**
- * Clones this instance of the <code>ClassPathEntry</code> setting the
- * path and session to the same value as the base instance.
- * <p>
- * Note that this constructor does not duplicate the session from the base
- * instance.
- *
- * @param base The <code>ClassPathEntry</code> from which to copy the path
- * and the session.
- */
- protected ClassPathEntry(ClassPathEntry base) {
- this.path = base.path;
- this.session = base.session;
- this.baseURL = base.baseURL;
- }
-
- /**
- * Returns an instance of the <code>ClassPathEntry</code> class. This
- * instance will be a subclass correctly handling the type (directory or
- * jar archive) of class path entry is to be created.
- * <p>
- * If the path given has a trailing slash, it is taken as a directory root
- * else the path is first tested, whether it contains an archive. If not
- * the path is treated as a directory.
- *
- * @param session The <code>Session</code> to access the Repository.
- * @param path The path of the class path entry, this is either the
- * path of a node containing a jar archive or is the path
- * of the root of a hierharchy to look up resources in.
- *
- * @return An initialized <code>ClassPathEntry</code> instance for the
- * path or <code>null</code> if an error occurred creating the
- * instance.
- */
- static ClassPathEntry getInstance(Session session, String path) {
-
- // check we can access the path, don't care about content now
- try {
- session.checkPermission(path, "read");
- } catch (AccessControlException ace) {
- log.warn("getInstance: Access denied reading from " + path +
- ", ignoring entry");
- return null;
- } catch (RepositoryException re) {
- log.error("getInstance: Cannot check permission to " + path, re);
- }
-
- // only check for archive if no trailing slash in path
- if (!path.endsWith("/")) {
- InputStream is = null;
- JarInputStream zip = null;
- try {
-
- Property prop = Util.getProperty(session.getItem(path));
- if (prop != null) {
-
- is = prop.getStream();
- zip = new JarInputStream(is);
- if (zip.getNextJarEntry() != null /* && zip.read() != -1 */ ) {
- // use the expanding jar support if can expand
- if (ExpandingArchiveClassPathEntry.canExpandArchives(session)) {
- return new ExpandingArchiveClassPathEntry(prop, path);
- }
-
- // otherwise use the non-expanding
- return new ArchiveClassPathEntry(prop, path);
- }
-
- log.debug("getInstance: " + path + " might not be a jar " +
- "archive, using as directory");
- } else {
- log.debug("getInstance: " + path + " does not resolve" +
- " to a property, using as directory");
- }
-
- } catch (ItemNotFoundException infe) {
-
- // how to path ?
- // thrown from
- // - Node.getPrimaryItem
- // -
-
- } catch (PathNotFoundException pnfe) {
-
- // how to path ?
- // thrown from
- // - session.getItem
- // -
-
- } catch (RepositoryException re) {
-
- log.debug("getInstance: " + path + " cannot be read from, " +
- "using as directory");
-
- } catch (JarException ze) {
-
- log.debug("getInstance: " + path + " does not contain an " +
- "archive, using as directory");
-
- } catch (IOException ioe) {
-
- log.debug("getInstance: " + path + " problem reading from " +
- "the archive, using as directory");
-
- } finally {
- if (zip != null) {
- try {
- zip.close();
- } catch (IOException ignored) {}
- } else if (is != null) {
- try {
- is.close();
- } catch (IOException ignored) {}
- }
- }
- // assume the path designates a directory
-
- // append trailing slash now
- path += "/";
- }
-
- // we assume a directory class path entry, but we might have to check
- // whether the path refers to a node or not. On the other hande, this
- // class path entry will not be usable anyway if not, user beware :-)
-
- return new DirectoryClassPathEntry(session, path);
- }
-
- /**
- * Returns the path on which this <code>ClassPathEntry</code> is based.
- */
- public String getPath() {
- return path;
- }
-
- /**
- * Returns this <code>ClassPathEntry</code> represented as an URL to be
- * used in a list of URLs to further work on. If there is a problem creating
- * the URL for this instance, <code>null</code> is returned instead.
- */
- public URL toURL() {
- if (baseURL == null) {
- try {
- baseURL = URLFactory.createURL(session, path);
- } catch (MalformedURLException mue) {
- log.warn("DirectoryClassPathEntry: Creating baseURl for " +
- path, mue);
- }
- }
-
- return baseURL;
- }
-
- /**
- * Returns a <code>ClassPathEntry</code> with the same configuration as
- * this <code>ClassPathEntry</code>.
- * <p>
- * The returned object may be but need not be a new instance. If the original
- * implementation is an immutable class, the instance returned may well
- * be the same as this.
- */
- abstract ClassPathEntry copy();
-
- /**
- * Searches for the named resource. The name is looked up as is, it is not
- * further modified such as appended with ".class" or made relative. That
- * is callers must make sure, that (1) this name is the full name of the
- * resource to find and that (2) it is a relative name, that is it should
- * not have a leading slash.
- * <p>
- * An example of a class to find would be : <code>com/day/test/Tester.class</code>
- * which is converted from the generally used value <code>com.day.test.Tester</code>
- * by the caller.
- *
- * @param name The name of the resource to find.
- */
- public abstract ClassLoaderResource getResource(String name);
-
- /**
- * @see Object#toString()
- */
- public String toString() {
- StringBuffer buf = new StringBuffer(super.toString());
- buf.append(": path: ");
- buf.append(path);
- buf.append(", user: ");
- buf.append(session.getUserID());
- return buf.toString();
- }
-
- //----------- internal helper ----------------------------------------------
-
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DirectoryClassPathEntry.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DirectoryClassPathEntry.java
deleted file mode 100644
index 4e5e743..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DirectoryClassPathEntry.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-
-/**
- * The <code>DirectoryClassPathEntry</code> implements the
- * {@link ClassPathEntry} abstract class with support for directory like
- * class path access. The path used to construct the instance is the
- * root path of a page structure finally containing the classes and
- * resources.
- *
- * @author Felix Meschberger
- */
-class DirectoryClassPathEntry extends ClassPathEntry {
-
- /** Default log */
- private static final Log log =
- LogFactory.getLog(DirectoryClassPathEntry.class);
-
- /**
- * Creates an instance of the <code>DirectoryClassPathEntry</code> class.
- * <p>
- * The path given is expected to have a trailing slash character else
- * results will not be as expected when getting resources.
- *
- * @param session The <code>Ticket</code> to access the ContentBus.
- * @param path The path of the class path entry, which is the path
- * of the root of a hierarchy to look up resources in.
- */
- DirectoryClassPathEntry(Session ticket, String handle) {
- super(ticket, handle);
- }
-
- /**
- * Returns a {@link ClassLoaderResource} for the named resource if it
- * can befound below this directory root identified by the path given
- * at construction time. Note that if the page would exist but does
- * either not contain content or is not readable by the current session,
- * no resource is returned.
- *
- * @param name The name of the resource to return. If the resource would
- * be a class the name must already be modified to denote a valid
- * path, that is dots replaced by dashes and the <code>.class</code>
- * extension attached.
- *
- * @return The {@link ClassLoaderResource} identified by the name or
- * <code>null</code> if no resource is found for that name.
- */
- public ClassLoaderResource getResource(final String name) {
-
- try {
- final Property prop = Util.getProperty(session.getItem(path + name));
- if (prop != null) {
- return new ClassLoaderResource(this, name, prop);
- }
-
- log.debug("getResource: resource " + name +
- " not found below " + path);
-
- } catch (PathNotFoundException pnfe) {
-
- log.info("getResource: Classpath entry " + path +
- " does not have resource " + name);
-
- } catch (RepositoryException cbe) {
-
- log.warn("getResource: problem accessing the resource " + name +
- " below " + path + ": " + cbe);
-
- }
- // invariant : no page or problem accessing the page
-
- return null;
- }
-
- /**
- * Returns a <code>ClassPathEntry</code> with the same configuration as
- * this <code>ClassPathEntry</code>.
- * <p>
- * Becase the <code>DirectoryClassPathEntry</code> class does not have
- * internal state, this method returns this instance to be used as
- * the "copy".
- */
- ClassPathEntry copy() {
- return this;
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicPatternPath.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicPatternPath.java
deleted file mode 100644
index ed3e972..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicPatternPath.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventListener;
-import javax.jcr.observation.ObservationManager;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * The <code>DynamicPatternPath</code> class is a {@link PatternPath}
- * which registers for modifications in the repository which may affect the
- * result of calling the <code>getExpandedPaths</code> method. If also supports
- * for clients registering with instances of this class to be notified if such
- * an event happens.
- * <p>
- * To free the system from too much work, instances of this class are only
- * registered with the session's observation manager if at least one listener is
- * interested in notification to changes in the matched path list.
- *
- * @author Felix Meschberger
- */
-/* package */ class DynamicPatternPath extends PatternPath
- implements EventListener {
-
- /** default logger */
- private static final Log log =
- LogFactory.getLog(DynamicPatternPath.class);
-
- /** The list of registered listeners for this list */
- private final ArrayList listeners = new ArrayList();
-
- /**
- * <code>true</code> if this instance is registered with the session's
- * observation manager.
- */
- private boolean isRegistered;
-
- /**
- * Creates an instance of the <code>DynamicPatternPath</code> from
- * a collection of path patterns.
- *
- * @param session The session to access the Repository to expand the paths
- * and to register as an event listener.
- * @param pathPatterns The array of path patterns to add.
- *
- * @throws NullPointerException if the <code>pathPatterns</code> array is
- * <code>null</code>.
- *
- * @see PatternPath#PathPatternList(Session, String[])
- */
- /* package */ DynamicPatternPath(Session session, String[] pathPatterns) {
- super(session, pathPatterns);
- }
-
- //---------- notification listener registration and interface -------------
-
- /**
- * Adds the given listener to the list of registered listeners. If the
- * listener is already registered, it is not added a second time.
- * <p>
- * This is synchronized to prevent multiple parallel modification of the
- * listeners list by mutliple threads.
- *
- * @param listener The listener to register. This must not be
- * <code>null</code>.
- *
- * @throws NullPointerException if the <code>listener</code> parameter is
- * <code>null</code>.
- */
- /* package */ synchronized void addListener(Listener listener) {
-
- // check listener
- if (listener == null) {
- throw new NullPointerException("listener");
- }
-
- // make sure we get updated on changes to be able to notify listeners
- // we are pretty sure our listeners list will not be empty :-)
- if (!isRegistered) {
- log.debug("addListener: Register with observation service");
- registerEventListener();
- }
-
- // guarded add
- if (!listeners.contains(listener)) {
- log.debug("addListener: Listener " + listener);
- listeners.add(listener);
- } else {
- log.info("addListener: Listener " + listener + " already added");
- }
- }
-
- /**
- * Removes the given listener from the list of registered listeners. If the
- * listener is not registered, the list of registered listeners is not
- * modified.
- * <p>
- * This is synchronized to prevent multiple parallel modification of the
- * listeners list by mutliple threads.
- *
- * @param listener The listener to deregister. This must not be
- * <code>null</code>.
- *
- * @throws NullPointerException if the <code>listener</code> parameter is
- * <code>null</code>.
- */
- /* package */ synchronized void removeListener(Listener listener) {
-
- // check listener
- if (listener == null) {
- throw new NullPointerException("listener");
- }
-
- // guarded removal
- if (listeners.remove(listener)) {
- log.debug("removeListener: Listener " + listener);
- } else {
- log.info("removeListener: Listener " + listener + " not registered");
- }
-
- // deregister if no listener is registered anymore
- // we are pretty sure to be registered
- if (listeners.size() == 0) {
- log.debug("removeListener: Deregister from observation service");
- unregisterEventListener();
- }
- }
-
- //---------- EventListener interface --------------------------------------
-
- /**
- * Handles the case where any change occurrs to the set of matched paths.
- * This is, if either a newly created item matches or a previously matching
- * item has been removed.
- * <p>
- * This method ignores <code>PROPERTY_CHANGED</code> events, as these
- * events do not have an influence on the set of matched paths.
- * <p>
- * The events in the iterator are analyzed until any non-property-change
- * event has an influence on the set of matched paths. As soon as such a
- * path is encountered, the listeners are notified and this method
- * terminates without further inspection of the events.
- *
- * @param events The iterator on the events being sent
- */
- public void onEvent(EventIterator events) {
- // check whether any of the events match the pattern list. If so
- // notify listeners on first match found and ignore rest for testing
- while (events.hasNext()) {
- Event event = events.nextEvent();
-
- // ignore property modifications
- if (event.getType() == Event.PROPERTY_CHANGED) {
- continue;
- }
-
- try {
- String path= event.getPath();
- if (matchPath(path)) {
- log.debug("onEvent: Listener Notification due to " +
- path);
- notifyListeners();
- return;
- }
- } catch (RepositoryException re) {
- log.info("onEvent: Cannot check events", re);
- }
- }
- }
-
- /**
- * Registers this list object with the session's observation manager to get
- * information on item updates.
- */
- private void registerEventListener() {
-
- // make sure we are not registered yet
- if (isRegistered) {
- log.debug("registerModificationListener: Already registered");
- return;
- }
-
- try {
- ObservationManager om =
- getSession().getWorkspace().getObservationManager();
- om.addEventListener(this, 0xffff, "/", true, null, null, false);
- isRegistered = true;
- } catch (RepositoryException re) {
- log.warn("registerModificationListener", re);
- }
- }
-
- /**
- * Unregisters this list object from the observation manager to not get
- * information on item updates anymore. This method is called when no more
- * listeners are interested on updates. This helps garbage collect this
- * object in the case no reference is held to the list anymore. If no one
- * is interested in changes anymore, we are not interested either, so we
- * may as well unregister.
- */
- private void unregisterEventListener() {
-
- // make sure we are registered
- if (!isRegistered) {
- log.debug("deregisterModificationListener: Not registered");
- return;
- }
-
- try {
- ObservationManager om =
- getSession().getWorkspace().getObservationManager();
- om.removeEventListener(this);
- isRegistered = false;
- } catch (RepositoryException re) {
- log.warn("deregisterModificationListener", re);
- }
- }
-
- /**
- * Notifies all registered listeners on the change in the set of matched
- * paths by calling their <code>pathListChanged</code> method.
- */
- private void notifyListeners() {
- for (int i=0; i < listeners.size(); i++) {
- Listener listener = (Listener) listeners.get(i);
- log.debug("notifyListeners: Notifying listener " + listener);
- try {
- listener.pathChanged();
- } catch (Exception e) {
- log.warn("notifyListeners: Listener " + listener + " threw: " + e);
- log.debug("dump", e);
- }
- }
- }
-
- /**
- * The <code>PatternPath.Listener</code> interface may be implemented
- * by interested classes to be notified as soon as the
- * {@link PatternPath#getExpandedPaths} method will return a
- * different result on the next invocation. This happens as soon as the set
- * of paths to which the list of patterns matches would change.
- */
- /* package */ interface Listener {
-
- /**
- * This method is called if the listener is to be notified of an event
- * resulting in the set of paths matched by the list of patterns to be
- * different.
- */
- public void pathChanged();
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicRepositoryClassLoader.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicRepositoryClassLoader.java
deleted file mode 100644
index a802351..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/DynamicRepositoryClassLoader.java
+++ /dev/null
@@ -1,643 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventListener;
-import javax.jcr.observation.ObservationManager;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.classloader.DynamicPatternPath.Listener;
-
-
-/**
- * The <code>DynamicRepositoryClassLoader</code> class extends the
- * {@link org.apache.jackrabbit.classloader.RepositoryClassLoader} and provides the
- * functionality to load classes and resources from the JCR Repository.
- * Additionally, this class supports the notion of getting 'dirty', which means,
- * that if a resource loaded through this class loader has been modified in the
- * Repository, this class loader marks itself dirty, which flag can get
- * retrieved. This helps the user of this class loader to decide on whether to
- * {@link #reinstantiate(Session, ClassLoader) reinstantiate} it or continue
- * using this class loader.
- * <p>
- * When a user of the class loader recognizes an instance to be dirty, it can
- * easily be reinstantiated with the {@link #reinstantiate} method. This
- * reinstantiation will also rebuild the internal real class path from the same
- * list of path patterns as was used to create the internal class path for the
- * original class loader. The resulting internal class path need not be the
- * same, though.
- * <p>
- * As an additional feature the class loaders provides the functionality for
- * complete reconfiguration of the list of path patterns defined at class loader
- * construction time through the {@link #reconfigure(String[])} method. This
- * reconfiguration replaces the internal class path with a new one built from
- * the new path list and also replaces that path list. Reinstantiating a
- * reconfigured class loader gets a class loader containing the same path list
- * as the original class loader had after reconfiguration. That is the original
- * configuration is lost. While reconfiguration is not able to throw away
- * classes already loaded, it will nevertheless mark the class loader dirty, if
- * any classes have already been loaded through it.
- * <p>
- * This class is not intended to be extended by clients.
- *
- * @author Felix Meschberger
- */
-public class DynamicRepositoryClassLoader extends RepositoryClassLoader
- implements EventListener, Listener {
-
- /** default log category */
- private static final Log log =
- LogFactory.getLog(DynamicRepositoryClassLoader.class);
-
- /**
- * Cache of resources used to check class loader expiry. The map is indexed
- * by the paths of the expiry properties of the cached resources. This map
- * is not complete in terms of resources which have been loaded through this
- * class loader. That is for resources loaded through an archive class path
- * entry, only one of those resources (the last one loaded) is kept in this
- * cache, while the others are ignored.
- *
- * @see #onEvent(EventIterator)
- * @see #findClassLoaderResource(String)
- */
- private Map modTimeCache;
-
- /**
- * Flag indicating whether there are loaded classes which have later been
- * expired (e.g. invalidated or modified)
- */
- private boolean dirty;
-
- /**
- * The list of repositories added through either the {@link #addURL} or the
- * {@link #addHandle} method.
- */
- private ClassPathEntry[] addedRepositories;
-
- /**
- * Creates a <code>DynamicRepositoryClassLoader</code> from a list of item
- * path strings containing globbing pattens for the paths defining the
- * class path.
- *
- * @param session The <code>Session</code> to use to access the class items.
- * @param classPath The list of path strings making up the (initial) class
- * path of this class loader. The strings may contain globbing
- * characters which will be resolved to build the actual class path.
- * @param parent The parent <code>ClassLoader</code>, which may be
- * <code>null</code>.
- *
- * @throws NullPointerException if either the session or the handles list
- * is <code>null</code>.
- */
- public DynamicRepositoryClassLoader(Session session,
- String[] classPath, ClassLoader parent) {
-
- // initialize the super class with an empty class path
- super(session, new DynamicPatternPath(session, classPath), parent);
-
- // set fields
- dirty = false;
- modTimeCache = new HashMap();
-
- // register with observation service and path pattern list
- registerModificationListener();
-
- log.debug("DynamicRepositoryClassLoader: " + this + " ready");
- }
-
- /**
- * Creates a <code>DynamicRepositoryClassLoader</code> with the same
- * configuration as the given <code>DynamicRepositoryClassLoader</code>.
- * This constructor is used by the {@link #reinstantiate} method.
- * <p>
- * Before returning from this constructor the <code>old</code> class loader
- * is destroyed and may not be used any more.
- *
- * @param session The session to associate with this class loader.
- * @param old The <code>DynamicRepositoryClassLoader</code> to copy the
- * cofiguration from.
- * @param parent The parent <code>ClassLoader</code>, which may be
- * <code>null</code>.
- */
- private DynamicRepositoryClassLoader(Session session,
- DynamicRepositoryClassLoader old, ClassLoader parent) {
-
- // initialize the super class with an empty class path
- super(session, old.getHandles(), parent);
-
- // set the configuration and fields
- dirty = false;
- modTimeCache = new HashMap();
-
- // create a repository from the handles - might get a different one
- setRepository(resetClassPathEntries(old.getRepository()));
- setAddedRepositories(resetClassPathEntries(old.getAddedRepositories()));
- buildRepository();
-
- // register with observation service and path pattern list
- registerModificationListener();
-
- // finally finalize the old class loader
- old.destroy();
-
- log.debug("DynamicRepositoryClassLoader: Copied " + old + ". Do not use " +
- "that anymore");
- }
-
- /**
- * Destroys this class loader. This process encompasses all steps needed
- * to remove as much references to this class loader as possible.
- * <p>
- * <em>NOTE</em>: This method just clears all internal fields and especially
- * the class path to render this class loader unusable.
- * <p>
- * This implementation does not throw any exceptions.
- */
- public void destroy() {
- // we expect to be called only once, so we stop destroyal here
- if (isDestroyed()) {
- log.debug("Instance is already destroyed");
- return;
- }
-
- // remove ourselves as listeners from other places
- unregisterListener();
-
- addedRepositories = null;
-
- super.destroy();
- }
-
- //---------- reload support ------------------------------------------------
-
- /**
- * Checks whether this class loader already loaded the named resource and
- * would load another version if it were instructed to do so. As a side
- * effect the class loader sets itself dirty in this case.
- * <p>
- * Calling this method yields the same result as calling
- * {@link #shouldReload(String, boolean)} with the <code>force</code>
- * argument set to <code>false</code>.
- *
- * @param name The name of the resource to check.
- *
- * @return <code>true</code> if the resource is loaded and reloading would
- * take another version than currently loaded.
- *
- * @see #isDirty
- */
- public synchronized boolean shouldReload(String name) {
- return shouldReload(name, false);
- }
-
- /**
- * Checks whether this class loader already loaded the named resource and
- * whether the class loader should be set dirty depending on the
- * <code>force</code> argument. If the argument is <code>true</code>, the
- * class loader is marked dirty and <code>true</code> is returned if the
- * resource has been loaded, else the loaded resource is checked for expiry
- * and the class loader is only set dirty if the loaded resource has
- * expired.
- *
- * @param name The name of the resource to check.
- * @param force <code>true</code> if the class loader should be marked dirty
- * if the resource is loaded, else the class loader is only marked
- * dirty if the resource is loaded and has expired.
- *
- * @return <code>true</code> if the resource is loaded and
- * <code>force</code> is <code>true</code> or if the resource has
- * expired. <code>true</code> is also returned if this class loader
- * has already been destroyed.
- *
- * @see #isDirty
- */
- public synchronized boolean shouldReload(String name, boolean force) {
- if (isDestroyed()) {
- log.warn("Classloader already destroyed, reload required");
- return true;
- }
-
- ClassLoaderResource res = getCachedResource(name);
- if (res != null) {
- log.debug("shouldReload: Expiring cache entry " + res);
- if (force) {
- log.debug("shouldReload: Forced dirty flag");
- dirty = true;
- return true;
- }
-
- return expireResource(res);
- }
-
- return false;
- }
-
- /**
- * Returns <code>true</code> if any of the loaded classes need reload. Also
- * sets this class loader dirty. If the class loader is already set dirty
- * or if this class loader has been destroyed before calling this method,
- * it returns immediately.
- *
- * @return <code>true</code> if any class loader needs to be reinstantiated.
- *
- * @see #isDirty
- */
- public synchronized boolean shouldReload() {
-
- // check whether we are already dirty
- if (isDirty()) {
- log.debug("shouldReload: Dirty, need reload");
- return true;
- }
-
- // Check whether any class has changed
- for (Iterator iter = getCachedResources(); iter.hasNext();) {
- if (expireResource((ClassLoaderResource) iter.next())) {
- log.debug("shouldReload: Found expired resource, need reload");
- return true;
- }
- }
-
- // No changes, no need to reload
- log.debug("shouldReload: No expired resource found, no need to reload");
- return false;
- }
-
- /**
- * Returns whether the class loader is dirty. This can be the case if any
- * of the {@link #shouldReload(String)} or {@link #shouldReload()}
- * methods returned <code>true</code> or if a loaded class has been expired
- * through the observation.
- * <p>
- * This method may also return <code>true</code> if the <code>Session</code>
- * associated with this class loader is not valid anymore.
- * <p>
- * Finally the method always returns <code>true</code> if the class loader
- * has already been destroyed. Note, however, that a destroyed class loader
- * cannot be reinstantiated. See {@link #reinstantiate(Session, ClassLoader)}.
- * <p>
- * If the class loader is dirty, it should be reinstantiated through the
- * {@link #reinstantiate} method.
- *
- * @return <code>true</code> if the class loader is dirty and needs
- * reinstantiation.
- */
- public boolean isDirty() {
- return isDestroyed() || dirty || !getSession().isLive();
- }
-
- /**
- * Reinstantiates this class loader. That is, a new ClassLoader with no
- * loaded class is created with the same configuration as this class loader.
- * <p>
- * When the new class loader is returned, this class loader has been
- * destroyed and may not be used any more.
- *
- * @param parent The parent <code>ClassLoader</code> for the reinstantiated
- * <code>DynamicRepositoryClassLoader</code>, which may be
- * <code>null</code>.
- *
- * @return a new instance with the same configuration as this class loader.
- *
- * @throws IllegalStateException if <code>this</code>
- * {@link DynamicRepositoryClassLoader} has already been destroyed
- * through the {@link #destroy()} method.
- */
- public DynamicRepositoryClassLoader reinstantiate(Session session, ClassLoader parent) {
- log.debug("reinstantiate: Copying " + this + " with parent " + parent);
-
- if (isDestroyed()) {
- throw new IllegalStateException("Destroyed class loader cannot be recreated");
- }
-
- // create the new loader
- DynamicRepositoryClassLoader newLoader =
- new DynamicRepositoryClassLoader(session, this, parent);
-
- // return the new loader
- return newLoader;
- }
-
- //---------- URLClassLoader overwrites -------------------------------------
-
- /**
- * Reconfigures this class loader with the pattern list. That is the new
- * pattern list completely replaces the current pattern list. This new
- * pattern list will also be used later to configure the reinstantiated
- * class loader.
- * <p>
- * If this class loader already has loaded classes using the old, replaced
- * path list, it is set dirty.
- * <p>
- * If this class loader has already been destroyed, this method has no
- * effect.
- *
- * @param classPath The list of path strings making up the (initial) class
- * path of this class loader. The strings may contain globbing
- * characters which will be resolved to build the actual class path.
- */
- public void reconfigure(String[] classPath) {
- log.debug("reconfigure: Reconfiguring the with " + classPath);
-
- // whether the loader is destroyed
- if (isDestroyed()) {
- log.warn("Cannot reconfigure this destroyed class loader");
- return;
- }
-
- // deregister to old handles
- ((DynamicPatternPath) getHandles()).removeListener(this);
-
- // assign new handles and register
- setHandles(new DynamicPatternPath(getSession(), classPath));
- buildRepository();
- ((DynamicPatternPath) getHandles()).addListener(this);
-
- dirty = !hasLoadedResources();
- log.debug("reconfigure: Class loader is dirty now: " +
- (isDirty() ? "yes" : "no"));
- }
-
- //---------- RepositoryClassLoader overwrites -----------------------------
-
- /**
- * Calls the base class implementation to actually retrieve the resource.
- * If the resource could be found and provides a non-<code>null</code>
- * {@link ClassLoaderResource#getExpiryProperty() expiry property}, the
- * resource is registered with an internal cache to check with when
- * a repository modification is observed in {@link #onEvent(EventIterator)}.
- *
- * @param name The name of the resource to be found
- *
- * @return the {@link ClassLoaderResource} found for the name or
- * <code>null</code> if no such resource is available in the class
- * path.
- *
- * @throws NullPointerException If this class loader has already been
- * destroyed.
- */
- /* package */ ClassLoaderResource findClassLoaderResource(String name) {
- // call the base class implementation to actually search for it
- ClassLoaderResource res = super.findClassLoaderResource(name);
-
- // if it could be found, we register it with the caches
- if (res != null) {
- // register the resource in the expiry map, if an appropriate
- // property is available
- Property prop = res.getExpiryProperty();
- if (prop != null) {
- try {
- modTimeCache.put(prop.getPath(), res);
- } catch (RepositoryException re) {
- log.warn("Cannot register the resource " + res +
- " for expiry", re);
- }
- }
- }
-
- // and finally return the resource
- return res;
- }
-
- /**
- * Builds the repository list from the list of path patterns and appends
- * the path entries from any added handles. This method may be used multiple
- * times, each time replacing the currently defined repository list.
- *
- * @throws NullPointerException If this class loader has already been
- * destroyed.
- */
- protected synchronized void buildRepository() {
- super.buildRepository();
-
- // add added repositories
- ClassPathEntry[] addedPath = getAddedRepositories();
- if (addedPath != null && addedPath.length > 0) {
- ClassPathEntry[] oldClassPath = getRepository();
- ClassPathEntry[] newClassPath =
- new ClassPathEntry[oldClassPath.length + addedPath.length];
-
- System.arraycopy(oldClassPath, 0, newClassPath, 0,
- oldClassPath.length);
- System.arraycopy(addedPath, 0, newClassPath, oldClassPath.length,
- addedPath.length);
-
- setRepository(newClassPath);
- }
- }
-
- //---------- ModificationListener interface -------------------------------
-
- /**
- * Handles a repository item modifcation events checking whether a class
- * needs to be expired. As a side effect, this method sets the class loader
- * dirty if a loaded class has been modified in the repository.
- *
- * @param events The iterator of repository events to be handled.
- */
- public void onEvent(EventIterator events) {
- while (events.hasNext()) {
- Event event = events.nextEvent();
- try {
- String path = event.getPath();
- log.debug("onEvent: Item " + path + " has been modified, " +
- "checking with cache");
-
- ClassLoaderResource resource =
- (ClassLoaderResource) modTimeCache.get(path);
- if (resource != null) {
- log.debug("pageModified: Expiring cache entry "+ resource);
- expireResource(resource);
- } else {
- // might be in not-found cache - remove from there
- if (event.getType() == Event.NODE_ADDED ||
- event.getType() == Event.PROPERTY_ADDED) {
- log.debug("pageModified: Clearing not-found cache " +
- "for possible new class");
- cleanCache();
- }
- }
-
- } catch (RepositoryException re) {
- //
- }
- }
- }
-
- //----------- PatternPath.Listener interface -------------------------
-
- /**
- * Handles modified matched path set by setting the class loader dirty.
- * The internal class path is only rebuilt when the class loader is
- * reinstantiated.
- */
- public void pathChanged() {
- log.debug("handleListChanged: The path list has changed");
- buildRepository();
- dirty = true;
- }
-
- //----------- Object overwrite ---------------------------------------------
-
- /**
- * Returns a string representation of this class loader.
- */
- public String toString() {
- if (isDestroyed()) {
- return super.toString();
- }
-
- StringBuffer buf = new StringBuffer(super.toString());
- buf.append(", dirty: ");
- buf.append(isDirty());
- return buf.toString();
- }
-
- //---------- internal ------------------------------------------------------
-
- /**
- * Sets the list of class path entries to add to the class path after
- * reconfiguration or reinstantiation.
- *
- * @param addedRepositories The list of class path entries to keep for
- * readdition.
- */
- protected void setAddedRepositories(ClassPathEntry[] addedRepositories) {
- this.addedRepositories = addedRepositories;
- }
-
- /**
- * Returns the list of added class path entries to readd them to the class
- * path after reconfiguring the class loader.
- */
- protected ClassPathEntry[] getAddedRepositories() {
- return addedRepositories;
- }
-
- /**
- * Adds the class path entry to the current class path list. If the class
- * loader has already been destroyed, this method creates a single entry
- * class path list with the new class path entry.
- * <p>
- * Besides adding the entry to the current class path, it is also added to
- * the list to be readded after reconfiguration and/or reinstantiation.
- *
- * @see #getAddedRepositories()
- * @see #setAddedRepositories(ClassPathEntry[])
- */
- protected void addClassPathEntry(ClassPathEntry cpe) {
- super.addClassPathEntry(cpe);
-
- // add the repsitory to the list of added repositories
- ClassPathEntry[] oldClassPath = getAddedRepositories();
- ClassPathEntry[] newClassPath = addClassPathEntry(oldClassPath, cpe);
- setAddedRepositories(newClassPath);
- }
-
- /**
- * Registers this class loader with the observation service to get
- * information on page updates in the class path and to the path
- * pattern list to get class path updates.
- *
- * @throws NullPointerException if this class loader has already been
- * destroyed.
- */
- private final void registerModificationListener() {
- ((DynamicPatternPath) getHandles()).addListener(this);
-
- log.debug("registerModificationListener: Registering to the observation service");
- try {
- ObservationManager om = getSession().getWorkspace().getObservationManager();
- om.addEventListener(this, 255, "/", true, null, null, false);
- } catch (RepositoryException re) {
- log.error("registerModificationListener: Cannot register " +
- this + " with observation manager", re);
- }
- }
-
- /**
- * Removes this instances registrations from the observation service and
- * the path pattern list.
- *
- * @throws NullPointerException if this class loader has already been
- * destroyed.
- */
- private final void unregisterListener() {
- ((DynamicPatternPath) getHandles()).removeListener(this);
-
- log.debug("registerModificationListener: Deregistering from the observation service");
- try {
- ObservationManager om = getSession().getWorkspace().getObservationManager();
- om.removeEventListener(this);
- } catch (RepositoryException re) {
- log.error("unregisterListener: Cannot unregister " +
- this + " from observation manager", re);
- }
- }
-
- /**
- * Checks whether the page backing the resource has been updated with a
- * version, such that this new version would be used to access the resource.
- * In this case the resource has expired and the class loader needs to be
- * set dirty.
- *
- * @param resource The <code>ClassLoaderResource</code> to check for
- * expiry.
- */
- private boolean expireResource(ClassLoaderResource resource) {
-
- // check whether the resource is expired (only if a class has been loaded)
- boolean exp = resource.getLoadedClass() != null && resource.isExpired();
-
- // update dirty flag accordingly
- dirty |= exp;
- log.debug("expireResource: Loader dirty: " + isDirty());
-
- // return the expiry status
- return exp;
- }
-
- /**
- * Returns the list of classpath entries after resetting each of them.
- *
- * @param list The list of {@link ClassPathEntry}s to reset
- *
- * @return The list of reset {@link ClassPathEntry}s.
- */
- private static ClassPathEntry[] resetClassPathEntries(
- ClassPathEntry[] oldClassPath) {
- if (oldClassPath != null) {
- for (int i=0; i < oldClassPath.length; i++) {
- ClassPathEntry entry = oldClassPath[i];
- log.debug("resetClassPathEntries: Cloning " + entry);
- oldClassPath[i] = entry.copy();
- }
- } else {
- log.debug("resetClassPathEntries: No list to reset");
- }
- return oldClassPath;
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntry.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntry.java
deleted file mode 100644
index b9a954d..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntry.java
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Calendar;
-import java.util.StringTokenizer;
-import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Workspace;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * The <code>ExpandingArchiveClassPathEntry</code> extends the
- * {@link org.apache.jackrabbit.classloader.ArchiveClassPathEntry} class with support
- * to automatically expand the archive (JAR or ZIP) into the repository
- * below the path entry node. The path used to construct the instance is the
- * path of an item resolving to a property containing the jar archive to access.
- *
- * @author Felix Meschberger
- *
- * @see org.apache.jackrabbit.classloader.ArchiveClassPathEntry
- * @see org.apache.jackrabbit.classloader.ClassPathEntry
- */
-/* package */ class ExpandingArchiveClassPathEntry extends ArchiveClassPathEntry {
-
- /** The name of the node type required to expand the archive */
- public static final String TYPE_JARFILE = "rep:jarFile";
-
- /** The name of the child node taking the expanded archive */
- public static final String NODE_JARCONTENTS = "rep:jarContents";
-
- /**
- * The name of the property taking the time at which the archive was
- * expanded
- */
- public static final String PROP_EXPAND_DATE = "rep:jarExpanded";
-
- /** Default logger */
- private static final Log log =
- LogFactory.getLog(ExpandingArchiveClassPathEntry.class);
-
- /** The node of the unpacked JAR contents */
- private Node jarContents;
-
- /**
- * Creates an instance of the <code>ExpandingArchiveClassPathEntry</code>
- * class.
- *
- * @param prop The <code>Property</code> containing the archive and
- * the session used to access the repository.
- * @param path The original class path entry leading to the creation of
- * this instance. This is not necessairily the same path as the
- * property's path if the property was found through the primary
- * item chain.
- *
- * @throws RepositoryException If an error occurrs retrieving the session
- * from the property.
- */
- ExpandingArchiveClassPathEntry(Property prop, String path)
- throws RepositoryException {
- super(prop, path);
- }
-
- /**
- * Clones the indicated <code>ExpandingArchiveClassPathEntry</code> object
- * by taking over its path, session and property.
- *
- * @param base The base <code>ExpandingArchiveClassPathEntry</code> entry
- * to clone.
- *
- * @see ClassPathEntry#ClassPathEntry(ClassPathEntry)
- */
- private ExpandingArchiveClassPathEntry(ExpandingArchiveClassPathEntry base) {
- super(base);
- }
-
- /**
- * Returns a {@link ClassLoaderResource} for the named resource if it
- * can be found in the archive identified by the path given at
- * construction time. Note that if the archive property would exist but is
- * not readable by the current session, no resource is returned.
- *
- * @param name The name of the resource to return. If the resource would
- * be a class the name must already be modified to denote a valid
- * path, that is dots replaced by slashes and the <code>.class</code>
- * extension attached.
- *
- * @return The {@link ClassLoaderResource} identified by the name or
- * <code>null</code> if no resource is found for that name.
- */
- public ClassLoaderResource getResource(final String name) {
-
- try {
- // find the resource for the name in the expanded archive contents
- Node jarContents = getJarContents();
- Item resItem = null;
- if (jarContents.hasNode(name)) {
- resItem = jarContents.getNode(name);
- } else if (jarContents.hasProperty(name)) {
- resItem = jarContents.getProperty(name);
- }
-
- // if the name resolved to an item, resolve the item to a
- // single-valued non-reference property
- Property resProp = (resItem != null)
- ? Util.getProperty(resItem)
- : null;
-
- // if found create the resource to return
- if (resProp != null) {
- return new ClassLoaderResource(this, name, resProp) {
- public URL getURL() {
- return ExpandingArchiveClassPathEntry.this.getURL(getName());
- }
-
- public URL getCodeSourceURL() {
- return ExpandingArchiveClassPathEntry.this.getCodeSourceURL();
- }
-
- public Manifest getManifest() {
- return ExpandingArchiveClassPathEntry.this.getManifest();
- }
-
- protected Property getExpiryProperty() {
- return ExpandingArchiveClassPathEntry.this.getProperty();
- }
- };
- }
-
- log.debug("getResource: resource " + name + " not found"
- + " in archive " + path);
-
- } catch (RepositoryException re) {
-
- log.warn("getResource: problem accessing the archive " + path
- + " for " + name + ": " + re.toString());
-
- }
- // invariant : not found or problem accessing the archive
-
- return null;
- }
-
- /**
- * Returns a <code>ClassPathEntry</code> with the same configuration as
- * this <code>ClassPathEntry</code>.
- * <p>
- * The <code>ExpandingArchiveClassPathEntry</code> class has internal state.
- * Therefore a new instance is created from the unmodifiable configuration
- * of this instance.
- */
- ClassPathEntry copy() {
- return new ExpandingArchiveClassPathEntry(this);
- }
-
- //----------- internal helper to find the entry ------------------------
-
- /**
- * Returns the root node of the expanded archive. If the archive's node
- * does not contain the expanded archive, it is expanded on demand. If the
- * archive has already been expanded, it is checked whether it is up to
- * date and expanded again if not.
- *
- * @throws RepositoryException if an error occurrs expanding the archive
- * into the repository.
- */
- private Node getJarContents() throws RepositoryException {
- if (jarContents == null) {
- Node jarNode = null; // the node containing the jar file
- Node jarRoot = null; // the root node of the expanded contents
- try {
- Item jarItem = session.getItem(getPath());
- jarNode = (jarItem.isNode()) ? (Node) jarItem : jarItem.getParent();
-
- // if the jar been unpacked once, check for updated jar file,
- // which must be unpacked
- if (jarNode.isNodeType(TYPE_JARFILE)) {
- long lastMod = Util.getLastModificationTime(getProperty());
- long expanded =
- jarNode.getProperty(PROP_EXPAND_DATE).getLong();
-
- // get the content, remove if outdated or use if ok
- jarRoot = jarNode.getNode(NODE_JARCONTENTS);
-
- // if expanded content is outdated, remove it
- if (lastMod <= expanded) {
- jarRoot.remove();
- jarRoot = null; // have to unpack below
- }
-
- } else if (!jarNode.canAddMixin(TYPE_JARFILE)) {
- // this is actually a problem, because I expect to be able
- // to add the mixin node type due to checkExpandArchives
- // having returned true earlier
- throw new RepositoryException(
- "Cannot unpack JAR file contents into "
- + jarNode.getPath());
-
- } else {
- jarNode.addMixin(TYPE_JARFILE);
- jarNode.setProperty(PROP_EXPAND_DATE, Calendar.getInstance());
- }
-
- // if the content root is not set, unpack and save
- if (jarRoot == null) {
- jarRoot = jarNode.addNode(NODE_JARCONTENTS, "nt:folder");
- unpack(jarRoot);
- jarNode.save();
- }
-
- } finally {
-
- // rollback changes on the jar node in case of problems
- if (jarNode != null && jarNode.isModified()) {
- // rollback incomplete modifications
- log.warn("Rolling back unsaved changes on JAR node "
- + getPath());
-
- try {
- jarNode.refresh(false);
- } catch (RepositoryException re) {
- log.warn("Cannot rollback changes after failure to " +
- "expand " + getPath(), re);
- }
- }
- }
-
- jarContents = jarRoot;
- }
-
- return jarContents;
- }
-
- /**
- * Expands the archive stored in the property of this class path entry into
- * the repositroy below the given <code>jarRoot</code> node.
- * <p>
- * This method leaves the subtree at and below <code>jarRoot</code> unsaved.
- * It is the task of the caller to save or rollback as appropriate.
- *
- * @param jarRoot The <code>Node</code> below which the archive is to be
- * unpacked.
- *
- * @throws RepositoryException If an error occurrs creating the item
- * structure to unpack the archive or if an error occurrs reading
- * the archive.
- */
- private void unpack(Node jarRoot) throws RepositoryException {
-
- ZipInputStream zin = null;
- try {
- zin = new ZipInputStream(getProperty().getStream());
- ZipEntry entry = zin.getNextEntry();
- while (entry != null) {
- if (entry.isDirectory()) {
- unpackFolder(jarRoot, entry.getName());
- } else {
- unpackFile(jarRoot, entry, zin);
- }
- entry = zin.getNextEntry();
- }
- } catch (IOException ioe) {
- throw new RepositoryException(
- "Problem reading JAR contents of " + getPath(), ioe);
- } finally {
- // close the JAR stream if open
- if (zin != null) {
- try {
- zin.close();
- } catch (IOException ignore) {}
- }
- }
- }
-
- /**
- * Makes sure a node exists at the <code>path</code> relative to
- * <code>root</code>. In other words, this method returns the node
- * <code>root.getNode(path)</code>, creating child nodes as required. Newly
- * created nodes are created with node type <code>nt:folder</code>.
- * <p>
- * If intermediate nodes or the actual node required already exist, they
- * must be typed such, that they may either accept child node creations
- * of type <code>nt:file</code> or <code>nt:folder</code>.
- *
- * @param root The <code>Node</code> relative to which a node representing
- * a folder is to created if required.
- * @param path The path relative to <code>root</code> of the folder to
- * ensure.
- *
- * @return The <code>Node</code> representing the folder below
- * <code>root</code>.
- *
- * @throws RepositoryException If an error occurrs accessing the repository
- * or creating missing node(s).
- */
- private Node unpackFolder(Node root, String path) throws RepositoryException {
-
- // remove trailing slash
- while (path.endsWith("/")) {
- path = path.substring(0, path.length()-1);
- }
-
- // quick check if the folder already exists
- if (root.hasNode(path)) {
- return root.getNode(path);
- }
-
- // go down and create the path
- StringTokenizer tokener = new StringTokenizer(path, "/");
- while (tokener.hasMoreTokens()) {
- String label = tokener.nextToken();
- if (root.hasNode(label)) {
- root = root.getNode(label);
- } else {
- root = root.addNode(label, "nt:folder");
- }
- }
-
- // return the final node
- return root;
- }
-
- /**
- * Creates a <code>nt:file</code> node with the path
- * <code>entry.getName()</code> relative to the <code>root</code> node. The
- * contents of the <code>jcr:content/jcr:data</code> property of the file
- * node is retrieved from <code>ins</code>.
- * <p>
- * The <code>jcr:content/jcr:lastModified</code> property is set to the
- * value of the <code>time</code> field of the <code>entry</code>. The
- * <code>jcr:content/jcr:mimeType</code> property is set to a best-effort
- * guess of the content type of the entry. To guess the content type, the
- * <code>java.net.URLConnection.guessContentType(String)</code> method
- * is called. If this results in no content type, the default
- * <code>application/octet-stream</code> is set.
- *
- * @param root The node relative to which the <code>nt:file</code> node
- * is created.
- * @param entry The <code>ZipEntry</code> providing information on the
- * file to be created. Namely the <code>name</code> and
- * <code>time</code> fields are used.
- * @param ins The <code>InputStream</code> providing the data to be written
- * to the <code>jcr:content/jcr:data</code> property.
- *
- * @throws RepositoryException If an error occurrs creating and filling
- * the <code>nt:file</code> node.
- */
- private void unpackFile(Node root, ZipEntry entry, InputStream ins) throws RepositoryException {
- int slash = entry.getName().lastIndexOf('/');
- String label = entry.getName().substring(slash+1);
- Node parent = (slash <= 0)
- ? root
- : unpackFolder(root, entry.getName().substring(0, slash));
-
- // remove existing node (and all children by the way !!)
- if (parent.hasNode(label)) {
- parent.getNode(label).remove();
- }
-
- // prepare property values
- Calendar lastModified = Calendar.getInstance();
- lastModified.setTimeInMillis(entry.getTime());
- String mimeType = URLConnection.guessContentTypeFromName(label);
- if (mimeType == null) {
- mimeType = "application/octet-stream";
- }
-
- // create entry nodes
- Node ntFile = parent.addNode(label, "nt:file");
- Node content = ntFile.addNode("jcr:content", "nt:resource");
- content.setProperty("jcr:mimeType", mimeType);
- content.setProperty("jcr:data", ins);
- content.setProperty("jcr:lastModified", lastModified);
- }
-
- /**
- * Checks whether it is possible to use this class for archive class path
- * entries in the workspace (and repository) to which the <code>session</code>
- * provides access.
- * <p>
- * This method works as follows. If the node type <code>rep:jarFile</code>
- * is defined in the session's repository, <code>true</code> is immediately
- * returned. If an error checking for the node type, <code>false</code> is
- * immediately returned.
- * <p>
- * If the node type is not defined, the
- * {@link NodeTypeSupport#registerNodeType(Workspace)} method is called
- * to register the node type. Any errors occurring while calling or
- * executing this method is logged an <code>false</code> is returned.
- * Otherwise, if node type registration succeeded, <code>true</code> is
- * returned.
- * <p>
- * This method is synchronized such that two paralell threads do not try
- * to create the node, which might yield wrong negatives.
- *
- * @param session The <code>Session</code> providing access to the
- * repository.
- *
- * @return <code>true</code> if this class can be used to handle archive
- * class path entries. See above for a description of the test used.
- */
- /* package */ synchronized static boolean canExpandArchives(Session session) {
-
- // quick check for the node type, succeed if defined
- try {
- session.getWorkspace().getNodeTypeManager().getNodeType(TYPE_JARFILE);
- log.debug("Required node type exists, can expand archives");
- return true;
- } catch (NoSuchNodeTypeException nst) {
- log.debug("Required node types does not exist, try to define");
- } catch (RepositoryException re) {
- log.info("Cannot check for required node type, cannot expand " +
- "archives", re);
- return false;
- }
-
- try {
- Workspace workspace = session.getWorkspace();
- return NodeTypeSupport.registerNodeType(workspace);
- } catch (Throwable t) {
- // Prevent anything from hapening if node type registration fails
- // due to missing libraries or other errors
- log.info("Error registering node type", t);
- }
-
- // fallback to failure
- return false;
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/NodeTypeSupport.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/NodeTypeSupport.java
deleted file mode 100644
index 58815b2..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/NodeTypeSupport.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.util.List;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Workspace;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
-import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
-import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
-import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefReader;
-import org.apache.jackrabbit.core.nodetype.compact.ParseException;
-
-/**
- * The <code>NodeTypeSupport</code> contains a single utility method
- * {@link #registerNodeType(Workspace)} to register the required mixin node
- * type <code>rep:jarFile</code> with the repository.
- * <p>
- * If the class loader is not used on a Jackrabbit based repository, loading
- * this class or calling the {@link #registerNodeType(Workspace)} methods may
- * fail with link errors.
- *
- * @author Felix Meschberger
- */
-/* package */ class NodeTypeSupport {
-
- /** Default log */
- private static final Log log = LogFactory.getLog(NodeTypeSupport.class);
-
- /**
- * The name of the class path resource containing the node type definition
- * file used by the {@link #registerNodeType(Workspace)} method to register
- * the required mixin node type (value is "type.cnd").
- */
- private static final String TYPE_FILE = "type.cnd";
-
- /**
- * The encoding used to read the node type definition file (value is
- * "ISO-8859-1").
- */
- private static final String ENCODING = "ISO-8859-1";
-
- /**
- * Registers the required node type (<code>rep:jarFile</code>) with the
- * node type manager available from the given <code>workspace</code>.
- * <p>
- * The <code>NodeTypeManager</code> returned by the <code>workspace</code>
- * is expected to be of type
- * <code>org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl</code> for
- * the node type registration to succeed.
- * <p>
- * This method is not synchronized. It is up to the calling method to
- * prevent paralell execution.
- *
- * @param workspace The <code>Workspace</code> providing the node type
- * manager through which the node type is to be registered.
- *
- * @return <code>true</code> if this class can be used to handle archive
- * class path entries. See above for a description of the test used.
- */
- /* package */ static boolean registerNodeType(Workspace workspace) {
-
- // Access the node type definition file, "fail" if not available
- InputStream ins = NodeTypeSupport.class.getResourceAsStream(TYPE_FILE);
- if (ins == null) {
- log.error("Node type definition file " + TYPE_FILE +
- " not in class path. Cannot define required node type");
- return false;
- }
-
- // Wrap the stream with a reader
- InputStreamReader reader = null;
- try {
- reader = new InputStreamReader(ins, ENCODING);
- } catch (UnsupportedEncodingException uee) {
- log.warn("Required Encoding " + ENCODING + " not supported, " +
- "using platform default encoding", uee);
-
- reader = new InputStreamReader(ins);
- }
-
- try {
- // Create a CompactNodeTypeDefReader
- CompactNodeTypeDefReader cndReader =
- new CompactNodeTypeDefReader(reader, TYPE_FILE);
-
- // Get the List of NodeTypeDef objects
- List ntdList = cndReader.getNodeTypeDefs();
-
- // Get the NodeTypeManager from the Workspace.
- // Note that it must be cast from the generic JCR NodeTypeManager
- // to the Jackrabbit-specific implementation.
- NodeTypeManagerImpl ntmgr =
- (NodeTypeManagerImpl) workspace.getNodeTypeManager();
-
- // Acquire the NodeTypeRegistry
- NodeTypeRegistry ntreg = ntmgr.getNodeTypeRegistry();
-
- // register the node types from the file in a batch
- ntreg.registerNodeTypes(ntdList);
-
- // get here and succeed
- return true;
-
- } catch (ParseException pe) {
- log.error("Unexpected failure to parse compact node defintion " + TYPE_FILE, pe);
-
- } catch (InvalidNodeTypeDefException ie) {
- log.error("Cannot define required node type", ie);
-
- } catch (RepositoryException re) {
- log.error("General problem accessing the repository", re);
-
- } catch (ClassCastException cce) {
- log.error("Unexpected object type encountered", cce);
-
- } finally {
- // make sure the reader is closed - expect to be non-null here !
- try {
- reader.close();
- } catch (IOException ioe) {
- // ignore
- }
- }
-
- // fall back to failure
- return false;
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/PatternPath.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/PatternPath.java
deleted file mode 100644
index 4cce3a4..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/PatternPath.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.PropertyIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventListener;
-import javax.jcr.observation.ObservationManager;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.util.ChildrenCollectorFilter;
-import org.apache.jackrabbit.util.Text;
-
-/**
- * The <code>PatternPath</code> implements a list of repository item path
- * patterns providing an iterator on the expanded paths. The list of patterns is
- * immutably configured from an array of strings.
- * <p>
- * While the original list of path patterns may be retrieved for informational
- * purposes by calling the {@link #getPath()} method, the primary contents of
- * instances of this class are the expanded paths accessible by calling the
- * {@link #getExpandedPaths()} method.
- * <p>
- * Please note that though this list is immutable there is intentionally no
- * guarantee that all invocations of the {@link #getExpandedPaths} method
- * return the same contents as the patterns contained in the list may expand to
- * different paths for each invocation of that method.
- * <p>
- * Each entry in the pattern list is a path whose segments conform to the
- * pattern syntax defined for the <code>Node.getNodes(String)</code> method.
- * The pattern may be a full name or a partial name with one or more wildcard
- * characters ("*"), or a disjunction (using the "|" character to represent
- * logical <i>OR</i>) of these. For example,
- * <blockquote><code>"jcr:*|foo:bar"</code></blockquote>
- * would match <code>"foo:bar"</code>, but also <code>"jcr:whatever"</code>.
- * <p>
- * The EBNF for pattern is:
- * <pre>
- * namePattern ::= disjunct {'|' disjunct}
- * disjunct ::= name [':' name]
- * name ::= '*' |
- * ['*'] fragment {'*' fragment}['*']
- * fragment ::= char {char}
- * char ::= nonspace | ' '
- * nonspace ::= (* Any Unicode character except:
- * '/', ':', '[', ']', '*',
- * ''', '"', '|' or any whitespace
- * character *)
- * </pre>
- *
- * @author Felix Meschberger
- */
-/* package */ class PatternPath {
-
- /** default logger */
- private static final Log log = LogFactory.getLog(PatternPath.class);
-
- /** The session to access the repository */
- private final Session session;
-
- /** The list of path patterns */
- private final String[] patterns;
-
- /**
- * Creates a <code>PatternPath</code> containing the elements of the
- * string array. Each entry in the array which is either empty or
- * <code>null</code> is ignored and not added to the list. If the array
- * is empty or only contains empty or <code>null</code> elements, the
- * resulting list will consequently be empty.
- *
- * @param session The session to access the Repository to expand the paths
- * and to register as an event listener.
- * @param pathPatterns The array of path patterns to add.
- *
- * @throws NullPointerException if the <code>pathPatterns</code> array or
- * the <code>session</code> is <code>null</code>.
- */
- /* package */ PatternPath(Session session, String[] pathPatterns) {
-
- // check session
- if (session == null) {
- throw new NullPointerException("session");
- }
-
- // prepare the pattern list, excluding null/empty entries
- List patternList = new ArrayList();
- for (int i=0; i < pathPatterns.length; i++) {
- addChecked(patternList, pathPatterns[i]);
- }
- patterns =
- (String[]) patternList.toArray(new String[patternList.size()]);
-
- this.session = session;
- }
-
- /**
- * Returns the session from which this instance has been constructed.
- */
- /* package */ Session getSession() {
- return session;
- }
-
- /**
- * Returns a copy of the list of path patterns from which this instance has
- * been constructed.
- */
- /* package */ String[] getPath() {
- return (String[]) patterns.clone();
- }
-
- /**
- * Returns the list of expanded paths matching the list of patterns. This
- * list is guaranteed to only return existing items.
- * <p>
- * Each invocation of this method expands the pattern anew and returns a
- * new list instance.
- *
- * @return The list of paths matching the patterns. If the pattern list is
- * empty or if no real paths match for any entry in the list, the
- * returned list is empty.
- *
- * @throws RepositoryException if an error occurrs expanding the path
- * pattern list.
- */
- /* package */ List getExpandedPaths() throws RepositoryException {
- List result = new ArrayList(patterns.length);
- Node root = session.getRootNode();
-
- for (int i=0; i < patterns.length; i++) {
- String entry = patterns[i];
-
- if (entry.indexOf('*') >= 0 || entry.indexOf('|') >= 0) {
-
- scan(root, entry, result);
-
- } else {
- // add path without pattern characters without further
- // checking. This allows adding paths which do not exist yet.
- result.add(entry);
- }
-
- }
-
- return result;
- }
-
- //---------- Object overwrite ----------------------------------------------
-
- /**
- * Returns <code>true</code> if this object equals the other object. This
- * implementation only returns true if the other object is the same as this
- * object.
- * <p>
- * The difference to the base class implementation is, that we only accept
- * equality if the other object is the same than this object. This is
- * actually the same implementation as the original <code>Object.equals</code>
- * implementation.
- *
- * @param o The other object to compare to.
- *
- * @return <code>true</code> if the other object is the same as this.
- */
- public boolean equals(Object o) {
- return o == this;
- }
-
- /**
- * Returns a hashcode for this instance. This is currently the hash code
- * returned by the parent implementation. While it does not violate the
- * contract to not change the <code>hashCode()</code> implementation but
- * to change the implementation of the {@link #equals} method, I think this
- * is ok, because our implementation of the {@link #equals} method is just
- * more specific than the base class implementation, which also allows
- * the other object to be a list with the same contents.
- *
- * @return The hash code returned by the base class implementation.
- */
- public int hashCode() {
- return super.hashCode();
- }
-
- /**
- * Returns a string representation of this instance. This is actually the
- * result of the string representation of the List, this actually is,
- * prefixed with the name of this class.
- *
- * @return The string representation of this instance.
- */
- public String toString() {
- StringBuffer buf = new StringBuffer("PatternPath: [");
- for (int i=0; i < patterns.length; i++) {
- if (i != 0) buf.append(", ");
- buf.append(patterns[i]);
- }
- buf.append("]");
- return buf.toString();
- }
-
- //---------- internal ------------------------------------------------------
-
- /**
- * Adds the string to the list of patterns, if neither empty nor
- * <code>null</code>. If the string has one or more trailing slashes
- * (<em>/</em>) they are removed before adding the string.
- */
- private void addChecked(List patternList, String pattern) {
- if (pattern == null || pattern.length() == 0) {
- log.debug("addChecked: Not adding null/empty pattern");
- } else {
-
- // remove all trailing slashes
- while (pattern.endsWith("/") && pattern.length() > 1) {
- pattern = pattern.substring(0, pattern.length()-1);
- }
-
- log.debug("addChecked: Adding " + pattern);
- patternList.add(pattern);
- }
- }
-
- //---------- Path expansion -----------------------------------------------
-
- /**
- * Finds the paths of all nodes and properties matching the pattern below
- * the <code>root</code> node.
- *
- * @param root The root node of the subtree to match against the path
- * pattern.
- * @param pathPattern The path pattern to use to find matching nodes.
- * @param gather The list into which the paths of matching child items
- * are added.
- */
- private static void scan(Node root, String pathPattern, List gather)
- throws RepositoryException {
-
- // initial list of candidates is the root node
- List candidates = new ArrayList();
- candidates.add(root);
-
- StringTokenizer patterns = new StringTokenizer(pathPattern, "/");
- boolean moreTokens = patterns.hasMoreTokens();
- while (moreTokens) {
- String pattern = patterns.nextToken();
- moreTokens = patterns.hasMoreTokens();
-
- // new candidates are the children of the current candidates list
- // matching the current pattern
- List newCandidates = new ArrayList();
- for (Iterator ci=candidates.iterator(); ci.hasNext(); ) {
- Node current = (Node) ci.next();
- for (NodeIterator ni=current.getNodes(pattern); ni.hasNext(); ) {
- newCandidates.add(ni.nextNode());
- }
-
- // if pattern is the last, also consider properties
- if (!moreTokens) {
- PropertyIterator pi = current.getProperties(pattern);
- while (pi.hasNext()) {
- newCandidates.add(pi.nextProperty());
- }
- }
- }
-
- // drop old candidates and use new for next step
- candidates.clear();
- candidates = newCandidates;
- }
-
- // add paths of the candidates to the gather list
- for (Iterator ci=candidates.iterator(); ci.hasNext(); ) {
- Item current = (Item) ci.next();
- gather.add(current.getPath());
- }
- }
-
- //---------- matching support ---------------------------------------------
-
- /**
- * Applies the list of path patterns to the given path returning
- * <code>true</code> if it matches, <code>false</code> otherwise.
- * <p>
- * <b><em>This method is package protected for testing purposes. This
- * method is not intended to be used by clients. Its specification or
- * implementation may change without notice.</em></b>
- *
- * @param path The path to match with the pattern list.
- *
- * @return <code>true</code> if the path matches any of the patterns.
- */
- /* package */ boolean matchPath(String path) {
- StringTokenizer exploded = new StringTokenizer(path, "/");
-
- OUTER_LOOP:
- for (int i=0; i < patterns.length; i++) {
- StringTokenizer exEntry = new StringTokenizer(patterns[i], "/");
-
- // ignore if the number of path elements to not match
- if (exploded.countTokens() != exEntry.countTokens()) {
- continue;
- }
-
- while (exploded.hasMoreTokens()) {
- if (!ChildrenCollectorFilter.matches(exploded.nextToken(),
- exEntry.nextToken())) {
- continue OUTER_LOOP;
- }
- }
-
- // if I get here, the path matches entry[i]
- return true;
- }
-
- // if we run out, no match has been found
- return false;
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/RepositoryClassLoader.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/RepositoryClassLoader.java
deleted file mode 100644
index 902d3cf..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/RepositoryClassLoader.java
+++ /dev/null
@@ -1,863 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.beans.Introspector;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.net.JCRURLConnection;
-import org.apache.jackrabbit.net.URLFactory;
-
-
-/**
- * The <code>RepositoryClassLoader</code> class extends the
- * <code>URLClassLoader</code> and provides the functionality to load classes
- * and resources from JCR Repository.
- * <p>
- * This class loader supports loading classes from the Repository hierarchy,
- * such as a <em>classes</em> 'folder', but also from Jar and Zip files stored
- * in the Repository.
- * <p>
- * For enhanced performance, this class loader keeps a list of resources and
- * classes which have already been loaded through this class loader. If later
- * requests ask for already cached resources, these are returned without
- * checking whether the underlying repository actually still exists.
- * <p>
- * This class is not intended to be extended by clients.
- *
- * @author Felix Meschberger
- */
-public class RepositoryClassLoader extends URLClassLoader {
-
- /** default log category */
- private static final Log log =
- LogFactory.getLog(RepositoryClassLoader.class);
-
- /** An empty list of url paths to call superclass constructor */
- private static final URL[] NULL_PATH = {};
-
- /**
- * The special resource representing a resource which could not be
- * found in the class path.
- *
- * @see #cache
- * @see #findClassLoaderResource(String)
- */
- /* package */ static final ClassLoaderResource NOT_FOUND_RESOURCE =
- new ClassLoaderResource(null, "[sentinel]", null) {
- public boolean isExpired() {
- return false;
- }
- };
-
- /**
- * The classpath which this classloader searches for class definitions.
- * Each element of the vector should be either a directory, a .zip
- * file, or a .jar file.
- * <p>
- * It may be empty when only system classes are controlled.
- */
- private ClassPathEntry[] repository;
-
- /**
- * The list of handles to use as a classpath. These is the unprocessed
- * list of handles given to the constructor.
- */
- private PatternPath handles;
-
- /**
- * The <code>Session</code> grants access to the Repository to access the
- * resources.
- * <p>
- * This field is not final such that it may be cleared when the class loader
- * is destroyed.
- */
- private Session session;
-
- /**
- * Cache of resources found or not found in the class path. The map is
- * indexed by resource name and contains mappings to instances of the
- * {@link ClassLoaderResource} class. If a resource has been tried to be
- * loaded, which could not be found, the resource is cached with the
- * special mapping to {@link #NOT_FOUND_RESOURCE}.
- *
- * @see #NOT_FOUND_RESOURCE
- * @see #findClassLoaderResource(String)
- */
- private Map cache;
-
- /**
- * Flag indicating whether the {@link #destroy()} method has already been
- * called (<code>true</code>) or not (<code>false</code>)
- */
- private boolean destroyed;
-
- /**
- * Creates a <code>RepositoryClassLoader</code> from a list of item path
- * strings containing globbing pattens for the paths defining the class
- * path.
- *
- * @param session The <code>Session</code> to use to access the class items.
- * @param classPath The list of path strings making up the (initial) class
- * path of this class loader. The strings may contain globbing
- * characters which will be resolved to build the actual class path.
- * @param parent The parent <code>ClassLoader</code>, which may be
- * <code>null</code>.
- *
- * @throws NullPointerException if either the session or the handles list is
- * <code>null</code>.
- */
- public RepositoryClassLoader(Session session, String[] classPath,
- ClassLoader parent) {
- this(session, new DynamicPatternPath(session, classPath), parent);
- }
-
- /**
- * Creates a <code>RepositoryClassLoader</code> from a
- * {@link PatternPath} containing globbing pattens for the handles
- * defining the class path.
- *
- * @param session The <code>Session</code> to use to access the class items.
- * @param handles The {@link PatternPath} of handles.
- * @param parent The parent <code>ClassLoader</code>, which may be
- * <code>null</code>.
- *
- * @throws NullPointerException if either the session or the handles list is
- * <code>null</code>.
- */
- /* package */ RepositoryClassLoader(Session session, PatternPath handles,
- ClassLoader parent) {
-
- // initialize the super class with an empty class path
- super(NULL_PATH, parent);
-
- // check session and handles
- if (session == null) {
- throw new NullPointerException("session");
- }
- if (handles == null) {
- throw new NullPointerException("handles");
- }
-
- // set fields
- this.session = session;
- this.setHandles(handles);
- this.cache = new HashMap();
- this.destroyed = false;
-
- // build the class repositories list
- buildRepository();
-
- log.debug("RepositoryClassLoader: " + this + " ready");
- }
-
- /**
- * Returns <code>true</code> if this class loader has already been destroyed
- * by calling {@link #destroy()}.
- */
- protected boolean isDestroyed() {
- return destroyed;
- }
-
- /**
- * Destroys this class loader. This process encompasses all steps needed
- * to remove as much references to this class loader as possible.
- * <p>
- * <em>NOTE</em>: This method just clears all internal fields and especially
- * the class path to render this class loader unusable.
- * <p>
- * This implementation does not throw any exceptions.
- */
- public void destroy() {
- // we expect to be called only once, so we stop destroyal here
- if (isDestroyed()) {
- log.debug("Instance is already destroyed");
- return;
- }
-
- // set destroyal guard
- destroyed = true;
-
- // clear caches and references
- setRepository(null);
- setHandles(null);
- session = null;
-
- // clear the cache of loaded resources and flush cached class
- // introspections of the JavaBean framework
- if (cache != null) {
- for (Iterator ci=cache.values().iterator(); ci.hasNext(); ) {
- ClassLoaderResource res = (ClassLoaderResource) ci.next();
- if (res.getLoadedClass() != null) {
- Introspector.flushFromCaches(res.getLoadedClass());
- res.setLoadedClass(null);
- }
- ci.remove();
- }
- }
- }
-
- //---------- URLClassLoader overwrites -------------------------------------
-
- /**
- * Finds and loads the class with the specified name from the class path.
- *
- * @param name the name of the class
- * @return the resulting class
- *
- * @throws ClassNotFoundException If the named class could not be found or
- * if this class loader has already been destroyed.
- */
- protected Class findClass(final String name) throws ClassNotFoundException {
-
- if (isDestroyed()) {
- throw new ClassNotFoundException(name + " (Classloader destroyed)");
- }
-
- log.debug("findClass: Try to find class " + name);
-
- try {
- return (Class) AccessController
- .doPrivileged(new PrivilegedExceptionAction() {
-
- public Object run() throws ClassNotFoundException {
- return findClassPrivileged(name);
- }
- });
- } catch (java.security.PrivilegedActionException pae) {
- throw (ClassNotFoundException) pae.getException();
- }
- }
-
- /**
- * Finds the resource with the specified name on the search path.
- *
- * @param name the name of the resource
- *
- * @return a <code>URL</code> for the resource, or <code>null</code>
- * if the resource could not be found or if the class loader has
- * already been destroyed.
- */
- public URL findResource(String name) {
-
- if (isDestroyed()) {
- log.warn("Destroyed class loader cannot find a resource");
- return null;
- }
-
- log.debug("findResource: Try to find resource " + name);
-
- ClassLoaderResource res = findClassLoaderResource(name);
- if (res != null) {
- log.debug("findResource: Getting resource from " + res + ", " +
- "created " + new Date(res.getLastModificationTime()));
- return res.getURL();
- }
-
- return null;
- }
-
- /**
- * Returns an Enumeration of URLs representing all of the resources
- * on the search path having the specified name.
- *
- * @param name the resource name
- *
- * @return an <code>Enumeration</code> of <code>URL</code>s. This is an
- * empty enumeration if no resources are found by this class loader
- * or if this class loader has already been destroyed.
- */
- public Enumeration findResources(String name) {
-
- if (isDestroyed()) {
- log.warn("Destroyed class loader cannot find resources");
- return new Enumeration() {
- public boolean hasMoreElements() {
- return false;
- }
- public Object nextElement() {
- throw new NoSuchElementException("No Entries");
- }
- };
- }
-
- log.debug("findResources: Try to find resources for " + name);
-
- List list = new LinkedList();
- for (int i=0; i < repository.length; i++) {
- final ClassPathEntry cp = repository[i];
- log.debug("findResources: Trying " + cp);
-
- ClassLoaderResource res = cp.getResource(name);
- if (res != null) {
- log.debug("findResources: Adding resource from " + res + ", " +
- "created " + new Date(res.getLastModificationTime()));
- URL url = res.getURL();
- if (url != null) {
- list.add(url);
- }
- }
-
- }
-
- // return the enumeration on the list
- return Collections.enumeration(list);
- }
-
- /**
- * Returns the search path of URLs for loading classes and resources.
- * This includes the original list of URLs specified to the constructor,
- * along with any URLs subsequently appended by the {@link #addURL(URL)}
- * and {@link #addHandle(String)} methods.
- *
- * @return the search path of URLs for loading classes and resources. The
- * list is empty, if this class loader has already been destroyed.
- */
- public URL[] getURLs() {
- if (isDestroyed()) {
- log.warn("Destroyed class loader has no URLs any more");
- return new URL[0];
- }
-
- List urls = new ArrayList();
- for (int i=0; i < repository.length; i++) {
- URL url = repository[i].toURL();
- if (url != null) {
- urls.add(url);
- }
- }
- return (URL[]) urls.toArray(new URL[urls.size()]);
- }
-
- /**
- * Appends the specified URL to the list of URLs to search for
- * classes and resources. Only Repository URLs with the protocol set to
- * <code>JCR</code> are considered for addition. The system will find out
- * whether the URL points to a directory or a jar archive.
- * <p>
- * URLs added using this method will be preserved through reconfiguration
- * and reinstantiation.
- * <p>
- * If this class loader has already been destroyed this method has no
- * effect.
- *
- * @param url the <code>JCR</code> URL to be added to the search path of
- * URLs.
- */
- protected void addURL(URL url) {
- if (isDestroyed()) {
- log.warn("Cannot add URL to destroyed class loader");
-
- } else if (checkURL(url)) {
- // Repository URL
- log.debug("addURL: Adding URL " + url);
- try {
- JCRURLConnection conn = (JCRURLConnection) url.openConnection();
- ClassPathEntry cp = ClassPathEntry.getInstance(
- conn.getSession(), conn.getPath());
- addClassPathEntry(cp);
- } catch (IOException ioe) {
- log.warn("addURL: Cannot add URL " + url, ioe);
- }
-
- } else {
- log.warn("addURL: " + url + " is not a Repository URL, ignored");
- }
- }
-
- /**
- * Appends the specified path to the list of handles to search for classes
- * and resources. The system will find out whether the path points to a
- * directory or a JAR or ZIP archive. The path is added as is, provided it
- * is valid to be used in the class path and therefore must not contain any
- * globbing characters.
- * <p>
- * If this class loader has already been destroyed, this method has no
- * effect.
- *
- * @param path The path to be added to the search path.
- */
- public void addHandle(String path) {
- if (isDestroyed()) {
- log.warn("Cannot add handle to destroyed class loader");
- return;
- }
-
- log.debug("addURL: Adding Handle " + path);
- ClassPathEntry cp = ClassPathEntry.getInstance(session, path);
- if (cp != null) {
- addClassPathEntry(cp);
- } else {
- log.debug("addHandle: Cannot get a ClassPathEntry for " + path);
- }
- }
-
- //---------- Property access ----------------------------------------------
-
- /**
- * Sets the {@link PatternPath} list to be used as the initial search
- * path of this class loader. This new list replaces the path pattern list
- * set in the constructor or in a previous call to this method.
- * <p>
- * After setting the list, this class loader's class path has to be rebuilt
- * by calling the {@link #buildRepository()} method.
- *
- * @param handles The {@link PatternPath} to set on this class loader.
- */
- /* package */ void setHandles(PatternPath handles) {
- this.handles = handles;
- }
-
- /**
- * Returns the current {@link PatternPath} from which the search path
- * of this class loader is configured.
- */
- /* package */ PatternPath getHandles() {
- return handles;
- }
-
- /**
- * Returns the named {@link ClassLoaderResource} if it is contained in the
- * cache. If the resource does not exist in the cache or has not been found
- * in the class path at an earlier point in time, <code>null</code> is
- * returned.
- *
- * @param name The name of the resource to retrieve from the cache.
- *
- * @return The named <code>ClassLoaderResource</code> or <code>null</code>
- * if not loaded.
- *
- * @throws NullPointerException If this class loader has already been
- * destroyed.
- */
- /* package */ ClassLoaderResource getCachedResource(String name) {
- Object res = cache.get(name);
- if (res == null || res == NOT_FOUND_RESOURCE) {
- log.debug("Resource " + name + " no cached");
- return null;
- }
-
- return (ClassLoaderResource) res;
- }
-
- /**
- * Returns an <code>Iterator</code> on all resources in the cache. This
- * iterator may also contain {@link #NOT_FOUND_RESOURCE sentinel} entries
- * for resources, which failed to load. Callers of this method should take
- * care to filter out such resources before acting on it.
- *
- * @throws NullPointerException If this class loader has already been
- * destroyed.
- */
- /* package */ Iterator getCachedResources() {
- return cache.values().iterator();
- }
-
- /**
- * Removes all entries from the cache of loaded resources, which mark
- * resources, which have not been found as of yet.
- *
- * @throws NullPointerException If this class loader has already been
- * destroyed.
- */
- protected void cleanCache() {
- for (Iterator ci=cache.values().iterator(); ci.hasNext(); ) {
- if (ci.next() == NOT_FOUND_RESOURCE) {
- ci.remove();
- }
- }
- }
-
- /**
- * Returns <code>true</code>, if the cache is not empty. If the
- * {@link #cleanCache()} method is not called before calling this method, a
- * false positive result may be returned.
- *
- * @throws NullPointerException If this class loader has already been
- * destroyed.
- */
- protected boolean hasLoadedResources() {
- return cache.isEmpty();
- }
-
- /**
- * Returns the session used by this class loader to access the repository.
- * If this class loader has already been destroyed, this <code>null</code>
- * is returned.
- */
- protected Session getSession() {
- return session;
- }
-
- /**
- * Sets the current active class path to the list of class path entries.
- */
- protected void setRepository(ClassPathEntry[] classPath) {
- this.repository = classPath;
- }
-
- /**
- * Returns the current active class path entries list or <code>null</code>
- * if this class loader has already been destroyed.
- */
- protected ClassPathEntry[] getRepository() {
- return repository;
- }
-
- /**
- * Adds the class path entry to the current class path list. If the class
- * loader has already been destroyed, this method creates a single entry
- * class path list with the new class path entry.
- */
- protected void addClassPathEntry(ClassPathEntry cpe) {
- log.debug("addHandle: Adding path " + cpe.getPath());
-
- // append the entry to the current class path
- ClassPathEntry[] oldClassPath = getRepository();
- ClassPathEntry[] newClassPath = addClassPathEntry(oldClassPath, cpe);
- setRepository(newClassPath);
- }
-
- /**
- * Helper method for class path handling to a new entry to an existing
- * list and return the new list.
- * <p>
- * If <code>list</code> is <code>null</code> a new array is returned with
- * a single element <code>newEntry</code>. Otherwise the array returned
- * contains all elements of <code>list</code> and <code>newEntry</code>
- * at the last position.
- *
- * @param list The array of class path entries, to which a new entry is
- * to be appended. This may be <code>null</code>.
- * @param newEntry The new entry to append to the class path list.
- *
- * @return The extended class path list.
- */
- protected ClassPathEntry[] addClassPathEntry(ClassPathEntry[] list,
- ClassPathEntry newEntry) {
-
- // quickly define single entry array for the first entry
- if (list == null) {
- return new ClassPathEntry[]{ newEntry };
- }
-
- // create new array and copy old and new contents
- ClassPathEntry[] newList = new ClassPathEntry[list.length+1];
- System.arraycopy(list, 0, newList, 0, list.length);
- newList[list.length] = newEntry;
- return newList;
- }
-
- //---------- Object overwrite ---------------------------------------------
-
- /**
- * Returns a string representation of this instance.
- */
- public String toString() {
- StringBuffer buf = new StringBuffer(getClass().getName());
-
- if (isDestroyed()) {
- buf.append(" - destroyed");
- } else {
- buf.append(": parent: { ");
- buf.append(getParent());
- buf.append(" }, user: ");
- buf.append(session.getUserID());
- }
-
- return buf.toString();
- }
-
- //---------- internal ------------------------------------------------------
-
- /**
- * Builds the repository list from the list of path patterns and appends
- * the path entries from any added handles. This method may be used multiple
- * times, each time replacing the currently defined repository list.
- *
- * @throws NullPointerException If this class loader has already been
- * destroyed.
- */
- protected synchronized void buildRepository() {
-
- // build new repository
- List handles;
- try {
- handles = getHandles().getExpandedPaths();
- } catch (RepositoryException re) {
- log.error("Cannot expand handle list", re);
- return;
- }
-
- List newRepository = new ArrayList(handles.size());
-
- // build repository from path patterns
- for (int i=0; i < handles.size(); i++) {
- String entry = (String) handles.get(i);
- ClassPathEntry cp = null;
-
- // try to find repository based on this path
- if (getRepository() != null) {
- for (int j=0; j < repository.length; j++) {
- ClassPathEntry tmp = repository[i];
- if (tmp.getPath().equals(entry)) {
- cp = tmp;
- break;
- }
- }
- }
-
- // not found, creating new one
- if (cp == null) {
- cp = ClassPathEntry.getInstance(session, entry);
- }
-
- if (cp != null) {
- log.debug("Adding path " + entry);
- newRepository.add(cp);
- } else {
- log.debug("Cannot get a ClassPathEntry for " + entry);
- }
- }
-
- // replace old repository with new one
- ClassPathEntry[] newClassPath = new ClassPathEntry[newRepository.size()];
- newRepository.toArray(newClassPath);
- setRepository(newClassPath);
-
- // clear un-found resource cache
- cleanCache();
- }
-
- /**
- * Tries to find the class in the class path from within a
- * <code>PrivilegedAction</code>. Throws <code>ClassNotFoundException</code>
- * if no class can be found for the name.
- *
- * @param name the name of the class
- *
- * @return the resulting class
- *
- * @throws ClassNotFoundException if the class could not be found
- * @throws NullPointerException If this class loader has already been
- * destroyed.
- */
- private Class findClassPrivileged(String name) throws ClassNotFoundException {
-
- // prepare the name of the class
- final String path = name.replace('.', '/').concat(".class");
- log.debug("findClassPrivileged: Try to find path " + path +
- " for class " + name);
-
- ClassLoaderResource res = findClassLoaderResource(path);
- if (res != null) {
-
- // try defining the class, error aborts
- try {
- log.debug("findClassPrivileged: Loading class from " +
- res + ", created " + new Date(res.getLastModificationTime()));
-
- Class c = defineClass(name, res);
- if (c == null) {
- log.warn("defineClass returned null for class " + name);
- throw new ClassNotFoundException(name);
- }
- return c;
-
- } catch (IOException ioe) {
- log.debug("defineClass failed", ioe);
- throw new ClassNotFoundException(name, ioe);
- } catch (Throwable t) {
- log.debug("defineClass failed", t);
- throw new ClassNotFoundException(name, t);
- }
- }
-
- throw new ClassNotFoundException(name);
- }
-
- /**
- * Returns a {@link ClassLoaderResource} for the given <code>name</code> or
- * <code>null</code> if not existing. If the resource has already been
- * loaded earlier, the cached instance is returned. If the resource has
- * not been found in an earlier call to this method, <code>null</code> is
- * returned. Otherwise the resource is looked up in the class path. If
- * found, the resource is cached and returned. If not found, the
- * {@link #NOT_FOUND_RESOURCE} is cached for the name and <code>null</code>
- * is returned.
- *
- * @param name The name of the resource to return.
- *
- * @return The named <code>ClassLoaderResource</code> if found or
- * <code>null</code> if not found.
- *
- * @throws NullPointerException If this class loader has already been
- * destroyed.
- */
- /* package */ ClassLoaderResource findClassLoaderResource(String name) {
-
- // check for cached resources first
- ClassLoaderResource res = (ClassLoaderResource) cache.get(name);
- if (res == NOT_FOUND_RESOURCE) {
- log.info("Resource '" + name + "' known to not exist in class path");
- return null;
- } else if (res != null) {
- return res;
- }
-
- // walk the repository list and try to find the resource
- for (int i = 0; i < repository.length; i++) {
- final ClassPathEntry cp = repository[i];
- log.debug("Checking " + cp);
-
- res = cp.getResource(name);
- if (res != null) {
- log.debug("Found resource in " + res + ", " +
- "created " + new Date(res.getLastModificationTime()));
- cache.put(name, res);
- return res;
- }
-
- }
-
- log.debug("No classpath entry contains " + name);
- cache.put(name, NOT_FOUND_RESOURCE);
- return null;
- }
-
- /**
- * Defines a class getting the bytes for the class from the resource
- *
- * @param name The fully qualified class name
- * @param res The resource to obtain the class bytes from
- *
- * @throws RepositoryException If a problem occurrs getting at the data.
- * @throws IOException If a problem occurrs reading the class bytes from
- * the resource.
- * @throws ClassFormatError If the class bytes read from the resource are
- * not a valid class.
- */
- private Class defineClass(String name, ClassLoaderResource res)
- throws IOException, RepositoryException {
-
- log.debug("defineClass(" + name + ", " + res + ")");
-
- Class clazz = res.getLoadedClass();
- if (clazz == null) {
-
- /**
- * This following code for packages is duplicate from URLClassLoader
- * because it is private there. I would like to not be forced to
- * do this, but I still have to find a way ... -fmeschbe
- */
-
- // package support
- int i = name.lastIndexOf('.');
- if (i != -1) {
- String pkgname = name.substring(0, i);
- // Check if package already loaded.
- Package pkg = getPackage(pkgname);
- URL url = res.getCodeSourceURL();
- Manifest man = res.getManifest();
- if (pkg != null) {
- // Package found, so check package sealing.
- boolean ok;
- if (pkg.isSealed()) {
- // Verify that code source URL is the same.
- ok = pkg.isSealed(url);
- } else {
- // Make sure we are not attempting to seal the package
- // at this code source URL.
- ok = (man == null) || !isSealed(pkgname, man);
- }
- if (!ok) {
- throw new SecurityException("sealing violation");
- }
- } else {
- if (man != null) {
- definePackage(pkgname, man, url);
- } else {
- definePackage(pkgname, null, null, null, null, null, null, null);
- }
- }
- }
-
- byte[] data = res.getBytes();
- clazz = defineClass(name, data, 0, data.length);
- res.setLoadedClass(clazz);
- }
-
- return clazz;
- }
-
- /**
- * Returns true if the specified package name is sealed according to the
- * given manifest
- * <p>
- * This code is duplicate from <code>URLClassLoader.isSealed</code> because
- * the latter has private access and we need the method here.
- */
- private boolean isSealed(String name, Manifest man) {
- String path = name.replace('.', '/').concat("/");
- Attributes attr = man.getAttributes(path);
- String sealed = null;
- if (attr != null) {
- sealed = attr.getValue(Attributes.Name.SEALED);
- }
- if (sealed == null) {
- if ((attr = man.getMainAttributes()) != null) {
- sealed = attr.getValue(Attributes.Name.SEALED);
- }
- }
- return "true".equalsIgnoreCase(sealed);
- }
-
- /**
- * Returns <code>true</code> if the <code>url</code> is a <code>JCR</code>
- * URL.
- *
- * @param url The URL to check whether it is a valid <code>JCR</code> URL.
- *
- * @return <code>true</code> if <code>url</code> is a valid <code>JCR</code>
- * URL.
- *
- * @throws NullPointerException if <code>url</code> is <code>null</code>.
- */
- private boolean checkURL(URL url) {
- return URLFactory.REPOSITORY_SCHEME.equalsIgnoreCase(url.getProtocol());
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/Util.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/Util.java
deleted file mode 100644
index 5b89196..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/classloader/Util.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import javax.jcr.AccessDeniedException;
-import javax.jcr.Item;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.ValueFormatException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * The <code>Util</code> provides helper methods for the repository classloader
- * and its class path entry and resource classes.
- * <p>
- * This class may not be extended or instantiated, it just contains static
- * utility methods.
- *
- * @author Felix Meschberger
- */
-public class Util {
-
- /** default logging */
- private static final Log log = LogFactory.getLog(Util.class);
-
- /** Private constructor to not instantiate */
- private Util() {}
-
- /**
- * Resolves the given <code>item</code> to a <code>Property</code>. If the
- * <code>item</code> is a node, the <code>getPrimaryItem</code> method is
- * called repeatedly until a property is returned or until no more primary
- * item is available. If the resulting property is a multivalue property,
- * <code>null</code> is returned. Otherwise if the resulting property is
- * a <code>REFERENCE</code> property, the node referred to is retrieved
- * and this method is called recursively with the node. Otherwise, the
- * resulting property is returned.
- *
- * @param item The <code>Item</code> to resolve to a <code>Property</code>.
- *
- * @return The resolved <code>Property</code> or <code>null</code> if the
- * resolved property is a multi-valued property.
- *
- * @throws ItemNotFoundException If the <code>item</code> is a node which
- * cannot be resolved to a property through (repeated) calls to
- * <code>Node.getPrimaryItem</code>.
- * @throws ValueFormatException If the <code>item</code> resolves to a
- * single-valued <code>REFERENCE</code> type property which cannot
- * be resolved to the node referred to.
- * @throws RepositoryException if another error occurrs accessing the
- * repository.
- */
- public static Property getProperty(Item item)
- throws ItemNotFoundException, ValueFormatException,
- RepositoryException {
-
- // if the item is a node, get its primary item until either
- // no primary item exists any more or an ItemNotFoundException is thrown
- while (item.isNode()) {
- item = ((Node) item).getPrimaryItem();
- }
-
- // we get here with a property - otherwise an exception has already
- // been thrown
- Property prop = (Property) item;
- if (prop.getDefinition().isMultiple()) {
- log.error(prop.getPath() + " is a multivalue property");
- return null;
- } else if (prop.getType() == PropertyType.REFERENCE) {
- Node node = prop.getNode();
- log.info("Property " + prop.getPath() + " refers to node " +
- node.getPath() + "; finding primary item");
- return getProperty(node);
- }
-
- return prop;
- }
-
- /**
- * Returns the last modification time of the property. If the property's
- * parent node is a <code>nt:resource</code> the <code>long</code> value
- * of the <code>jcr:lastModified</code> property of the parent node is
- * returned. Otherwise the current system time is returned.
- *
- * @param prop The property for which to return the last modification
- * time.
- *
- * @return The last modification time of the resource or the current time
- * if the property is not a child of an <code>nt:resource</code> node.
- *
- * @throws ItemNotFoundException If the parent node of the property cannot
- * be retrieved.
- * @throws PathNotFoundException If the "jcr:lastModified" property of the
- * parent node cannot be retrieved. This exception is unlikely in a
- * correctly configured repository as the jcr:lastModified property
- * has to be present in a node of type nt:resource.
- * @throws AccessDeniedException If (read) access to the parent node is
- * denied.
- * @throws RepositoryException If any other error occurrs accessing the
- * repository to retrieve the last modification time.
- */
- public static long getLastModificationTime(Property prop)
- throws ItemNotFoundException, PathNotFoundException,
- AccessDeniedException, RepositoryException {
-
- Node parent = prop.getParent();
- if (parent.isNodeType("nt:resource")) {
- return parent.getProperty("jcr:lastModified").getLong();
- }
-
- return System.currentTimeMillis();
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/FileParts.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/net/FileParts.java
deleted file mode 100644
index ab9f9e1..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/FileParts.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.net;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-
-import javax.jcr.Session;
-
-/**
- * The <code>FileParts</code> class provides composing and parsing functionality
- * to create and analize JCR Repository URL file components.
- * <p>
- * The file component of a JCR Repository URL has the format
- * <pre>
- * file = [ "jcr:" [ "//" authority ] ] "/" repository "/" workspace jarpath .
- * authority = // URL authority specification
- * repository = // URL encoded repository name
- * workspace = // URL encoded workspace name
- * jarpath = path [ "!/" [ entry ] ] .
- * path = // The absolute item path (with a leading slash)
- * entry = // The (relative) path to the entry in an archive
- * </pre>
- * <p>
- * To facitility use of this class with JCRJar URLs, the
- * {@link #FileParts(String)} supports file specifications which contains
- * the JCR Repository URL scheme name and an optional URL authority
- * specification. This prefix in front of the real file specification is
- * silently discarded. It is not included in the string representation returned
- * by the {@link #toString()} method.
- * <p>
- * To make sure parsing is not complicated by implementation and use case
- * specific repository and workspace names, those names are URL encoded using
- * the <code>URLEncoder</code> class and <i>UTF-8</i> character encoding.
- *
- * @author Felix Meschberger
- */
-class FileParts {
-
- /** The decoded name of the repository */
- private final String repository;
-
- /** The decoded name of the workspace */
- private final String workspace;
-
- /** The repository item path part of the URL path */
- private final String path;
-
- /**
- * The path to the entry in the archive, if the file spec contains the
- * jar entry separator <i>!/</i>. If no entry path is specified, this is
- * <code>null</code>. If no path is specified after the <i>!/</i> this
- * is an empty string.
- */
- private final String entryPath;
-
- /**
- * Creates a new instance for the root node of the given session. The
- * repository name is currently set to the fixed string "_" as there has not
- * been established a repository naming convention yet. The name of the
- * workspace is set to the name of the workspace to which the session is
- * attached. The path is set to <code>"/"</code> to indicate the root node
- * if the <code>path</code> argument is <code>null</code>.
- *
- * @param session The session for which to create this instance.
- * @param path The absolute item path to initialize this instance with. If
- * <code>null</code> the item path is set to the <code>/</code>.
- * @param entryPath The path to the archive entry to set on this instance.
- * This is expected to be a relative path without a leading slash and
- * may be <code>null</code>.
- *
- * @throws NullPointerException if <code>session</code> is
- * <code>null</code>.
- */
- FileParts(Session session, String path, String entryPath) {
- this.repository = "_";
- this.workspace = session.getWorkspace().getName();
- this.path = (path == null) ? "/" : path;
- this.entryPath = entryPath;
- }
-
- /**
- * Creates an instance of this class setting the repository, workspace and
- * path fields from the given <code>file</code> specification.
- *
- * @param file The specification providing the repository, workspace and
- * path values.
- *
- * @throws NullPointerException if <code>file</code> is
- * <code>null</code>.
- * @throws IllegalArgumentException if <code>file</code> is not the
- * correct format.
- */
- FileParts(String file) {
- if (!file.startsWith("/")) {
- if (file.startsWith(URLFactory.REPOSITORY_SCHEME+":")) {
- file = strip(file);
- } else {
- throw failure("Not an absolute file", file);
- }
- }
-
- // find the repository name
- int slash0 = 1;
- int slash1 = file.indexOf('/', slash0);
- if (slash1 < 0 || slash1-slash0 == 0) {
- throw failure("Missing repository name", file);
- }
- this.repository = decode(file.substring(slash0, slash1));
-
- // find the workspace name
- slash0 = slash1 + 1;
- slash1 = file.indexOf('/', slash0);
- if (slash1 < 0 || slash1-slash0 == 0) {
- throw failure("Missing workspace name", file);
- }
- this.workspace = decode(file.substring(slash0, slash1));
-
- String fullPath = file.substring(slash1);
- int bangSlash = JCRJarURLHandler.indexOfBangSlash(fullPath);
- if (bangSlash < 0) {
- this.path = fullPath;
- this.entryPath = null;
- } else {
- this.path = fullPath.substring(0, bangSlash-1);
- this.entryPath = fullPath.substring(bangSlash+1);
- }
- }
-
- /**
- * Returns the plain name of the repository.
- */
- String getRepository() {
- return repository;
- }
-
- /**
- * Returns the plain name of the workspace.
- */
- String getWorkspace() {
- return workspace;
- }
-
- /**
- * Returns the absolute repository path of the item.
- */
- String getPath() {
- return path;
- }
-
- /**
- * Returns the entry path of <code>null</code> if no entry exists.
- */
- String getEntryPath() {
- return entryPath;
- }
-
- //---------- Object overwrites --------------------------------------------
-
- /**
- * Returns a hash code for this instance composed of the hash codes of the
- * repository, workspace and path names.
- */
- public int hashCode() {
- return getRepository().hashCode() +
- 17 * getWorkspace().hashCode() +
- 33 * getPath().hashCode();
- }
-
- /**
- * Returns <code>true</code> if <code>obj</code> is the same as this or
- * if other is a <code>FileParts</code> with the same path, workspace and
- * repository. Otherwise <code>false</code> is returned.
- */
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof FileParts) {
- FileParts other = (FileParts) obj;
-
- // catch null entry path, fail if other has a defined entry path
- if (getEntryPath() == null) {
- if (other.getEntryPath() != null) {
- return false;
- }
- }
-
- return getPath().equals(other.getPath()) &&
- getWorkspace().equals(other.getWorkspace()) &&
- getRepository().equals(other.getRepository()) &&
- getEntryPath().equals(other.getEntryPath());
- }
-
- // fall back on null or other class
- return false;
- }
-
- /**
- * Returns the encoded string representation of this instance, which may
- * later be fed to the {@link #FileParts(String)} constructor to recreate
- * an equivalent instance.
- */
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append('/').append(encode(getRepository()));
- buf.append('/').append(encode(getWorkspace()));
- buf.append(getPath());
-
- if (getEntryPath() != null) {
- buf.append("!/").append(getEntryPath());
- }
-
- return buf.toString();
- }
-
- //---------- internal -----------------------------------------------------
-
- /**
- * @throws IllegalArgumentException If there is no path element after the
- * authority.
- */
- private String strip(String file) {
- // cut off jcr: prefix - any other prefix, incl. double slash
- // would cause an exception to be thrown in the constructor
- int start = 4;
-
- // check whether the remainder contains an authority specification
- if (file.length() >= start+2 && file.charAt(start) == '/' &&
- file.charAt(start+1) == '/') {
-
- // find the slash after the authority, fail if missing
- start = file.indexOf('/', start + 2);
- if (start < 0) {
- throw failure("Missing path after authority", file);
- }
- }
-
- // return the file now
- return file.substring(start);
- }
-
- /**
- * Encodes the given string value using the <code>URLEncoder</code> and
- * <i>UTF-8</i> character encoding.
- *
- * @param value The string value to encode.
- *
- * @return The encoded string value.
- *
- * @throws InternalError If <code>UTF-8</code> character set encoding is
- * not supported. As <code>UTF-8</code> is required to be implemented
- * on any Java platform, this error is not expected.
- */
- private String encode(String value) {
- try {
- return URLEncoder.encode(value, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- // not expected, throw an InternalError
- throw new InternalError("UTF-8 not supported");
- }
- }
-
- /**
- * Decodes the given string value using the <code>URLDecoder</code> and
- * <i>UTF-8</i> character encoding.
- *
- * @param value The string value to decode.
- *
- * @return The decoded string value.
- *
- * @throws InternalError If <code>UTF-8</code> character set encoding is
- * not supported. As <code>UTF-8</code> is required to be implemented
- * on any Java platform, this error is not expected.
- */
- private String decode(String value) {
- try {
- return URLDecoder.decode(value, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- // not expected, throw an InternalError
- throw new InternalError("UTF-8 not supported");
- }
- }
-
- /**
- * Returns a <code>IllegalArgumentException</code> formatted with the
- * given reason and causing file specification.
- *
- * @param reason The failure reason.
- * @param file The original file specification leading to failure.
- *
- * @return A <code>IllegalArgumentException</code> with the given
- * reason and causing file specification.
- */
- private IllegalArgumentException failure(String reason, String file) {
- return new IllegalArgumentException(reason + ": '" + file + "'");
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRJarURLConnection.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRJarURLConnection.java
deleted file mode 100644
index 418611a..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRJarURLConnection.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.net;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * The <code>JCRJarURLConnection</code> extends the
- * {@link org.apache.jackrabbit.net.JCRURLConnection} class to support accessing
- * archive files stored in a JCR Repository.
- * <p>
- * Just like the base class, this class requires the URL to resolve, either
- * directly or through primary item chain, to a repository <code>Property</code>.
- * <p>
- * Access to this connections property and archive entry content is perpared
- * with the {@link #connect()}, which after calling the base class implementation
- * to find the property tries to find the archive entry and set the connection's
- * fields according to the entry. This implementation's {@link #connect()}
- * method fails if the named entry does not exist in the archive.
- * <p>
- * The {@link #getInputStream()} method either returns an stream on the archive
- * entry or on the archive depending on whether an entry path is specified
- * in the URL or not. Like the base class implementation, this implementation
- * returns a new <code>InputStream</code> on each invocation.
- * <p>
- * If an entry path is defined on the URL, the header fields are set from the
- * archive entry:
- * <table border="0" cellspacing="0" cellpadding="3">
- * <tr><td><code>Content-Type</code><td>Guessed from the entry name or
- * <code>application/octet-stream</code> if the type cannot be guessed
- * from the name</tr>
- * <tr><td><code>Content-Encoding</code><td><code>null</code></tr>
- * <tr><td><code>Content-Length</code><td>The size of the entry</tr>
- * <tr><td><code>Last-Modified</code><td>The last modification time of the
- * entry</tr>
- * </table>
- * <p>
- * If no entry path is defined on the URL, the header fields are set from the
- * property by the base class implementation with the exception of the
- * content type, which is set to <code>application/java-archive</code> by
- * the {@link #connect()} method.
- * <p>
- * <em>Note that this implementation does only support archives stored in the
- * JCR Repository, no other contained storage such as </em>file<em> or
- * </em>http<em> is supported.</em>
- * <p>
- * This class is not intended to be subclassed or instantiated by clients.
- *
- * @author Felix Meschberger
- */
-public class JCRJarURLConnection extends JCRURLConnection {
-
- /** default log category */
- private static final Log log = LogFactory.getLog(JCRJarURLConnection.class);
-
- /**
- * The name of the MIME content type for this connection's content if
- * no entry path is defined on the URL (value is "application/java-archive").
- */
- protected static final String APPLICATION_JAR = "application/java-archive";
-
- /**
- * Creates an instance of this class for the given <code>url</code>
- * supported by the <code>handler</code>.
- *
- * @param url The URL to base the connection on.
- * @param handler The URL handler supporting the given URL.
- */
- JCRJarURLConnection(URL url, JCRJarURLHandler handler) {
- super(url, handler);
- }
-
- /**
- * Returns the path to the entry contained in the archive or
- * <code>null</code> if the URL contains no entry specification in the
- * path.
- */
- String getEntryPath() {
- return getFileParts().getEntryPath();
- }
-
- /**
- * Connects to the URL setting the header fields and preparing for the
- * {@link #getProperty()} and {@link #getInputStream()} methods.
- * <p>
- * After calling the base class implemenation to get the basic connection,
- * the entry is looked for in the archive to set the content type, content
- * length and last modification time header fields according to the named
- * entry. If no entry is defined on the URL, only the content type header
- * field is set to <code>application/java-archive</code>.
- * <p>
- * When this method successfully returns, this connection is considered
- * connected. In case of an exception thrown, the connection is not
- * connected.
- *
- * @throws IOException if an error occurrs retrieving the data property or
- * any of the header field value properties or if any other errors
- * occurrs. Any cuasing exception is set as the cause of this
- * exception.
- */
- public synchronized void connect() throws IOException {
-
- if (!connected) {
-
- // have the base class connect to get the jar property
- super.connect();
-
- // we assume the connection is now (temporarily) connected,
- // thus calling the getters will not result in a recursive loop
- Property property = getProperty();
- String contentType = getContentType();
- String contentEncoding = getContentEncoding();
- int contentLength = getContentLength();
- long lastModified = getLastModified();
-
- // mark as not connected to not get false positives if the
- // following code fails
- connected = false;
-
- // Get hold of the data
- try {
-
- JarInputStream jins = null;
- try {
-
- // try to get the jar input stream, fail if no jar
- jins = new JarInputStream(property.getStream());
-
- String entryPath = getEntryPath();
- if (entryPath != null) {
-
- JarEntry entry = findEntry(jins, entryPath);
-
- if (entry != null) {
-
- contentType = guessContentTypeFromName(entryPath);
- if (contentType == null) {
- contentType = APPLICATION_OCTET;
- }
-
- contentLength = (int) entry.getSize();
- lastModified = entry.getTime();
-
- } else {
-
- throw failure("connect", entryPath +
- " not contained in jar archive", null);
-
- }
-
- } else {
-
- // replaces the base class defined content type
- contentType = APPLICATION_JAR;
-
- }
-
- } finally {
- if (jins != null) {
- try {
- jins.close();
- } catch (IOException ignore) {
- }
- }
- }
-
- log.debug("connect: Using atom '" + property.getPath()
- + "' with content type '" + contentType + "' for "
- + String.valueOf(contentLength) + " bytes");
-
- // set the fields
- setContentType(contentType);
- setContentEncoding(contentEncoding);
- setContentLength(contentLength);
- setLastModified(lastModified);
-
- // mark connection open
- connected = true;
-
- } catch (RepositoryException re) {
-
- throw failure("connect", re.toString(), re);
-
- }
- }
- }
-
- /**
- * Returns an input stream that reads from this open connection. If not
- * entry path is specified in the URL, this method returns the input stream
- * providing access to the archive as a whole. Otherwise the input stream
- * returned is a <code>JarInputStream</code> positioned at the start of
- * the named entry.
- * <p>
- * <b>NOTES:</b>
- * <ul>
- * <li>Each call to this method returns a new <code>InputStream</code>.
- * <li>Do not forget to close the return stream when not used anymore for
- * the system to be able to free resources.
- * </ul>
- * <p>
- * Calling this method implicitly calls {@link #connect()} to ensure the
- * connection is open.
- *
- * @return The <code>InputStream</code> on the archive or the entry if
- * specified.
- *
- * @throws IOException if an error occurrs opening the connection through
- * {@link #connect()} or creating the <code>InputStream</code> on the
- * repository <code>Property</code>.
- */
- public InputStream getInputStream() throws IOException {
-
- // get the input stream on the archive itself - also enforces connect()
- InputStream ins = super.getInputStream();
-
- // access the entry in the archive if defined
- String entryPath = getEntryPath();
- if (entryPath != null) {
- // open the jar input stream
- JarInputStream jins = new JarInputStream(ins);
-
- // position at the correct entry
- findEntry(jins, entryPath);
-
- // return the input stream
- return jins;
- }
-
- // otherwise just return the stream on the archive
- return ins;
- }
-
- //----------- internal helper to find the entry ------------------------
-
- /**
- * Returns the <code>JarEntry</code> for the path from the
- * <code>JarInputStream</code> or <code>null</code> if the path cannot
- * be found in the archive.
- *
- * @param zins The <code>JarInputStream</code> to search in.
- * @param path The path of the <code>JarEntry</code> to return.
- *
- * @return The <code>JarEntry</code> for the path or <code>null</code>
- * if no such entry can be found.
- *
- * @throws IOException if a problem occurrs reading from the stream.
- */
- static JarEntry findEntry(JarInputStream zins, String path)
- throws IOException {
-
- JarEntry entry = zins.getNextJarEntry();
- while (entry != null) {
- if (path.equals(entry.getName())) {
- return entry;
- }
-
- entry = zins.getNextJarEntry();
- }
- // invariant : nothing found in the zip matching the path
-
- return null;
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRJarURLHandler.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRJarURLHandler.java
deleted file mode 100644
index 55c801a..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRJarURLHandler.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.net;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.jcr.Session;
-
-/**
- * The <code>JCRJarURLHandler</code> is the <code>URLStreamHandler</code> for
- * Java Archive URLs for archives from a JCR Repository URLs (JCRJar URL). The
- * scheme for such ULRs will be <code>jar</code> while the file part of the URL
- * has the scheme <code>jcr</code>.
- * <p>
- * JCRJar URLs have not been standardized yet and may only be created in the
- * context of an existing <code>Session</code>. Therefore this handler is not
- * globally available and JCR Repository URLs may only be created through the
- * factory methods in the {@link org.apache.jackrabbit.net.URLFactory} class.
- * <p>
- * This class is not intended to be subclassed or instantiated by clients.
- *
- * @author Felix Meschberger
- *
- * @see org.apache.jackrabbit.net.JCRJarURLConnection
- * @see org.apache.jackrabbit.net.URLFactory
- * @see org.apache.jackrabbit.net.URLFactory#createJarURL(Session, String, String)
- */
-class JCRJarURLHandler extends JCRURLHandler {
-
- /**
- * Creates an instance of this handler class.
- *
- * @param session The <code>Session</code> supporting this handler. This
- * must not be <code>null</code>.
- *
- * @throws NullPointerException if <code>session</code> is <code>null</code>.
- */
- JCRJarURLHandler(Session session) {
- super(session);
- }
-
- //---------- URLStreamHandler abstracts ------------------------------------
-
- /**
- * Gets a connection object to connect to an JCRJar URL.
- *
- * @param url The JCRJar URL to connect to.
- *
- * @return An instance of the {@link JCRJarURLConnection} class.
- *
- * @see JCRJarURLConnection
- */
- protected URLConnection openConnection(URL url) {
- return new JCRJarURLConnection(url, this);
- }
-
- /**
- * Parses the string representation of a <code>URL</code> into a
- * <code>URL</code> object.
- * <p>
- * If there is any inherited context, then it has already been copied into
- * the <code>URL</code> argument.
- * <p>
- * The <code>parseURL</code> method of <code>URLStreamHandler</code>
- * parses the string representation as if it were an <code>http</code>
- * specification. Most URL protocol families have a similar parsing. A
- * stream protocol handler for a protocol that has a different syntax must
- * override this routine.
- *
- * @param url the <code>URL</code> to receive the result of parsing the
- * spec.
- * @param spec the <code>String</code> representing the URL that must be
- * parsed.
- * @param start the character index at which to begin parsing. This is just
- * past the '<code>:</code>' (if there is one) that specifies
- * the determination of the protocol name.
- * @param limit the character position to stop parsing at. This is the end
- * of the string or the position of the "<code>#</code>"
- * character, if present. All information after the sharp sign
- * indicates an anchor.
- */
- protected void parseURL(URL url, String spec, int start, int limit) {
- // protected void parseURL(URL url, String s, int i, int j)
-
- String file = null;
- String ref = null;
-
- // split the reference and file part
- int hash = spec.indexOf('#', limit);
- boolean emptyFile = hash == start;
- if (hash > -1) {
- ref = spec.substring(hash + 1, spec.length());
- if (emptyFile) {
- file = url.getFile();
- }
- }
-
- boolean isSpecAbsolute = spec.substring(0, 4).equalsIgnoreCase("jar:");
- spec = spec.substring(start, limit);
-
- if (isSpecAbsolute) {
-
- // get the file part from the absolute spec
- file = parseAbsoluteSpec(spec);
-
- } else if (!emptyFile) {
-
- // build the file part from the url and relative spec
- file = parseContextSpec(url, spec);
-
- // split archive and entry names
- int bangSlash = indexOfBangSlash(file);
- String archive = file.substring(0, bangSlash);
- String entry = file.substring(bangSlash);
-
- // collapse /../, /./ and //
- entry = canonizeString(entry);
-
- file = archive + entry;
-
- }
-
- setURL(url, "jar", "", -1, null, null, file, null, ref);
- }
-
- //---------- internal -----------------------------------------------------
-
- /**
- * Finds the position of the bang slash (!/) in the file part of the URL.
- */
- static int indexOfBangSlash(String file) {
-
- for (int i = file.length(); (i = file.lastIndexOf('!', i)) != -1; i--) {
- if (i != file.length() - 1 && file.charAt(i + 1) == '/') {
- return i + 1;
- }
- }
-
- return -1;
- }
-
- /**
- * Parses the URL spec and checks whether it contains a bang slash and
- * whether it would get a valid URL. Returns the same value if everything is
- * fine else a <code>NullPointerException</code> is thrown.
- *
- * @param spec The URL specification to check.
- * @return The <code>spec</code> if everything is ok.
- * @throws NullPointerException if either no bang slash is contained in the
- * spec or if the spec without the bang slash part would not be
- * a valid URL.
- */
- private String parseAbsoluteSpec(String spec) {
-
- // find and check bang slash
- int bangSlash = indexOfBangSlash(spec);
- if (bangSlash == -1) {
- throw new NullPointerException("no !/ in spec");
- }
-
- try {
-
- String testSpec = spec.substring(0, bangSlash - 1);
- URI uri = new URI(testSpec);
-
- // verify the scheme is the JCR Repository Scheme
- if (!URLFactory.REPOSITORY_SCHEME.equals(uri.getScheme())) {
- throw new URISyntaxException(testSpec,
- "Unsupported Scheme " + uri.getScheme(), 0);
- }
-
- } catch (URISyntaxException use) {
-
- throw new NullPointerException("invalid url: " + spec + " (" + use
- + ")");
-
- }
-
- return spec;
- }
-
- /**
- * Merges the specification and the file part of the URL respecting the bang
- * slashes. If the specification starts with a slash, it is regarded as a
- * complete path of a archive entry and replaces an existing archive entry
- * specification in the url. Examples :<br>
- * <table>
- * <tr>
- * <th align="left">file
- * <th align="left">spec
- * <th align="left">result
- * <tr>
- * <td>/some/file/path.jar!/
- * <td>/some/entry/path
- * <td>/some/file/path.jar!/some/entry/path
- * <tr>
- * <td>/some/file/path.jar!/some/default
- * <td>/some/entry/path
- * <td>/some/file/path.jar!/some/entry/path </table>
- * <p>
- * If the specification is not absolutes it replaces the last file name part
- * if the file name does not end with a slash. Examples :<br>
- * <table>
- * <tr>
- * <th align="left">file
- * <th align="left">spec
- * <th align="left">result
- * <tr>
- * <td>/some/file/path.jar!/
- * <td>/some/entry/path
- * <td>/some/file/path.jar!/some/entry/path
- * <tr>
- * <td>/some/file/path.jar!/some/default
- * <td>/some/entry/path
- * <td>/some/file/path.jar!/some/entry/path </table>
- *
- * @param url The <code>URL</code> whose file part is used
- * @param spec The specification to merge with the file part
- * @throws NullPointerException If the specification starts with a slash and
- * the URL does not contain a slash bang or if the specification
- * does not start with a slash and the file part of the URL does
- * is not an absolute file path.
- */
- private String parseContextSpec(URL url, String spec) {
-
- // spec is relative to this file
- String file = url.getFile();
-
- // if the spec is absolute path, it is an absolute entry spec
- if (spec.startsWith("/")) {
-
- // assert the bang slash in the original URL
- int bangSlash = indexOfBangSlash(file);
- if (bangSlash == -1) {
- throw new NullPointerException("malformed context url:" + url
- + ": no !/");
- }
-
- // remove bang slash part from the original file
- file = file.substring(0, bangSlash);
- }
-
- // if the file is not a directory and spec is a relative file path
- if (!file.endsWith("/") && !spec.startsWith("/")) {
-
- // find the start of the file name in the url file path
- int lastSlash = file.lastIndexOf('/');
- if (lastSlash == -1) {
- throw new NullPointerException("malformed context url:" + url);
- }
-
- // cut off the file name from the URL file path
- file = file.substring(0, lastSlash + 1);
- }
-
- // concat file part and the spec now
- return file + spec;
- }
-
- public String canonizeString(String s) {
- int i = 0;
- int k = s.length();
- while ((i = s.indexOf("/../")) >= 0)
- if ((k = s.lastIndexOf('/', i - 1)) >= 0)
- s = s.substring(0, k) + s.substring(i + 3);
- else
- s = s.substring(i + 3);
- while ((i = s.indexOf("/./")) >= 0)
- s = s.substring(0, i) + s.substring(i + 2);
- while (s.endsWith("/..")) {
- int j = s.indexOf("/..");
- int l;
- if ((l = s.lastIndexOf('/', j - 1)) >= 0)
- s = s.substring(0, l + 1);
- else
- s = s.substring(0, j);
- }
- if (s.endsWith("/.")) s = s.substring(0, s.length() - 1);
- return s;
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRURLConnection.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRURLConnection.java
deleted file mode 100644
index d9d7149..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRURLConnection.java
+++ /dev/null
@@ -1,773 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.net;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.classloader.Util;
-
-
-/**
- * The <code>JCRURLConnection</code> is the <code>URLConnection</code>
- * implementation to access the data addressed by a JCR Repository URL.
- * <p>
- * As the primary use of a <code>URLConnection</code> and thus the
- * <code>JCRURLConnection</code> is to provide access to the content of a
- * resource identified by the URL, it is the primary task of this class to
- * identify and access a repository <code>Property</code> based on the URL. This
- * main task is executed in the {@link #connect()} method.
- * <p>
- * Basically the guideposts to access content from a JCR Repository URl are
- * the following:
- * <ul>
- * <li>The URL must ultimately resolve to a repository property to provide
- * content.
- * <li>If the URL itself is the path to a property, that property is used to
- * provide the content.
- * <li>If the URL is a path to a node, the primary item chain starting with
- * this node is followed until no further primary items exist. If the
- * final item is a property, that property is used to provide the content.
- * <li>If neither of the above methods resolve to a property, the
- * {@link #connect()} fails and access to the content is not possible.
- * </ul>
- * <p>
- * After having connected the property is available through the
- * {@link #getProperty()} method. Other methods exist to retrieve repository
- * related information defined when creating the URL: {@link #getSession()} to
- * retrieve the session of the URL, {@link #getPath()} to retrieve the path
- * with which the URL was created and {@link #getItem()} to retrieve the item
- * with which the URL was created. The results of calling {@link #getProperty()}
- * and {@link #getItem()} will be the same if the URL directly addressed the
- * property. If the URL addressed the node whose primary item chain ultimately
- * resolved to the property, the {@link #getItem()} will return the node and
- * {@link #getProperty()} will return the resolved property.
- * <p>
- * A note on the <code>InputStream</code> available from
- * {@link #getInputStream()}: Unlike other implementations - for example
- * for <code>file:</code> or <code>http:</code> URLs - which return the same
- * stream on each call, this implementation returns a new stream on each
- * invocation.
- * <p>
- * The following header fields are implemented by this class:
- * <dl>
- * <dt><code>Content-Length</code>
- * <dd>The size of the content is filled from the <code>Property.getLength()</code>
- * method, which returns the size in bytes of the property's value for
- * binary values and the number of characters used for the string
- * representation of the value for all other value types.
- *
- * <dt><code>Content-Type</code>
- * <dd>If the property is a child of a <code>nt:resource</code> node, the
- * content type is retrieved from the <code>jcr:mimeType</code>
- * property of the parent node. If the parent node is not a
- * <code>nt:resource</code>, the <code>guessContentTypeFromName</code>
- * method is called on the {@link #getPath() path}. If this does not
- * yield a content type, it is set to <code>application/octet-stream</code>
- * for binary properties and to <code>text/plain</code> for other types.
- *
- * <dt><code>Content-Enconding</code>
- * <dd>If the property is a child of a <code>nt:resource</code> node, the
- * content encoding is retrieved from the <code>jcr:econding</code>
- * property of the parent node. If the <code>jcr:encoding</code> property
- * is not set, this header field remains undefined (aka <code>null</code>).
- *
- * <dt><code>Last-Modified</code>
- * <dd>If the property is a child of a <code>nt:resource</code> node, the
- * last modified type is retrieved from the <code>jcr:lastModified</code>
- * property of the parent node. If the parent node is not a
- * <code>nt:resource</code>, the last modification time is set to zero.
- * </dl>
- * <p>
- * This class is not intended to be subclassed or instantiated by clients.
- *
- * @author Felix Meschberger
- */
-public class JCRURLConnection extends URLConnection {
-
- /** Default logging */
- private static final Log log = LogFactory.getLog(JCRURLConnection.class);
-
- /**
- * The name of the header containing the content size (value is
- * "content-length").
- */
- protected static final String CONTENT_LENGTH = "content-length";
-
- /**
- * The name of the header containing the MIME type of the content (value is
- * "content-type").
- */
- protected static final String CONTENT_TYPE = "content-type";
-
- /**
- * The name of the header containing the content encoding (value is
- * "content-encoding").
- */
- protected static final String CONTENT_ENCODING = "content-encoding";
-
- /**
- * The name of the header containing the last modification time stamp of
- * the content (value is "last-modified").
- */
- protected static final String LAST_MODIFIED = "last-modified";
-
- /**
- * The default content type name for binary properties accessed by this
- * connection (value is "application/octet-stream").
- * @see #connect()
- */
- protected static final String APPLICATION_OCTET = "application/octet-stream";
-
- /**
- * The default content type name for non-binary properties accessed by this
- * connection (value is "text/plain").
- * @see #connect()
- */
- protected static final String TEXT_PLAIN = "text/plain";
-
- /**
- * The handler associated with the URL of this connection. This handler
- * provides the connection with access to the repository and the item
- * underlying the URL.
- */
- private final JCRURLHandler handler;
-
- /**
- * The {@link FileParts} encapsulating the repository name, workspace name,
- * item path and optional archive entry path contained in the file part
- * of the URL. This field is set on-demand by the {@link #getFileParts()}
- * method.
- *
- * @see #getFileParts()
- */
- private FileParts fileParts;
-
- /**
- * The <code>Item</code> addressed by the path of this connection's URL.
- * This field is set on-demand by the {@link #getItem()} method.
- *
- * @see #getItem()
- */
- private Item item;
-
- /**
- * The <code>Property</code> associated with the URLConnection. The field
- * is only set after the connection has been successfully opened.
- *
- * @see #getProperty()
- * @see #connect()
- */
- private Property property;
-
- /**
- * The (guessed) content type of the data. Currently the content type is
- * guessed based on the path name of the page or the binary attribute of the
- * atom.
- * <p>
- * Implementations are free to decide, how to define the content type. But
- * they are required to set the type in the {@link #connect(Ticket)}method.
- *
- * @see #getContentType()
- * @see #connect()
- */
- private String contentType;
-
- /**
- * The (guessed) content encoding of the data. Currently the content type is
- * guessed based on the path name of the page or the binary attribute of the
- * atom.
- * <p>
- * Implementations are free to decide, how to define the content type. But
- * they are required to set the type in the {@link #connect(Ticket)}method.
- *
- * @see #getContentEncoding()
- * @see #connect()
- */
- private String contentEncoding;
-
- /**
- * The content lentgh of the data, which is the size field of the atom
- * status information of the base atom.
- * <p>
- * Implementations are free to decide, how to define the content length. But
- * they are required to set the type in the {@link #connect(Ticket)}method.
- *
- * @see #getContentLength()
- * @see #connect()
- */
- private int contentLength;
-
- /**
- * The last modification time in milliseconds since the epoch (1970/01/01)
- * <p>
- * Implementations are free to decide, how to define the last modification
- * time. But they are required to set the type in the
- * {@link #connect(Ticket)}method.
- *
- * @see #getLastModified()
- * @see #connect()
- */
- private long lastModified;
-
- /**
- * Creates an instance of this class for the given <code>url</code>
- * supported by the <code>handler</code>.
- *
- * @param url The URL to base the connection on.
- * @param handler The URL handler supporting the given URL.
- */
- JCRURLConnection(URL url, JCRURLHandler handler) {
- super(url);
- this.handler = handler;
- }
-
- /**
- * Returns the current session of URL.
- * <p>
- * Calling this method does not require this connection being connected.
- */
- public Session getSession() {
- return handler.getSession();
- }
-
- /**
- * Returns the path to the repository item underlying the URL of this
- * connection.
- * <p>
- * Calling this method does not require this connection being connected.
- */
- public String getPath() {
- return getFileParts().getPath();
- }
-
- /**
- * Returns the repository item underlying the URL of this connection
- * retrieved through the path set on the URL.
- * <p>
- * Calling this method does not require this connection being connected.
- *
- * @throws IOException If the item has to be retrieved from the repository
- * <code>Session</code> of this connection and an error occurrs. The
- * cause of the exception will refer to the exception thrown from the
- * repository. If the path addresses a non-existing item, the cause
- * will be a <code>PathNotFoundException</code>.
- */
- public Item getItem() throws IOException {
- if (item == null) {
- try {
- item = getSession().getItem(getPath());
- } catch (RepositoryException re) {
- throw failure("getItem", re.toString(), re);
- }
- }
-
- return item;
- }
-
- /**
- * Returns the repository <code>Property</code> providing the contents of
- * this connection.
- * <p>
- * Calling this method forces the connection to be opened by calling the
- * {@link #connect()} method.
- *
- * @throws IOException May be thrown by the {@link #connect()} method called
- * by this method.
- *
- * @see #connect()
- */
- public Property getProperty() throws IOException {
- // connect to set the property value
- connect();
-
- return property;
- }
-
- //---------- URLConnection overwrites -------------------------------------
-
- /**
- * Connects to the URL setting the header fields and preparing for the
- * {@link #getProperty()} and {@link #getInputStream()} methods.
- * <p>
- * The following algorithm is applied:
- * <ol>
- * <li>The repository item is retrieved from the URL's
- * <code>URLHandler</code>.
- * <li>If the item is a node, the <code>getPrimaryItem</code> method is
- * called on that node. If the node has no primary item, the connection
- * fails.
- * <li>If the item - either from the handler or after calling
- * <code>getPrimaryItem</code> is still a node, this method fails
- * because a <code>Property</code> is required for a successfull
- * connection.
- * <li>If the property found above is a multi-valued property, connection
- * fails, because multi-valued properties are not currently supported.
- * <li>The content length header field is set from the property length
- * (<code>Property.getLength())</code>).
- * <li>If the property's parent node is of node type <code>nt:resource</code>,
- * the header fields for the content type, content encoding and last
- * modification time are set from the <code>jcr:mimeType</code>,
- * <code>jcr:encoding</code>, and <code>jcr:lastModification</code>
- * properties. Otherwise the content encoding field is set to
- * <code>null</code> and the last modification time is set to zero.
- * The content type field is guessed from the name of the URL item.
- * If the content type cannot be guessed, it is set to
- * <code>application/octet-stream</code> if the property is of binary
- * type or <code>text/plain</code> otherwise.
- * </ol>
- * <p>
- * When this method successfully returns, this connection is considered
- * connected. In case of an exception thrown, the connection is not
- * connected.
- *
- * @throws IOException if an error occurrs retrieving the data property or
- * any of the header field value properties or if any other errors
- * occurrs. Any cuasing exception is set as the cause of this
- * exception.
- */
- public synchronized void connect() throws IOException {
- // todo: The ContentBus URL must also contain version information on
- if (!connected) {
-
- // Get hold of the data
- try {
- // resolve the URLs item to a property
- Property property = Util.getProperty(getItem());
- if (property == null) {
- throw failure("connect",
- "Multivalue property not supported", null);
- }
-
- // values to set later
- String contentType;
- String contentEncoding = null; // no defined content encoding
- int contentLength = (int) property.getLength();
- long lastModified;
-
- Node parent = property.getParent();
- if (parent.isNodeType("nt:resource")) {
- lastModified = parent.getProperty("jcr:lastModified").getLong();
- contentType = parent.getProperty("jcr:mimeType").getString();
- if (parent.hasProperty("jcr:encoding")) {
- contentEncoding =
- parent.getProperty("jcr:encoding").getString();
- }
- } else {
- lastModified = 0;
- contentType = guessContentTypeFromName(getItem().getName());
- if (contentType == null) {
- contentType = (property.getType() == PropertyType.BINARY)
- ? APPLICATION_OCTET
- : TEXT_PLAIN;
- }
- }
-
- log.debug("connect: Using atom '" + property.getPath() +
- "' with content type '" + contentType + "' for " +
- String.valueOf(contentLength) + " bytes");
-
- // set the fields
- setProperty(property);
- setContentType(contentType);
- setContentEncoding(contentEncoding);
- setContentLength(contentLength);
- setLastModified(lastModified);
-
- // mark connection open
- connected = true;
-
- } catch (RepositoryException re) {
- throw failure("connect", re.toString(), re);
- }
- }
- }
-
- /**
- * Returns an input stream that reads from this open connection.
- * <p>
- * <b>NOTES:</b>
- * <ul>
- * <li>Each call to this method returns a new <code>InputStream</code>.
- * <li>Do not forget to close the return stream when not used anymore for
- * the system to be able to free resources.
- * </ul>
- * <p>
- * Calling this method implicitly calls {@link #connect()} to ensure the
- * connection is open.
- *
- * @throws IOException if an error occurrs opening the connection through
- * {@link #connect()} or creating the <code>InputStream</code> on the
- * repository <code>Property</code>.
- *
- * @see #connect()
- */
- public InputStream getInputStream() throws IOException {
- try {
- return getProperty().getStream();
- } catch (RepositoryException re) {
- throw failure("getInputStream", re.toString(), re);
- }
- }
-
- /**
- * Gets the named header field. This implementation only supports the
- * Content-Type, Content-Encoding, Content-Length and Last-Modified header
- * fields. All other names return <code>null</code>.
- * <p>
- * Calling this method implicitly calls {@link #connect()} to ensure the
- * connection is open.
- *
- * @param s The name of the header field value to return.
- *
- * @return The corresponding value or <code>null</code> if not one of the
- * supported fields or the named field's value cannot be retrieved
- * from the data source.
- *
- * @see #connect()
- */
- public String getHeaderField(String s) {
- try {
- connect();
- if (CONTENT_LENGTH.equalsIgnoreCase(s)) {
- return String.valueOf(contentLength);
- } else if (CONTENT_TYPE.equalsIgnoreCase(s)) {
- return contentType;
- } else if (LAST_MODIFIED.equalsIgnoreCase(s)) {
- return String.valueOf(lastModified);
- } else if (CONTENT_ENCODING.equalsIgnoreCase(s)) {
- return contentEncoding;
- }
- } catch (IOException ioe) {
- log.info("getHeaderField: Problem connecting: " + ioe.toString());
- log.debug("dump", ioe);
- }
-
- return null;
- }
-
- /**
- * Get the header field with the given index. As with
- * {@link #getHeaderField(String)} only Content-Length, Content-Type,
- * Content-Encoding, and Last-Modified are supported. All indexes other
- * than 0, 1, 2 or 3 will return <code>null</code>.
- * <p>
- * Calling this method implicitly calls {@link #connect()} to ensure the
- * connection is open.
- *
- * @param i The index of the header field value to return.
- *
- * @return The corresponding value or <code>null</code> if not one of the
- * supported fields or the known field's value cannot be retrieved
- * from the data source.
- *
- * @see #connect()
- */
- public String getHeaderField(int i) {
- try {
- connect();
- if (i == 0) {
- return String.valueOf(contentLength);
- } else if (i == 1) {
- return contentType;
- } else if (i == 2) {
- return String.valueOf(lastModified);
- } else if (i == 3) {
- return contentEncoding;
- }
- } catch (IOException ioe) {
- log.info("getHeaderField: Problem connecting: " + ioe.toString());
- log.debug("dump", ioe);
- }
-
- return null;
- }
-
- /**
- * Get the name of the header field with the given index. As with
- * {@link #getHeaderField(String)} only Content-Length, Content-Type,
- * Content-Encoding and Last-Modified are supported. All indexes other than
- * 0, 1, 2 or 3 will return <code>null</code>.
- * <p>
- * Calling this method implicitly calls {@link #connect()} to ensure the
- * connection is open.
- *
- * @param i The index of the header field name to return.
- * @return The corresponding name or <code>null</code> if not one of the
- * supported fields.
- *
- * @see #connect()
- */
- public String getHeaderFieldKey(int i) {
- try {
- connect();
- if (i == 0) {
- return CONTENT_LENGTH;
- } else if (i == 1) {
- return CONTENT_TYPE;
- } else if (i == 2) {
- return LAST_MODIFIED;
- } else if (i == 3) {
- return CONTENT_ENCODING;
- }
- } catch (IOException ioe) {
- log
- .info("getHeaderFieldKey: Problem connecting: "
- + ioe.toString());
- log.debug("dump", ioe);
- }
- return null;
- }
-
- /**
- * Returns an unmodifiable map of all header fields. Each entry is indexed
- * with a string key naming the field. The entry's value is an unmodifiable
- * list of the string values of the respective header field.
- * <p>
- * Calling this method implicitly calls {@link #connect()} to ensure the
- * connection is open.
- *
- * @return An unmodifiable map of header fields and their values. The map
- * will be empty if an error occurrs connecting through
- * {@link #connect()}.
- *
- * @see #connect()
- */
- public Map getHeaderFields() {
- Map fieldMap = new HashMap();
-
- try {
- connect();
- fieldMap.put(CONTENT_LENGTH, toList(String.valueOf(contentLength)));
- fieldMap.put(CONTENT_TYPE, toList(contentType));
- fieldMap.put(LAST_MODIFIED, toList(String.valueOf(lastModified)));
-
- // only include if not null))
- if (contentEncoding != null) {
- fieldMap.put(CONTENT_ENCODING, toList(contentEncoding));
- }
- } catch (IOException ioe) {
- log.info("getHeaderFields: Problem connecting: " + ioe.toString());
- log.debug("dump", ioe);
- }
-
- return Collections.unmodifiableMap(fieldMap);
- }
-
- /**
- * Returns the content type of the data as a string. This is just a
- * perfomance convenience overwrite of the base class implementation.
- * <p>
- * Calling this method implicitly calls {@link #connect()} to ensure the
- * connection is open.
- *
- * @return The content length of the data or <code>null</code> if the
- * content type cannot be derived from the data source.
- *
- * @see #connect()
- */
- public String getContentType() {
- try {
- connect();
- return contentType;
- } catch (IOException ioe) {
- log.info("getContentType: Problem connecting: " + ioe.toString());
- log.debug("dump", ioe);
- }
-
- return null;
- }
-
- /**
- * Returns the content encoding of the data as a string. This is just a
- * perfomance convenience overwrite of the base class implementation.
- * <p>
- * Calling this method implicitly calls {@link #connect()} to ensure the
- * connection is open.
- *
- * @return The content encoding of the data or <code>null</code> if the
- * content encoding cannot be derived from the data source.
- *
- * @see #connect()
- */
- public String getContentEncoding() {
- try {
- connect();
- return contentEncoding;
- } catch (IOException ioe) {
- log.info("getContentEncoding: Problem connecting: " + ioe.toString());
- log.debug("dump", ioe);
- }
-
- return null;
- }
-
- /**
- * Returns the content length of the data as an number. This is just a
- * perfomance convenience overwrite of the base class implementation.
- * <p>
- * Calling this method implicitly calls {@link #connect()} to ensure the
- * connection is open.
- *
- * @return The content length of the data or -1 if the content length cannot
- * be derived from the data source.
- *
- * @see #connect()
- */
- public int getContentLength() {
- try {
- connect();
- return contentLength;
- } catch (IOException ioe) {
- log.info("getContentLength: Problem connecting: " + ioe.toString());
- log.debug("dump", ioe);
- }
- return -1;
- }
-
- /**
- * Returns the value of the <code>last-modified</code> header field. The
- * result is the number of milliseconds since January 1, 1970 GMT.
- * <p>
- * Calling this method implicitly calls {@link #connect()} to ensure the
- * connection is open.
- *
- * @return the date the resource referenced by this
- * <code>URLConnection</code> was last modified, or -1 if not
- * known.
- *
- * @see #connect()
- */
- public long getLastModified() {
- try {
- connect();
- return lastModified;
- } catch (IOException ioe) {
- log.info("getLastModified: Problem connecting: " + ioe.toString());
- log.debug("dump", ioe);
- }
- return -1;
- }
-
- //---------- implementation helpers ----------------------------------------
-
- /**
- * Returns the URL handler of the URL of this connection.
- */
- protected JCRURLHandler getHandler() {
- return handler;
- }
-
- /**
- * Returns the {@link FileParts} object which contains the decomposed file
- * part of this connection's URL.
- */
- FileParts getFileParts() {
- if (fileParts == null) {
- fileParts = new FileParts(getURL().getFile());
- }
-
- return fileParts;
- }
-
- /**
- * @param contentEncoding The contentEncoding to set.
- */
- protected void setContentEncoding(String contentEncoding) {
- this.contentEncoding = contentEncoding;
- }
-
- /**
- * @param contentLength The contentLength to set.
- */
- protected void setContentLength(int contentLength) {
- this.contentLength = contentLength;
- }
-
- /**
- * @param contentType The contentType to set.
- */
- protected void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- /**
- * @param lastModified The lastModified to set.
- */
- protected void setLastModified(long lastModified) {
- this.lastModified = lastModified;
- }
-
- /**
- * @param property The property to set.
- */
- protected void setProperty(Property property) {
- this.property = property;
- }
-
- //---------- internal -----------------------------------------------------
-
- /**
- * Logs the message and returns an IOException to be thrown by the caller.
- * The log message contains the caller name, the external URL form and the
- * message while the IOException is only based on the external URL form and
- * the message given.
- *
- * @param method The method in which the error occurred. This is used for
- * logging.
- * @param message The message to log and set in the exception
- * @param cause The cause of failure. May be <code>null</code>.
- *
- * @return The IOException the caller may throw.
- */
- protected IOException failure(String method, String message, Throwable cause) {
- log.info(method + ": URL: " + url.toExternalForm() + ", Reason: "
- + message);
-
- if (cause != null) {
- log.debug("dump", cause);
- }
-
- IOException ioe = new IOException(url.toExternalForm() + ": " + message);
- ioe.initCause(cause);
- return ioe;
- }
-
- /**
- * Returns an unmodifiable list containing just the given string value.
- */
- private List toList(String value) {
- String[] values = { value };
- List valueList = Arrays.asList(values);
- return Collections.unmodifiableList(valueList);
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRURLHandler.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRURLHandler.java
deleted file mode 100644
index 97d6613..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/JCRURLHandler.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.net;
-
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-import javax.jcr.Session;
-
-/**
- * The <code>JCRURLHandler</code> is the <code>URLStreamHandler</code> for
- * JCR Repository URLs identified by the scheme <code>jcr</code>.
- * <p>
- * JCR Repository URLs have not been standardized yet and may only be created
- * in the context of an existing <code>Session</code>. Therefore this handler
- * is not globally available and JCR Repository URLs may only be created through
- * the factory methods in the {@link org.apache.jackrabbit.net.URLFactory}
- * class.
- * <p>
- * This class is not intended to be subclassed or instantiated by clients.
- *
- * @author Felix Meschberger
- *
- * @see org.apache.jackrabbit.net.JCRURLConnection
- * @see org.apache.jackrabbit.net.URLFactory
- * @see org.apache.jackrabbit.net.URLFactory#createURL(Session, String)
- */
-class JCRURLHandler extends URLStreamHandler {
-
- /**
- * The session used to create this handler, which is also used to open
- * the connection object.
- *
- * @see #getSession()
- */
- private final Session session;
-
- /**
- * Creates a new instance of the <code>JCRURLHandler</code> with the
- * given session.
- *
- * @param session The <code>Session</code> supporting this handler. This
- * must not be <code>null</code>.
- *
- * @throws NullPointerException if <code>session</code> is <code>null</code>.
- */
- JCRURLHandler(Session session) {
- if (session == null) {
- throw new NullPointerException("session");
- }
-
- this.session = session;
- }
-
- /**
- * Returns the session supporting this handler.
- */
- Session getSession() {
- return session;
- }
-
- //---------- URLStreamHandler abstracts ------------------------------------
-
- /**
- * Gets a connection object to connect to an JCR Repository URL.
- *
- * @param url The JCR Repository URL to connect to.
- *
- * @return An instance of the {@link JCRURLConnection} class.
- *
- * @see JCRURLConnection
- */
- protected URLConnection openConnection(URL url) {
- return new JCRURLConnection(url, this);
- }
-
- /**
- * Checks the new <code>authority</code> and <code>path</code> before
- * actually setting the values on the url calling the base class
- * implementation.
- * <p>
- * We check the authority to not have been modified from the original URL,
- * as the authority is dependent on the repository <code>Session</code> on
- * which this handler is based and which was used to create the original
- * URL. Likewise the repository and workspace name parts of the path must
- * not have changed.
- *
- * @param u the URL to modify.
- * @param protocol the protocol name.
- * @param host the remote host value for the URL.
- * @param port the port on the remote machine.
- * @param authority the authority part for the URL.
- * @param userInfo the userInfo part of the URL.
- * @param path the path component of the URL.
- * @param query the query part for the URL.
- * @param ref the reference.
- *
- * @throws IllegalArgumentException if the authority or the repository name
- * or workspace name parts of the path has changed.
- */
- protected void setURL(URL u, String protocol, String host, int port,
- String authority, String userInfo, String path, String query, String ref) {
-
- // check for authority
- if (u.getAuthority() != authority) {
- if (u.getAuthority() == null) {
- if (authority != null) {
- throw new IllegalArgumentException("Authority " +
- authority + " not supported by this handler");
- }
- } else if (!u.getAuthority().equals(authority)) {
- throw new IllegalArgumentException("Authority " +
- authority + " not supported by this handler");
- }
- }
-
- // check for repository and/or workspace modifications
- FileParts newParts = new FileParts(path);
- if (!"_".equals(newParts.getRepository())) {
- throw new IllegalArgumentException("Repository " +
- newParts.getRepository() + " not supported by this handler");
- }
- if (!session.getWorkspace().getName().equals(newParts.getWorkspace())) {
- throw new IllegalArgumentException("Workspace " +
- newParts.getWorkspace() + " not supported by this handler");
- }
-
- // finally set the new values on the URL
- super.setURL(u, protocol, host, port, authority, userInfo, path, query,
- ref);
- }
-}
diff --git a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/URLFactory.java b/contrib/classloader/src/main/java/org/apache/jackrabbit/net/URLFactory.java
deleted file mode 100644
index a285489..0000000
--- a/contrib/classloader/src/main/java/org/apache/jackrabbit/net/URLFactory.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.net;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.jcr.Session;
-
-/**
- * The <code>URLFactory</code> class provides factory methods for creating
- * JCR Repository and JCRJar URLs.
- * <p>
- * This class is not intended to be subclassed or instantiated by clients.
- *
- * @author Felix Meschberger
- */
-public final class URLFactory {
-
- /**
- * The scheme for JCR Repository URLs (value is "jcr").
- */
- public static final String REPOSITORY_SCHEME = "jcr";
-
- /**
- * The scheme for JCRJar URLs (value is "jar").
- */
- public static final String REPOSITORY_JAR_SCHEME = "jar";
-
- /** Private default constructor, not to be instantiated */
- private URLFactory() {
- }
-
- /**
- * Creates a new JCR Repository URL for the given session and item path.
- *
- * @param session The repository session providing access to the item.
- * @param path The absolute path to the item. This must be an absolute
- * path with a leading slash character. If this is <code>null</code>
- * the root node path - <code>/</code> - is assumed.
- *
- * @return The JCR Repository URL
- *
- * @throws MalformedURLException If an error occurrs creating the
- * <code>URL</code> instance.
- */
- public static URL createURL(Session session, String path)
- throws MalformedURLException {
-
- return new URL(REPOSITORY_SCHEME, "", -1,
- new FileParts(session, path, null).toString(),
- new JCRURLHandler(session));
- }
-
- /**
- * Creates a new JCRJar URL for the given session, archive and entry.
- *
- * @param session The repository session providing access to the archive.
- * @param path The absolute path to the archive. This must either be the
- * property containing the archive or an item which resolves to such
- * a property through its primary item chain. This must be an absolute
- * path with a leading slash character. If this is <code>null</code>
- * the root node path - <code>/</code> - is assumed.
- * @param entry The entry within the archive. If <code>null</code>, the URL
- * provides access to the archive itself.
- *
- * @return The JCRJar URL
- *
- * @throws MalformedURLException If an error occurrs creating the
- * <code>URL</code> instance.
- */
- public static URL createJarURL(Session session, String path, String entry)
- throws MalformedURLException {
-
- JCRJarURLHandler handler = new JCRJarURLHandler(session);
- String file = createURL(session, path).toExternalForm();
-
- // append entry spec if not null
- if (entry != null) {
- file += "!/" + entry;
- }
-
- return new URL(REPOSITORY_JAR_SCHEME, "", -1, file, handler);
- }
-}
diff --git a/contrib/classloader/src/main/resources/org/apache/jackrabbit/classloader/type.cnd b/contrib/classloader/src/main/resources/org/apache/jackrabbit/classloader/type.cnd
deleted file mode 100644
index 182efe9..0000000
--- a/contrib/classloader/src/main/resources/org/apache/jackrabbit/classloader/type.cnd
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * The "type.cnd" file contains the (mixin) node type definition which is
- * required by the ExpandingArchiveClassPathEntry class, which supports
- * on-demand unpacking of JAR/ZIP archives for enhanced performances of class
- * path access.
- *
- * NOTE: This file is read through a reader with encoding "ISO-8859-1".
- *
- * @author Felix Meschberger
- * @version $Rev:$, $Date:$
- * @see org.apache.jackrabbit.classloader.ExpandingArchiveClassPathEntry
- * @see org.apache.jackrabbit.classloader.NodeTypeSupport
- */
-
-// The "rep" namespace is expected to be present in the repository.
-// For Jackrabbit based repositories, this is true, for other repositories, we
-// present the namespace declaration here.
-// This declaration is inline with the Jackrabbit internal namespace declaration
-// for the "rep" namespace.
-<rep = 'internal'>
-<nt = 'http://www.jcp.org/jcr/nt/1.0'>
-
-// The node containing the JAR/ZIP archive is tagged with this mixin node
-// type to singal, that the archive has been unpacked into the subtree
-// rooted at the "rep:jarContents" child node.
-[rep:jarFile] mixin
-
-// The "rep:jarExpanded" property is set to the timestamp of the date/time at
-// which the JAR/ZIP archive has been expanded.
-- rep:jarExpanded (date)
- mandatory copy
-
-// The "rep:jarContents" is the root node of the subtree into which the archive
-// is unpacked. There is no explicit type requirement for the type of this
-// node, except, that it must be allowed nodes of type "nt:file" and "nt:folder"
-// below. Unpacking the archive in the ExpandingArchiveClassPathEntry class
-// will create the "rep:jarContents" node as an nt:folder node and create files
-// and folders contained in the archive as "nt:file" and "nt:folder" nodes,
-// respectively.
-+ rep:jarContents (nt:base) = nt:folder
- mandatory copy
\ No newline at end of file
diff --git a/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ClassLoaderTestBase.java b/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ClassLoaderTestBase.java
deleted file mode 100644
index af403d9..0000000
--- a/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ClassLoaderTestBase.java
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import javax.jcr.Credentials;
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.core.RepositoryImpl;
-import org.apache.jackrabbit.core.config.RepositoryConfig;
-import org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory;
-
-import com.sun.corba.se.ActivationIDL.Repository;
-import com.sun.org.omg.CORBA.ExcDescriptionSeqHelper;
-
-/**
- * The <code>ClassLoaderTestBase</code> TODO
- *
- * @author fmeschbe
- */
-public class ClassLoaderTestBase extends TestCase {
-
- /** Logger for test cases */
- protected static final Log log =
- LogFactory.getLog("org.apache.jackrabbit.classloader.test");
-
- protected static final String WORKSPACE = "default";
- protected static final String USER = "admin";
-
- protected static final String PROVIDER_URL = "ClassLoader";
- protected static final String REPOSITORY_NAME = "ClassLoaderRepository";
-
- protected RepositoryImpl repository;
- protected Session session;
-
- private Set createdItems = new HashSet();
-
- public ClassLoaderTestBase() {
- super();
- }
-
- public ClassLoaderTestBase(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
-
- if (!"repositoryStart".equals(getName())) {
- Context ctx = getInitialContext();
- repository = (RepositoryImpl) ctx.lookup(REPOSITORY_NAME);
-
- Credentials creds = new SimpleCredentials(USER, USER.toCharArray());
- session = repository.login(creds, WORKSPACE);
- }
- }
-
- public void repositoryStart() throws Exception {
- InputStream config = getClass().getResourceAsStream("/repository.xml");
- String home = new File("cltest").getAbsolutePath();
- RepositoryConfig rc = RepositoryConfig.create(config, home);
- RepositoryImpl repository = RepositoryImpl.create(rc);
-
- try {
- Context ctx = getInitialContext();
- ctx.bind(REPOSITORY_NAME, repository);
- } catch (NamingException ne) {
- repository.shutdown();
- throw ne;
- }
- }
-
- public void repositoryStop() throws Exception {
- // this is special, logout here and clean repository
- disconnect();
-
- if (repository != null) {
- repository.shutdown();
- repository = null;
- }
-
- Context ctx = getInitialContext();
- ctx.unbind(REPOSITORY_NAME);
- }
-
- protected void tearDown() throws Exception {
- disconnect();
- repository = null;
- super.tearDown();
- }
-
- private Context getInitialContext() throws NamingException {
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY,
- DummyInitialContextFactory.class.getName());
- env.put(Context.PROVIDER_URL, PROVIDER_URL);
-
- return new InitialContext(env);
- }
-
- private void disconnect() {
- if (session != null) {
- clearRepository(session);
- session.logout();
- session = null;
- }
- }
-
- //---------- RepositoryLoader ----------------------------------------------
-
- protected void loadRepository(Session session, InputStream ins) {
- if (ins == null) {
- ins = getClass().getResourceAsStream("/preload.properties");
- if (ins == null) {
- log.warn("Cannot find preload properties /preload.properties");
- return;
- }
- }
-
- List keys = new ArrayList();
- Properties props = new Properties();
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(ins));
- while (true) {
- String line = reader.readLine();
- if (line == null) {
- break;
- }
-
- // cut off line comment
- int comment = line.indexOf('#');
- if (comment >= 0) {
- line = line.substring(0, comment);
- }
-
- // trim leading and trailing whitespace
- line = line.trim();
-
- // ignore line of empty
- if (line.length() == 0) {
- continue;
- }
-
- int sep = line.indexOf('=');
- if (sep < 0) {
- continue;
- }
-
- String key = line.substring(0, sep).trim();
-
- StringBuffer buf = new StringBuffer(line.substring(sep+1).trim());
-
- while (line.endsWith("\\")) {
- // cut off last back slash
- buf.setLength(buf.length()-1);
-
- line = reader.readLine();
- if (line == null) {
- break;
- }
-
- buf.append(line);
- }
-
- key = loadConvert(key);
- String value = loadConvert(buf.toString());
-
- keys.add(key);
- props.setProperty(key, value);
- }
- } catch (IOException ioe) {
- // ignore
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException ignore) {}
- }
-
- try {
- ins.close();
- } catch (IOException ignore) {}
- }
-
- for (Iterator ki=keys.iterator(); ki.hasNext(); ) {
- String path = (String) ki.next();
- String config = props.getProperty(path);
- StringTokenizer tokener = new StringTokenizer(config, ",");
- if (!tokener.hasMoreTokens()) {
- continue;
- }
-
- Node parent = null;
- try {
- parent = getParent(session, path);
- } catch (RepositoryException re) {
- log.warn("Cannot get parent of " + path, re);
- }
-
- if (parent == null) {
- continue;
- }
-
- try {
- String type = tokener.nextToken();
- if ("n".equalsIgnoreCase(type)) {
- loadNode(parent, getName(path), tokener);
- createdItems.add(path);
- } else if ("p".equalsIgnoreCase(type)) {
- loadProperty(parent, getName(path), tokener);
- }
- } catch (RepositoryException re) {
- log.warn("Cannot create item " + path, re);
- }
- }
-
- try {
- if (session.hasPendingChanges()) {
- session.save();
- }
- } catch (RepositoryException re) {
- log.warn("Cannot save session", re);
- } finally {
- try {
- if (session.hasPendingChanges()) {
- session.refresh(false);
- }
- } catch (RepositoryException re) {
- log.warn("Cannot even refresh the session");
- }
- }
- }
-
- protected void clearRepository(Session session) {
- for (Iterator ii=createdItems.iterator(); ii.hasNext(); ) {
- String path = (String) ii.next();
- try {
- if (!session.itemExists(path)) {
- continue;
- }
-
- session.getItem(path).remove();
- } catch (RepositoryException re) {
- log.info("Cannot remove Item " + path + ": " + re);
- }
- }
-
- try {
- session.save();
- } catch (RepositoryException re) {
- log.warn("Cannot save removals", re);
- }
-
- createdItems.clear();
- }
-
- private void loadNode(Node parent, String name,
- StringTokenizer config) throws RepositoryException {
-
- // node type
- String primaryType;
- if (config.hasMoreTokens()) {
- primaryType = config.nextToken();
- } else {
- primaryType = "nt:unstructured";
- }
-
- Node node = parent.addNode(name, primaryType);
-
- // content URL
- if (config.hasMoreTokens()) {
- String urlString = config.nextToken();
- try {
- URL url;
- if (urlString.startsWith("classpath:")) {
- urlString = urlString.substring("classpath:".length());
- url = getClass().getResource(urlString);
- } else {
- url = new URL(urlString);
- }
- URLConnection connection = url.openConnection();
- makeFileNode(node, connection);
- } catch (IOException ioe) {
- System.err.println(ioe);
- }
- }
- }
-
- private void loadProperty(Node parent, String name,
- StringTokenizer config) throws RepositoryException {
- String typeName;
- if (config.hasMoreTokens()) {
- typeName = config.nextToken();
- } else {
- typeName = "";
- }
- int type;
- try {
- type = PropertyType.valueFromName(typeName);
- } catch (IllegalArgumentException iae) {
- type = PropertyType.STRING;
- }
-
- String stringValue = ""; // default value
- if (config.hasMoreTokens()) {
- stringValue = config.nextToken();
- }
-
- /* Property prop = */ parent.setProperty(name, stringValue, type);
- }
-
- static void makeFileNode(Node node, URLConnection content)
- throws RepositoryException {
-
- Node contentNode = node.addNode("jcr:content", "nt:resource");
- InputStream ins = null;
- try {
- ins = content.getInputStream();
- contentNode.setProperty("jcr:data", ins);
- } catch (IOException ioe) {
- // ignore, but redefine content data
- contentNode.setProperty("jcr:data", "mockdata", PropertyType.BINARY);
- } finally {
- if (ins != null) {
- try {
- ins.close();
- } catch (IOException ioe) {}
- }
- }
-
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(content.getLastModified());
- contentNode.setProperty("jcr:lastModified", cal);
-
- String mimeType = content.getContentType();
- if (mimeType == null || mimeType.toLowerCase().indexOf("unknown") >= 0) {
- mimeType = URLConnection.guessContentTypeFromName(node.getName());
- }
- if (mimeType == null) {
- mimeType = "application/octet-stream";
- }
- contentNode.setProperty("jcr:mimeType", mimeType);
-
- String encoding = content.getContentEncoding();
- if (encoding != null) {
- contentNode.setProperty("jcr:encoding", encoding);
- }
- }
-
- static Node getParent(Session session, String path)
- throws RepositoryException {
-
- int lastSlash = path.lastIndexOf('/');
- if (lastSlash < 0) {
- return null;
- }
-
- String parentPath = path.substring(0, lastSlash);
- if (parentPath.length() == 0) {
- return session.getRootNode();
- }
-
- try {
- Item item = session.getItem(parentPath);
- if (item.isNode()) {
- return (Node) item;
- }
- } catch (PathNotFoundException pnfe) {
-
- // create the intermediate node as an unstructured node
- Node parent = getParent(session, parentPath);
- if (parent != null) {
- lastSlash = parentPath.lastIndexOf('/');
- if (lastSlash < 0) {
- return null;
- }
- String name = parentPath.substring(lastSlash+1);
-
- return parent.addNode(name, "nt:folder");
- }
- }
-
- return null;
- }
-
- private String getName(String path) {
- return path.substring(path.lastIndexOf('/')+1);
- }
-
- private String loadConvert(String theString) {
- char aChar;
- int len = theString.length();
- StringBuffer outBuffer = new StringBuffer(len);
-
- for (int x=0; x<len; ) {
- aChar = theString.charAt(x++);
- if (aChar == '\\') {
- aChar = theString.charAt(x++);
- if (aChar == 'u') {
- // Read the xxxx
- int value=0;
- for (int i=0; i<4; i++) {
- aChar = theString.charAt(x++);
- switch (aChar) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- value = (value << 4) + aChar - '0';
- break;
- case 'a': case 'b': case 'c':
- case 'd': case 'e': case 'f':
- value = (value << 4) + 10 + aChar - 'a';
- break;
- case 'A': case 'B': case 'C':
- case 'D': case 'E': case 'F':
- value = (value << 4) + 10 + aChar - 'A';
- break;
- default:
- throw new IllegalArgumentException(
- "Malformed \\uxxxx encoding.");
- }
- }
- outBuffer.append((char)value);
- } else {
- if (aChar == 't') aChar = '\t';
- else if (aChar == 'r') aChar = '\r';
- else if (aChar == 'n') aChar = '\n';
- else if (aChar == 'f') aChar = '\f';
- outBuffer.append(aChar);
- }
- } else
- outBuffer.append(aChar);
- }
- return outBuffer.toString();
- }
-}
diff --git a/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/DynamicRepositoryClassLoaderTest.java b/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/DynamicRepositoryClassLoaderTest.java
deleted file mode 100644
index b0b874a..0000000
--- a/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/DynamicRepositoryClassLoaderTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-
-import org.apache.log4j.Logger;
-
-import sun.tools.jar.resources.jar_fr;
-
-/**
- * The <code>DynamicRepositoryClassLoaderTest</code> class
- *
- * @author Felix Meschberger
- */
-public class DynamicRepositoryClassLoaderTest extends ClassLoaderTestBase {
-
- private static final String CLASSES_FOLDER = "/node1/classes";
- private static final String JAR_FILE = "/node1/mock.jar";
- private static final String CLASS_FILE = "org/apache/jackrabbit/classloader/Util.class";
- private static final String JAR_FILE_ENTRY = "mock/aDir/anotherFile.txt";
- private static final String NON_EXISTING_JAR_FILE_ENTRY = "mock/aDir/missingFile.txt";
-
- private static final String[] handles = { CLASSES_FOLDER, JAR_FILE };
-
- private DynamicRepositoryClassLoader loader;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- loadRepository(session, null);
-
- loader = new DynamicRepositoryClassLoader(session, handles, null);
- }
-
- protected void tearDown() throws Exception {
- if (loader != null) {
- loader.destroy();
- loader = null;
- }
-
- super.tearDown();
- }
-
- public void testGetURLs() {
- URL[] urls = loader.getURLs();
-
- /*
- * Expected URLs
- * urls[0] = jcr:/_/default/node1/classes/
- * urls[1] = jar:jcr:/_/default/node1/mock.jar
- */
-
- assertNotNull("Class loader URLs", urls);
- assertEquals("Number of class path entries", handles.length, urls.length);
- assertEquals("URL " + CLASSES_FOLDER, "jcr:/_/" + WORKSPACE + CLASSES_FOLDER + "/", urls[0].toString());
- assertEquals("URL " + JAR_FILE, "jar:jcr:/_/" + WORKSPACE + JAR_FILE, urls[1].toString());
- }
-
- public void testClassFile() {
- URL resource = loader.getResource(CLASS_FILE);
- assertNotNull("Resource " + CLASS_FILE, resource);
- }
-
- public void testJarEntry() {
- URL resource = loader.getResource(JAR_FILE_ENTRY);
- assertNotNull("Resource " + JAR_FILE_ENTRY, resource);
-
- resource = loader.getResource(NON_EXISTING_JAR_FILE_ENTRY);
- assertNull("Resource " + NON_EXISTING_JAR_FILE_ENTRY + " not expected", resource);
- }
-
- public void testResources() throws IOException {
- Enumeration res = loader.getResources(CLASS_FILE);
- assertTrue("At least one resource " + CLASS_FILE, res.hasMoreElements());
-
- URL url = (URL) res.nextElement();
- assertNotNull(url);
-
- assertFalse("Only expecint one resource " + CLASS_FILE, res.hasMoreElements());
- }
-}
diff --git a/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntryTest.java b/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntryTest.java
deleted file mode 100644
index 827bc60..0000000
--- a/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/ExpandingArchiveClassPathEntryTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Date;
-
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-
-import org.apache.jackrabbit.util.Text;
-
-public class ExpandingArchiveClassPathEntryTest extends ClassLoaderTestBase {
-
- private static final String NODE_TYPE = "rep:jarFile";
-
- private static final String ROOT = "/test";
- private static final String JAR_PATH = ROOT + "/mock.jar";
-
- protected void setUp() throws Exception {
- super.setUp();
-
- if (session.itemExists(ROOT)) {
- log.info("Removing old test root entry");
- session.getItem(ROOT).remove();
- session.save();
- }
- }
-
- protected void tearDown() throws Exception {
- if (session.itemExists(ROOT)) {
- session.getItem(ROOT).remove();
- session.save();
- }
-
- super.tearDown();
- }
-
- public void testCanExpand() throws RepositoryException {
- // check for the node type - may or may not exist
- try {
- session.getWorkspace().getNodeTypeManager().getNodeType(NODE_TYPE);
- log.info("Node type " + NODE_TYPE + " already registered");
- } catch (NoSuchNodeTypeException nsoe) {
- // expected behaviour
- log.info("Node type " + NODE_TYPE + " not registered yet");
- }
-
- boolean canExpand = ExpandingArchiveClassPathEntry.canExpandArchives(session);
- assertTrue("Expecting archives to be expandable", canExpand);
-
- // check for the node type - must exist
- session.getWorkspace().getNodeTypeManager().getNodeType(NODE_TYPE);
- log.info("Node type " + NODE_TYPE + " already registered");
- }
-
- public void testExpand() throws IOException, RepositoryException {
- URL url = getClass().getResource("/mock.jar");
-
- Node parent = getParent(session, JAR_PATH);
- Node jar = parent.addNode(Text.getName(JAR_PATH), "nt:file");
- makeFileNode(jar, url.openConnection());
- session.save();
-
- Property prop = Util.getProperty(session.getItem(JAR_PATH));
-
- ExpandingArchiveClassPathEntry pe =
- new ExpandingArchiveClassPathEntry(prop, JAR_PATH);
-
- ClassLoaderResource res = pe.getResource("mock/aDir/anotherFile.txt");
- assertNotNull("anotherFile.txt expected to exist", res);
-
- url = res.getURL();
- assertNotNull("anotherFile's URL missing", url);
-
- String data = new String(res.getBytes());
- log.info("URL : " + url);
- log.info("Path: " + res.getPath());
- log.info("Prop: " + res.getProperty().getPath());
- log.info("Data: '" + data + "'");
- log.info("Size: " + res.getContentLength() + " (bytes: " + res.getBytes().length + ")");
- log.info("Time: " + new Date(res.getLastModificationTime()));
- }
-}
diff --git a/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/PatternPathTest.java b/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/PatternPathTest.java
deleted file mode 100644
index b1c3b05..0000000
--- a/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/PatternPathTest.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.jcr.Credentials;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-
-/**
- * The <code>PatternPathTest</code> class
- *
- * @author Felix Meschberger
- */
-public class PatternPathTest extends ClassLoaderTestBase {
-
- private static final String DUMMY = "/dummy/classes";
- private static final String[] patterns = {
- "/apps|libs/*/classes",
- "/*/classes", null, "", DUMMY, "/", "*", "|",
- "/apps/developers/fmeschbe/lib/*.doc" };
- private static final Set included;
- private static final Set excluded;
-
- static {
- included = new HashSet();
-
- // matches *
- included.add("/apps");
- included.add("/libs");
- included.add("/jcr:system"); // Repository child node
- included.add("/jcr:primaryType"); // Repository property
-
- // matches "/"
- included.add("/");
-
- // matches: "/apps|libs/*/classes"
- included.add("/apps/CFC/classes");
- included.add("/apps/Forms/classes");
- included.add("/apps/playground/classes");
- included.add("/libs/CFC/classes");
- included.add("/libs/Forms/classes");
-
- // matches "/*/classes"
- included.add(DUMMY);
-
- // matches "/apps/developers/fmeschbe/lib/*.doc"
- included.add("/apps/developers/fmeschbe/lib/test1.doc");
- included.add("/apps/developers/fmeschbe/lib/other.doc");
-
- excluded = new HashSet();
- excluded.add("/apps/developers/fmeschbe/classes");
- excluded.add("/libs/developers/fmeschbe/classes");
-
- excluded.add("/apps/developers/fmeschbe/lib/readme.txt");
- }
-
- protected void setUp() throws Exception {
- super.setUp();
-
- InputStream ins = getClass().getResourceAsStream("PatternPathTest.preload.properties");
- if (ins != null) {
- try {
- loadRepository(session, ins);
- } finally {
- try {
- ins.close();
- } catch (IOException ignore) {}
- }
- }
- }
-
- protected void tearDown() throws Exception {
- if (session != null) {
- clearRepository(session);
- session.logout();
- session = null;
- }
-
- super.tearDown();
- }
-
- public void testCreation() {
- PatternPath ppl = new PatternPath(session, patterns);
-
- // check completeness
- Set pplSet = new HashSet(Arrays.asList(ppl.getPath()));
- for (int i=0; i < patterns.length; i++) {
- String pattern = patterns[i];
- if (pattern == null || pattern.length() == 0) {
- assertFalse("Empty Entry must not be conained", pplSet.contains(pattern));
- } else {
- assertTrue("Non Empty Entry must be contained", pplSet.contains(pattern));
- }
- }
- }
-
- public void testExpandedPaths() throws RepositoryException {
- PatternPath ppl = new PatternPath(session, patterns);
-
- // expand the path
- List paths = ppl.getExpandedPaths();
-
- // check whether all expanded entries are expected
- Set expected = new HashSet(included);
- assertEquals("Number of path entries", expected.size(), paths.size());
- for (Iterator pi=paths.iterator(); pi.hasNext(); ) {
- String entry = (String) pi.next();
- assertTrue("Unexpected path entry " + entry, expected.remove(entry));
- }
-
- // check whether the expected inclusions have all been in the expansion
- assertTrue("Not all inclusions: " + expected, expected.isEmpty());
-
- // check that no exlusions are included
- for (Iterator pi=paths.iterator(); pi.hasNext(); ) {
- String entry = (String) pi.next();
- assertFalse("Path entry must be excluded" + entry, excluded.contains(entry));
- }
- }
-
- public void testMatchPath() {
- PatternPath ppl = new PatternPath(session, patterns);
-
- // paths expected to match
- for (Iterator ii=included.iterator(); ii.hasNext(); ) {
- String path = (String) ii.next();
- assertTrue("Expect Match: " + path, ppl.matchPath(path));
- }
-
- // paths expected to not match
- for (Iterator ei=excluded.iterator(); ei.hasNext(); ) {
- String path = (String) ei.next();
- assertFalse("Unexpect Match: " + path, ppl.matchPath(path));
- }
- }
-}
diff --git a/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/TestAll.java b/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/TestAll.java
deleted file mode 100644
index 8719380..0000000
--- a/contrib/classloader/src/test/java/org/apache/jackrabbit/classloader/TestAll.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.classloader;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class TestAll {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Test for Jackrabbit Class Loader");
- //$JUnit-BEGIN$
- suite.addTest(new ClassLoaderTestBase("repositoryStart"));
- suite.addTestSuite(PatternPathTest.class);
- suite.addTestSuite(ExpandingArchiveClassPathEntryTest.class);
- suite.addTestSuite(DynamicRepositoryClassLoaderTest.class);
- suite.addTest(new ClassLoaderTestBase("repositoryStop"));
- //$JUnit-END$
- return suite;
- }
-}
diff --git a/contrib/classloader/src/test/resources/log4j.properties b/contrib/classloader/src/test/resources/log4j.properties
deleted file mode 100644
index 9abbe76..0000000
--- a/contrib/classloader/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, file
-#log4j.rootLogger=DEBUG, stdout, file
-#log4j.rootLogger=ERROR, stdout, file
-
-log4j.logger.org.apache.jackrabbit.classloader.test=DEBUG
-
-# 'stdout' is set to be a ConsoleAppender.
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-
-# 'stdout' uses PatternLayout
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
-
-# 'file' is set to be a FileAppender.
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.File=jcr.log
-# log4j.appender.file.Append=false
-
-# 'file' uses PatternLayout.
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
diff --git a/contrib/classloader/src/test/resources/mock.jar b/contrib/classloader/src/test/resources/mock.jar
deleted file mode 100644
index da5823b..0000000
--- a/contrib/classloader/src/test/resources/mock.jar
+++ /dev/null
Binary files differ
diff --git a/contrib/classloader/src/test/resources/org/apache/jackrabbit/classloader/PatternPathTest.preload.properties b/contrib/classloader/src/test/resources/org/apache/jackrabbit/classloader/PatternPathTest.preload.properties
deleted file mode 100644
index ac02b3a..0000000
--- a/contrib/classloader/src/test/resources/org/apache/jackrabbit/classloader/PatternPathTest.preload.properties
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# Properties file to preload the MockRepository with content.
-# Each session created by the MockRepository upon calling login
-# reads this file to define a structure of content.
-#
-# Each property in this file defines a single item. The name
-# of the property is the absolute path to the item defined.
-# Order of the definitions in this file is relevant in that
-# intermediate nodes are automatically defined as
-# nt:unstructured nodes and may not be redefined later.
-#
-# The value of each property is a series of comma-separated
-# fields. The first field must either be "n" to indicate a
-# Node or "p" to indicate a Property. Any other values results
-# in the property being ignored for item creation. The remaining
-# fields depend on whether a Node or Property is defined.
-#
-# For nodes the fields are:
-# 1 - "n" to indicate the definition of a Node
-# 2 - The name of the node type, may be any string not
-# not containing a comma. The default value is
-# "nt:unstructured"
-# 3 - The name of the primary item. This may be missing
-# in which case there is no primary item or a well
-# known default value is used. For nt:file typed
-# nodes, the default is "jcr:content" for nt:resource
-# typed nodes, the default is "jcr:data"
-#
-# For Properties the fields are:
-# 1 - "p" to indicate the definition of a Property
-# 2 - The name of the property type. This must be one
-# of the type names defined in the PropertyType
-# class. If empty or or unknown, "String" is used
-# as the default.
-# 3 - The value of the property to the defined. The
-# value must be acceptable for the
-# ValueFactory.createValue(int type, String value)
-# method. If empty or missing, an empty string is
-# used as the property value, which may not be
-# acceptable for all property types.
-#
-# Property values (last field in the property definition) may
-# span multiple lines. Each line must be terminated with the
-# backslash character indicating the continuation of the line on
-# the next line of file.
-
-# various class path entries
-/apps/CFC/classes = n,nt:folder
-/apps/Forms/classes = n,nt:folder
-/apps/playground/classes = n,nt:folder
-
-/apps/developers/fmeschbe/classes = n,nt:folder
-
-/apps/developers/fmeschbe/lib/readme.txt = n,nt:file,classpath:/readme.txt
-/apps/developers/fmeschbe/lib/test1.doc = n,nt:file,classpath:/test1.txt
-/apps/developers/fmeschbe/lib/other.doc = n,nt:file,classpath:/other.txt
-
-/libs/CFC/classes = n,nt:folder
-/libs/Forms/classes = n,nt:folder
-/libs/developers/fmeschbe/classes = n,nt:folder
diff --git a/contrib/classloader/src/test/resources/other.txt b/contrib/classloader/src/test/resources/other.txt
deleted file mode 100644
index d772657..0000000
--- a/contrib/classloader/src/test/resources/other.txt
+++ /dev/null
@@ -1 +0,0 @@
-Some Test for other.doc
\ No newline at end of file
diff --git a/contrib/classloader/src/test/resources/preload.properties b/contrib/classloader/src/test/resources/preload.properties
deleted file mode 100644
index 10d3974..0000000
--- a/contrib/classloader/src/test/resources/preload.properties
+++ /dev/null
@@ -1,79 +0,0 @@
-#
-# Properties file to preload the MockRepository with content.
-# Each session created by the MockRepository upon calling login
-# reads this file to define a structure of content.
-#
-# Each property in this file defines a single item. The name
-# of the property is the absolute path to the item defined.
-# Order of the definitions in this file is relevant in that
-# intermediate nodes are automatically defined as
-# nt:unstructured nodes and may not be redefined later.
-#
-# The value of each property is a series of comma-separated
-# fields. The first field must either be "n" to indicate a
-# Node or "p" to indicate a Property. Any other values results
-# in the property being ignored for item creation. The remaining
-# fields depend on whether a Node or Property is defined.
-#
-# For nodes the fields are:
-# 1 - "n" to indicate the definition of a Node
-# 2 - The name of the node type, may be any string not
-# not containing a comma. The default value is
-# "nt:unstructured"
-# 3 - The name of the primary item. This may be missing
-# in which case there is no primary item or a well
-# known default value is used. For nt:file typed
-# nodes, the default is "jcr:content" for nt:resource
-# typed nodes, the default is "jcr:data"
-#
-# For Properties the fields are:
-# 1 - "p" to indicate the definition of a Property
-# 2 - The name of the property type. This must be one
-# of the type names defined in the PropertyType
-# class. If empty or or unknown, "String" is used
-# as the default.
-# 3 - The value of the property to the defined. The
-# value must be acceptable for the
-# ValueFactory.createValue(int type, String value)
-# method. If empty or missing, an empty string is
-# used as the property value, which may not be
-# acceptable for all property types.
-#
-# Property values (last field in the property definition) may
-# span multiple lines. Each line must be terminated with the
-# backslash character indicating the continuation of the line on
-# the next line of file.
-
-/node1 = n,nt:folder
-/node2 = n,nt:folder
-/node3 = n,nt:folder
-
-/node1/file1 = n,nt:file
-/node1/file1/jcr:content = n,nt:resource
-/node1/file1/jcr:content/jcr:data = p,Binary,This is the contents of file1\
-This line continues\
-and even more
-/node1/file1/jcr:content/jcr:lastModified = p,Date,2005-04-22T12:35:27.000Z
-/node1/file1/jcr:content/jcr:mimeType = p,String,text/plain
-
-/node1/file2 = n,nt:file
-/node1/file2/jcr:content = n,nt:resource
-/node1/file2/jcr:content/jcr:lastModified = p,Date,1966-12-26T22:15:00.000Z
-/node1/file2/jcr:content/jcr:mimeType = p,String,text/plain
-/node1/file2/jcr:content/jcr:data = p,Binary,This is the contents of file1\
-This line continues\
-and even more
-
-/node1/file3 = n,nt:file
-/node1/file3/jcr:content = n,nt:resource
-/node1/file3/jcr:content/jcr:lastModified = p,Date,1966-12-26T22:15:00.000Z
-/node1/file3/jcr:content/jcr:mimeType = p,String,text/plain
-/node1/file3/jcr:content/jcr:data = p,Binary,This is the contents of file1\n\
-This line continues\n\
-and even more\
-
-/node1/file4 = n,nt:file,classpath:/preload.properties
-/node1/ReadMe.txt = n,nt:file,file:///s:/src/test/ReadMe.txt
-/node1/mock.jar = n,nt:file,classpath:/mock.jar
-
-/node1/classes/org/apache/jackrabbit/classloader/Util.class = n,nt:file,classpath:/org/apache/jackrabbit/classloader/Util.class
diff --git a/contrib/classloader/src/test/resources/readme.txt b/contrib/classloader/src/test/resources/readme.txt
deleted file mode 100644
index 751938e..0000000
--- a/contrib/classloader/src/test/resources/readme.txt
+++ /dev/null
@@ -1 +0,0 @@
-Some ReadMe Text
\ No newline at end of file
diff --git a/contrib/classloader/src/test/resources/repository.xml b/contrib/classloader/src/test/resources/repository.xml
deleted file mode 100644
index 290bc6d..0000000
--- a/contrib/classloader/src/test/resources/repository.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<Repository>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${rep.home}/repository"/>
- </FileSystem>
-
- <Security appName="Jackrabbit">
- <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager" />
- <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
- <param name="anonymousId" value="anonymous"/>
- </LoginModule>
- </Security>
-
- <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
- <Workspace name="${wsp.name}">
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}"/>
- </FileSystem>
- <PersistenceManager class="org.apache.jackrabbit.core.state.obj.ObjectPersistenceManager"/>
- <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="path" value="${wsp.home}/index"/>
- </SearchIndex>
- </Workspace>
-
- <Versioning rootPath="${rep.home}/version">
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${rep.home}/version"/>
- </FileSystem>
- <PersistenceManager class="org.apache.jackrabbit.core.state.obj.ObjectPersistenceManager"/>
- </Versioning>
-
- <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="path" value="${rep.home}/repository/index"/>
- </SearchIndex>
-</Repository>
diff --git a/contrib/classloader/src/test/resources/test1.txt b/contrib/classloader/src/test/resources/test1.txt
deleted file mode 100644
index 4390b8e..0000000
--- a/contrib/classloader/src/test/resources/test1.txt
+++ /dev/null
@@ -1 +0,0 @@
-Some Test for test1.doc
\ No newline at end of file
diff --git a/contrib/examples/README.txt b/contrib/examples/README.txt
deleted file mode 100644
index 0194421..0000000
--- a/contrib/examples/README.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-README - JCR examples
----------------------
-
-Requirements
-------------
-
-This project assumes that you have already successfully compiled and
-installed the parent project Jackrabbit into your maven repository.
-If this is not the case, go back to the root project and launch
-
- maven jar:install
-
-which will build and copy Jackrabbit into ~/.maven/repository/jackrabbit/jars
diff --git a/contrib/examples/maven.xml b/contrib/examples/maven.xml
deleted file mode 100644
index 77d2643..0000000
--- a/contrib/examples/maven.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. The ASF licenses this file to You
- under the Apache License, Version 2.0 (the "License"); you may not
- use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<project default="run" xmlns:j="jelly:core" xmlns:ant="jelly:ant">
-
- <goal name="run" prereqs="java:compile">
- <ant:mkdir dir="${maven.build.dir}/repo"/>
- <ant:copy todir="${maven.build.dir}/repo">
- <ant:fileset dir="${maven.src.dir}/repo"/>
- </ant:copy>
- <ant:java classname="org.apache.jackrabbit.examples.Main" fork="true">
- <ant:jvmarg value="-Djava.security.auth.login.config==${maven.build.dir}/repo/jaas.config"/>
- <ant:classpath>
- <ant:path refid="maven.dependency.classpath"/>
- <ant:pathelement path="${maven.build.dest}"/>
- </ant:classpath>
- </ant:java>
- </goal>
-
-</project>
diff --git a/contrib/examples/project.properties b/contrib/examples/project.properties
deleted file mode 100644
index 596a572..0000000
--- a/contrib/examples/project.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-maven.repo.remote = http://www.ibiblio.org/maven/,http://www.day.com/maven/
-
-maven.jar.mainclass=org.apache.jackrabbit.examples.Main
diff --git a/contrib/examples/project.xml b/contrib/examples/project.xml
deleted file mode 100644
index d70d5b7..0000000
--- a/contrib/examples/project.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. The ASF licenses this file to You
- under the Apache License, Version 2.0 (the "License"); you may not
- use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<project>
- <pomVersion>3</pomVersion>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-examples</artifactId>
- <name>Jackrabbit Examples</name>
- <currentVersion>1.0-SNAPSHOT</currentVersion>
- <organization>
- <name>The Apache Software Foundation</name>
- <url>http://www.apache.org/</url>
- <logo>http://www.apache.org/images/asf_logo_wide.png</logo>
- </organization>
- <inceptionYear>2005</inceptionYear>
- <package>org.apache.jackrabbit.examples.*</package>
- <logo>/images/jackrabbitlogo.gif</logo>
- <description>
- The Jackrabbit Examples package contains example code for illustrating
- both general JCR API usage and specific Jackrabbit features.
- </description>
- <shortDescription>Example code for JCR and Jackrabbit</shortDescription>
- <repository>
- <connection>scm:svn:http://svn.apache.org/repos/asf/jackrabbit/trunk/contrib/examples</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/jackrabbit/trunk/contrib/examples</developerConnection>
- <url>http://svn.apache.org/viewcvs</url>
- </repository>
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>/LICENSE.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
-
- <dependencies>
- <!-- Compile dependencies -->
- <dependency>
- <groupId>jsr170</groupId>
- <artifactId>jcr</artifactId>
- <version>1.0</version>
- <url>http://jcp.org/en/jsr/detail?id=170</url>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-core</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
-
- <!-- Runtime dependencies needed by Jackrabbit -->
- <dependency>
- <groupId>concurrent</groupId>
- <artifactId>concurrent</artifactId>
- <version>1.3.4</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-jta</artifactId>
- <version>1.0-M1</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.0</version>
- <url>http://www.slf4j.org/download.html</url>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.8</version>
- </dependency>
- <dependency>
- <groupId>lucene</groupId>
- <artifactId>lucene</artifactId>
- <version>1.4.3</version>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.6.2</version>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xmlParserAPIs</artifactId>
- <version>2.0.2</version>
- </dependency>
- </dependencies>
-
- <build>
- <sourceDirectory>src/java</sourceDirectory>
- </build>
-
-</project>
diff --git a/contrib/examples/src/java/org/apache/jackrabbit/examples/FSImport.java b/contrib/examples/src/java/org/apache/jackrabbit/examples/FSImport.java
deleted file mode 100644
index 3c0f132..0000000
--- a/contrib/examples/src/java/org/apache/jackrabbit/examples/FSImport.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.examples;
-
-import org.apache.jackrabbit.core.jndi.RegistryHelper;
-
-import javax.jcr.*;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import java.io.FileInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.util.Hashtable;
-import java.util.Calendar;
-
-import sun.net.www.MimeTable;
-
-/**
- * The First Steps example class.
- */
-public class FSImport {
-
- /**
- * Run the Filesystem Import example.
- *
- * @param args command line arguments
- */
- public static void main(String[] args) {
- try {
- Repository repository = getRepository();
- SimpleCredentials creds = new SimpleCredentials("username", "password".toCharArray());
- Session session = repository.login(creds);
- Node root = session.getRootNode();
-
- if (args.length>0) {
- File startingpoint=new File(args[0]);
- importFolder (root.addNode(startingpoint.getName(), "nt:folder"), startingpoint);
- session.save();
- dump(root.getNode(startingpoint.getName()));
- } else {
- System.err.println("Please specify a starting point for the file system import into the repository.");
- }
-
-
- } catch (Exception e) {
- System.err.println(e);
- }
- }
-
- /**
- * Creates a Repository instance to be used by the example class.
- *
- * @return repository instance
- * @throws Exception on errors
- */
- private static Repository getRepository() throws Exception {
- String configFile = "repotest/repository.xml";
- String repHomeDir = "repotest";
-
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY,
- "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
- env.put(Context.PROVIDER_URL, "localhost");
- InitialContext ctx = new InitialContext(env);
-
- RegistryHelper.registerRepository(ctx, "repo", configFile, repHomeDir, true);
- return (Repository) ctx.lookup("repo");
- }
-
- /**
- * Imports a File.
- *
- * @param parentnode Parent Repository Node
- * @param file File to be imported
- * @throws RepositoryException on repository errors, IOException on io errors
- */
-
- public static void importFile(Node parentnode, File file) throws RepositoryException, IOException {
-
- MimeTable mt = MimeTable.getDefaultTable();
- String mimeType = mt.getContentTypeFor(file.getName());
- if (mimeType==null) mimeType="application/octet-stream";
-
- Node fileNode = parentnode.addNode(file.getName(), "nt:file");
- Node resNode = fileNode.addNode("jcr:content", "nt:resource");
- resNode.setProperty("jcr:mimeType", mimeType);
- resNode.setProperty("jcr:encoding", "");
- resNode.setProperty("jcr:data", new FileInputStream(file));
- Calendar lastModified = Calendar.getInstance();
- lastModified.setTimeInMillis(file.lastModified());
- resNode.setProperty("jcr:lastModified", lastModified);
- System.out.println(fileNode.getPath());
- }
-
-
- /**
- * Import a Folder.
- *
- * @param parentnode Parent Repository Node
- * @param directory Directory to be traversed
- * @throws RepositoryException on repository errors, IOException on io errors
- */
-
- private static void importFolder(Node parentnode, File directory) throws RepositoryException, IOException {
- File[] direntries = directory.listFiles();
- System.out.println(parentnode.getPath());
- for (int i=0; i<direntries.length; i++) {
- File direntry = direntries[i];
- if (direntry.isDirectory()) {
- Node childnode = parentnode.addNode(direntry.getName(),"nt:folder");
- importFolder(childnode, direntry);
- } else {
- importFile(parentnode, direntry);
- }
- }
- }
-
- /**
- * Dumps the contents of the given node to standard output.
- *
- * @param node the node to be dumped
- * @throws RepositoryException on repository errors
- */
- public static void dump(Node node) throws RepositoryException {
- System.out.println(node.getPath());
-
- PropertyIterator properties = node.getProperties();
- while (properties.hasNext()) {
- Property property = properties.nextProperty();
- System.out.print(property.getPath() + "=");
- if (property.getDefinition().isMultiple()) {
- Value[] values = property.getValues();
- for (int i = 0; i < values.length; i++) {
- if (i > 0) {
- System.out.println(",");
- }
- System.out.println(values[i].getString());
- }
- } else {
- if (property.getType()==PropertyType.BINARY) {
- System.out.print("<binary>");
- } else {
- System.out.print(property.getString());
- }
-
- }
- System.out.println();
- }
-
- NodeIterator nodes = node.getNodes();
- while (nodes.hasNext()) {
- Node child = nodes.nextNode();
- dump(child);
- }
- }
-}
diff --git a/contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java b/contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java
deleted file mode 100644
index 9e63286..0000000
--- a/contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.examples;
-
-import java.io.InputStream;
-
-import javax.jcr.ImportUUIDBehavior;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-import javax.jcr.Value;
-
-/**
- * The First Steps example class.
- */
-public class FirstSteps {
-
- private final Repository repository;
-
- public FirstSteps(Repository repository) {
- this.repository = repository;
- }
-
- /**
- * Run the First Steps example.
- */
- public void run() {
- try {
- SimpleCredentials creds =
- new SimpleCredentials("username", "password".toCharArray());
- Session session = repository.login(creds);
- Node root = session.getRootNode();
-
- System.out.println(root.getPrimaryNodeType().getName());
-
- if (!root.hasNode("testnode")) {
- System.out.println("creating testnode");
- Node node = root.addNode("testnode", "nt:unstructured");
- node.setProperty("testprop", session.getValueFactory().createValue("Hello, World."));
- session.save();
- }
-
- if (!root.hasNode("importxml")) {
- System.out.println("importing xml");
- Node node = root.addNode("importxml", "nt:unstructured");
- InputStream xml =
- getClass().getClassLoader().getResourceAsStream(
- "org/apache/jackrabbit/examples/firststeps.xml");
- session.importXML(
- "/importxml", xml, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
- session.save();
- }
-
- dump(root);
- } catch (Exception e) {
- System.err.println(e);
- }
- }
-
- /**
- * Dumps the contents of the given node to standard output.
- *
- * @param node the node to be dumped
- * @throws RepositoryException on repository errors
- */
- public static void dump(Node node) throws RepositoryException {
- System.out.println(node.getPath());
-
- PropertyIterator properties = node.getProperties();
- while (properties.hasNext()) {
- Property property = properties.nextProperty();
- System.out.print(property.getPath() + "=");
- if (property.getDefinition().isMultiple()) {
- Value[] values = property.getValues();
- for (int i = 0; i < values.length; i++) {
- if (i > 0) {
- System.out.println(",");
- }
- System.out.println(values[i].getString());
- }
- } else {
- System.out.print(property.getString());
- }
- System.out.println();
- }
-
- NodeIterator nodes = node.getNodes();
- while (nodes.hasNext()) {
- Node child = nodes.nextNode();
- dump(child);
- }
- }
-
-}
diff --git a/contrib/examples/src/java/org/apache/jackrabbit/examples/Main.java b/contrib/examples/src/java/org/apache/jackrabbit/examples/Main.java
deleted file mode 100644
index 201de9e..0000000
--- a/contrib/examples/src/java/org/apache/jackrabbit/examples/Main.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.examples;
-
-import java.util.Hashtable;
-
-import javax.jcr.Repository;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.apache.jackrabbit.core.jndi.RegistryHelper;
-
-/**
- * TODO
- */
-public class Main {
-
- /**
- * Creates a Repository instance to be used by the example class.
- *
- * @return repository instance
- * @throws Exception on errors
- */
- private static Repository getRepository() throws Exception {
- String configFile = "target/repo/repository.xml";
- String repHomeDir = "target/repo";
-
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY,
- "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
- env.put(Context.PROVIDER_URL, "localhost");
- InitialContext ctx = new InitialContext(env);
-
- RegistryHelper.registerRepository(ctx, "repo", configFile, repHomeDir, true);
- return (Repository) ctx.lookup("repo");
- }
-
- public static void main(String[] args) {
- try {
- new FirstSteps(getRepository()).run();
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/contrib/examples/src/java/org/apache/jackrabbit/examples/firststeps.xml b/contrib/examples/src/java/org/apache/jackrabbit/examples/firststeps.xml
deleted file mode 100644
index f156bb6..0000000
--- a/contrib/examples/src/java/org/apache/jackrabbit/examples/firststeps.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
- xmlns:mathml="http://www.w3.org/1998/Math/MathML">
- <xhtml:head><xhtml:title>Three Namespaces</xhtml:title></xhtml:head>
- <xhtml:body>
- <xhtml:h1 align="center">An Ellipse and a Rectangle</xhtml:h1>
- <svg:svg xmlns:svg="http://www.w3.org/2000/svg"
- width="12cm" height="10cm">
- <svg:ellipse rx="110" ry="130" />
- <svg:rect x="4cm" y="1cm" width="3cm" height="6cm" />
- </svg:svg>
- <xhtml:p>The equation for ellipses</xhtml:p>
-<mathml:math>
- <mathml:apply>
- <mathml:eq/>
- <mathml:cn> 1 </mathml:cn>
- <mathml:apply>
- <mathml:plus/>
- <mathml:apply>
- <mathml:divide/>
- <mathml:apply>
- <mathml:power/>
- <mathml:ci> x </mathml:ci>
- <mathml:cn> 2 </mathml:cn>
- </mathml:apply>
- <mathml:apply>
- <mathml:power/>
- <mathml:ci> a </mathml:ci>
- <mathml:cn> 2 </mathml:cn>
- </mathml:apply>
- </mathml:apply>
- <mathml:apply>
- <mathml:divide/>
- <mathml:apply>
- <mathml:power/>
- <mathml:ci> y </mathml:ci>
- <mathml:cn> 2 </mathml:cn>
- </mathml:apply>
- <mathml:apply>
- <mathml:power/>
- <mathml:ci> b </mathml:ci>
- <mathml:cn> 2 </mathml:cn>
- </mathml:apply>
- </mathml:apply>
- </mathml:apply>
- </mathml:apply>
-</mathml:math>
- <xhtml:hr/>
- <xhtml:p>Last Modified January 10, 2002</xhtml:p>
- </xhtml:body>
-</xhtml:html>
diff --git a/contrib/examples/src/repo/jaas.config b/contrib/examples/src/repo/jaas.config
deleted file mode 100644
index 8ea7a44..0000000
--- a/contrib/examples/src/repo/jaas.config
+++ /dev/null
@@ -1,3 +0,0 @@
-Jackrabbit {
-org.apache.jackrabbit.core.security.SimpleLoginModule required anonymousId="anonymous";
-};
diff --git a/contrib/examples/src/repo/repository.xml b/contrib/examples/src/repo/repository.xml
deleted file mode 100644
index c34cbe6..0000000
--- a/contrib/examples/src/repo/repository.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<Repository>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${rep.home}/repository"/>
- </FileSystem>
- <Security appName="Jackrabbit">
- <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager"/>
- </Security>
- <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" />
- <Workspace name="${wsp.name}">
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}"/>
- </FileSystem>
- <PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
- <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="path" value="${wsp.home}/index"/>
- </SearchIndex>
- </Workspace>
- <Versioning rootPath="${rep.home}/versions">
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${rep.home}/versions"/>
- </FileSystem>
- <PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
- </Versioning>
- <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="path" value="${rep.home}/repository/index"/>
- </SearchIndex>
-</Repository>
diff --git a/contrib/extension-framework/HEADER.txt b/contrib/extension-framework/HEADER.txt
deleted file mode 100644
index 1c10dad..0000000
--- a/contrib/extension-framework/HEADER.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
\ No newline at end of file
diff --git a/contrib/extension-framework/LICENSE.txt b/contrib/extension-framework/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/contrib/extension-framework/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- 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.
diff --git a/contrib/extension-framework/project.properties b/contrib/extension-framework/project.properties
deleted file mode 100644
index 27b0a7e..0000000
--- a/contrib/extension-framework/project.properties
+++ /dev/null
@@ -1,107 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. The ASF licenses this file to You
-# under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-######################################################################
-# Apache Central Repository
-######################################################################
-maven.repo.central=www.apache.org
-maven.repo.central.directory=/www/www.apache.org/dist/java-repository
-maven.remote.group=apcvs
-maven.changelog.factory = org.apache.maven.svnlib.SvnChangeLogFactory
-
-######################################################################
-# JUnit Testing
-######################################################################
-maven.test.failure = false
-maven.junit.fork=true
-maven.junit.dir=${maven.build.dir}
-#maven.junit.sysproperties=org.xml.sax.driver java.security.auth.login.config
-maven.junit.sysproperties=org.xml.sax.driver
-org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
-#java.security.auth.login.config=applications/test/jaas.config
-
-
-#If you wish to skip tests when doing builds, uncomment
-#maven.test.skip = true
-
-######################################################################
-# Checkstyle
-######################################################################
-maven.checkstyle.properties= checkstyle.xml
-maven.linkcheck.enable=false
-
-######################################################################
-# JavaDoc
-#
-# javadoc urls can be added here, multiple urls are appended using a comma
-#
-# maven.javadoc.links = http://foo/bar/api,\
-# http://flim/flam/api/
-######################################################################
-maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api/,http://www.day.com/maven/jsr170/javadocs/jcr-0.16.4.1/
-maven.javadoc.author=false
-maven.javadoc.version=false
-
-######################################################################
-# Other opts
-######################################################################
-# uncomment the next line to work in offline mode (no jar download & no linkcheck)
-#maven.mode.online=
-
-maven.compile.debug=on
-maven.compile.deprecation=off
-maven.compile.optimize=off
-maven.compile.source=1.4
-maven.compile.target=1.4
-
-maven.jarResources.basedir=src/java
-maven.jar.excludes=**/package.html
-
-# Location of the generated query language parsers. Needed for
-# the Maven Eclipse plugin to automatically locate the generated
-# source files. Note that this value matches the hardcoded path
-# in the Maven JavaCC plugin. Therefore, do not change this value!
-maven.gen.src=${maven.build.dir}/generated-src/main
-
-# specifying additional remote repository for downloading dependencies
-# not available at www.ibiblio.org/maven/
-maven.repo.remote = http://www.ibiblio.org/maven/,http://www.day.com/maven/
-
-######################################################################
-# Site L&F
-######################################################################
-# maven.xdoc.jsl=
-maven.xdoc.date=
-maven.xdoc.poweredby.image=maven-feather.png
-maven.xdoc.version=${pom.currentVersion}
-maven.xdoc.developmentProcessUrl=http://jackrabbit.apache.org/
-maven.docs.src=${basedir}/src/site/xdoc
-maven.changelog.range=60
-maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory
-maven.multiproject.overviewPage.title=Jackrabbit components
-
-# ------------------------------------------------------------------------
-# M A V E N J A R O V E R R I D E
-# ------------------------------------------------------------------------
-#maven.jar.override = on
-#maven.jar.jcr = ${basedir}/lib/jcr.jar
-
-######################################################################
-# Site Deploy (into ../jackrabbit-site for checkout on jackrabbit.apache.org)
-######################################################################
-maven.site.deploy.method=fs
-
-# IDE settings
-maven.eclipse.resources.addtoclasspath=true
-
diff --git a/contrib/extension-framework/project.xml b/contrib/extension-framework/project.xml
deleted file mode 100644
index f93e25a..0000000
--- a/contrib/extension-framework/project.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. The ASF licenses this file to You
- under the Apache License, Version 2.0 (the "License"); you may not
- use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<project>
- <pomVersion>1</pomVersion>
- <groupId>org.apache.jackrabbit</groupId>
- <currentVersion>1.0-SNAPSHOT</currentVersion>
- <organization>
- <name>The Apache Software Foundation</name>
- <url>http://www.apache.org/</url>
- <logo>http://www.apache.org/images/asf_logo_wide.png</logo>
- </organization>
- <inceptionYear>2005</inceptionYear>
- <package>org.apache.jackrabbit.extension</package>
- <description>The Jackrabbit Extension Framework is a simple framework providing functionality to easily extend applications
-in a plug-in style.</description>
- <shortDescription>Extension Framework for JCR Repositories</shortDescription>
- <repository />
- <developers>
- <developer>
- <name>Felix Meschberger</name>
- <id>1</id>
- <email>fmeschbe at apache dot org</email>
- <organization>Day Software</organization>
- <timezone>+1</timezone>
- </developer>
- </developers>
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>/LICENSE.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <reports>
- <report>maven-javadoc-plugin</report>
- <report>maven-jdepend-plugin</report>
- <report>maven-license-plugin</report>
- </reports>
- <artifactId>extension-framework</artifactId>
- <name>Jackrabbit Extension Framework</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>classloader</artifactId>
- <version>1.0-SNAPSHOT</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-core</artifactId>
- <version>1.0-SNAPSHOT</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>jsr170</groupId>
- <artifactId>jcr</artifactId>
- <version>1.0</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <version>1.1</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.1</version>
- <type>jar</type>
- </dependency>
- <!-- Unit Testing -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.0</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.8</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.1</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>concurrent</groupId>
- <artifactId>concurrent</artifactId>
- <version>1.3.4</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>lucene</groupId>
- <artifactId>lucene</artifactId>
- <version>1.4.3</version>
- <type>jar</type>
- </dependency>
- </dependencies>
- <build>
- <sourceDirectory>src/main/java</sourceDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- </resource>
- </resources>
- <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
- <unitTest>
- <includes>
- <include>**/*TestAll.java</include>
- </includes>
- <resources>
- <resource>
- <directory>src/test/resources</directory>
- <filtering>false</filtering>
- </resource>
- </resources>
- </unitTest>
- </build>
-</project>
-
diff --git a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionDescriptor.java b/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionDescriptor.java
deleted file mode 100644
index b608200..0000000
--- a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionDescriptor.java
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.extension;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-import javax.jcr.Value;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.extension.configuration.ItemConfiguration;
-import org.apache.jackrabbit.extension.configuration.RepositoryConfiguration;
-
-/**
- * The <code>ExtensionDescriptor</code> class implements a descriptor for an
- * extension defined in a repository node with mixin node type
- * <code>rep:extension</code>.
- * <p>
- * Two instances of this class are considered equal if they are the same
- * instance or if they are of the same extension type and if their extension
- * names are equal.
- * <p>
- * This class implements the <code>Comparable</code> interface defining an order
- * amongst two instances of this class according to the extension type
- * identification and the extension name. See {@link #compareTo(Object)}.
- *
- * @author Felix Meschberger
- *
- * @see org.apache.jackrabbit.extension.ExtensionType
- * @see org.apache.jackrabbit.extension.ExtensionManager
- */
-public class ExtensionDescriptor implements Comparable {
-
- /** default log */
- private static final Log log = LogFactory.getLog(ExtensionDescriptor.class);
-
- /**
- * The name of the property containing the extension type identification
- * (value is "rep:id").
- * This is a mandatory property of an extension node.
- */
- public static final String PROP_REP_ID = "rep:id";
-
- /**
- * The name of the property containing the extension name (value is
- * "rep:name").
- * This is a mandatory property of an extension node.
- */
- public static final String PROP_REP_NAME = "rep:name";
-
- /**
- * The name of the property containing the fully qualified name of a class
- * implementing the extension (value is "rep:class").
- * This is an optional property of the extension node.
- */
- public static final String PROP_REP_CLASS = "rep:class";
-
- /**
- * The name of the multivalue property containing the class path providing
- * the extension class(es) (value is "rep:classpath").
- * This is an optional property of the extension node.
- */
- public static final String PROP_REP_CLASSPATH = "rep:classpath";
-
- /**
- * The name of the property containing the fully qualified name of a class
- * implementing the <code>org.apache.commons.configuration.Configuration</code>
- * interface (value is "rep:configurationClass").
- * This is an optional property of the extension node.
- */
- public static final String PROP_REP_CONFIGURATION_CLASS =
- "rep:configurationClass";
-
- /**
- * The name of the child node containing the configuration for this
- * extension (value is "rep:configuration").
- * This is an optional child node of the extension node.
- */
- public static final String NODE_REP_CONFIGURATION = "rep:configuration";
-
- /**
- * The {@link ExtensionType} to which this extension belongs.
- * @see #getExtensionType
- */
- private final ExtensionType type;
-
- /**
- * The <code>Node</code> from which this descriptor has been loaded.
- * @see #getNode()
- */
- private final Node node;
-
- /**
- * The extension type identification read from the {@link #PROP_REP_ID}
- * property of the node describing the extension.
- * @see #getId()
- */
- private final String id;
-
- /**
- * The extension name read from the {@link #PROP_REP_NAME} property of the
- * node describing the extension.
- * @see #getName()()
- */
- private final String name;
-
- /**
- * The fully qualified name of the class implementing the extension or
- * <code>null</code> if none is defined. The value of this field is read
- * from the {@link #PROP_REP_CLASS} property of the node describing the
- * extension.
- * @see #getClassName()
- */
- private final String className;
-
- /**
- * The classpath to configure on the extension type's class loader to load
- * and use this extension or <code>null</code> if none is defined. The value
- * of this field is read from the {@link #PROP_REP_CLASSPATH} property of
- * the node describing the extension.
- * @see #getClassPath()
- */
- private final String[] classPath;
-
- /**
- * The fully qualified name of the class implementing the Apache Jakarta
- * Commons <code>Configuration</code> interface or <code>null</code> if
- * none is defined. The value of this field is read from the
- * {@link #PROP_REP_CONFIGURATION_CLASS} property of the node describing the
- * extension.
- * @see #getConfigurationClassName()
- * @see #getConfiguration()
- * @see #getConfigurationNode()
- */
- private final String configurationClassName;
-
- /**
- * The absolute path of the {@link #node} from which this descriptor has
- * been loaded.
- * @see #getNodePath();
- */
- private String nodePath;
-
- /**
- * The extension instance created for this descriptor by the
- * {@link #getExtension()} method or <code>null</code> if none has been
- * created yet.
- * @see #getExtension()
- */
- private Object extension;
-
- /**
- * The configuration object created for this descriptor by the
- * {@link #getConfiguration()} method or <code>null</code> if none has been
- * created yet.
- * @see #getConfiguration()
- */
- private Configuration configuration;
-
- /**
- * Creates an instance of this class loading the definition from the given
- * <code>extensionNode</code>.
- * <p>
- * This method does not check whether the node is of the correct type but
- * merely accesses the properties required to exist and tries to access
- * optional properties. If an error occurrs accessing the properties,
- * an <code>ExtensionException</code> is thrown with the cause set.
- *
- * @param type The {@link ExtensionType} having loaded this extension
- * object.
- * @param extensionNode The <code>Node</code> containing the extension
- * description.
- *
- * @throws ExtensionException If an error occurrs reading the extension
- * description from the node.
- */
- /* package */ ExtensionDescriptor(ExtensionType type, Node extensionNode)
- throws ExtensionException {
-
- this.type = type;
- node = extensionNode;
-
- try {
- // required data
- id = getPropertyOrNull(extensionNode, PROP_REP_ID);
- name = getPropertyOrNull(extensionNode, PROP_REP_NAME);
- if (id == null || name == null) {
- throw new ExtensionException("Missing id or name property");
- }
-
- // optional class, classpath and configuration class
- className = getPropertyOrNull(extensionNode, PROP_REP_CLASS);
- classPath = getPropertiesOrNull(extensionNode, PROP_REP_CLASSPATH);
- configurationClassName =
- getPropertyOrNull(extensionNode, PROP_REP_CONFIGURATION_CLASS);
- } catch (RepositoryException re) {
- throw new ExtensionException("Cannot load extension", re);
- }
- }
-
- /**
- * Returns the {@link ExtensionType} which has loaded this extension.
- */
- private ExtensionType getExtensionType() {
- return type;
- }
-
- /**
- * Returns the <code>Node</code> from which this extension has been loaded.
- * Any modification to the node returned will only be active the next
- * time an instance of this class is created from the node.
- */
- public final Node getNode() {
- return node;
- }
-
- /**
- * Returns the absolute path of the <code>Node</code> from which this
- * extension has been loaded.
- */
- public final String getNodePath() {
- if (nodePath == null) {
- try {
- nodePath = getNode().getPath();
- } catch (RepositoryException re) {
- log.warn("Cannot get the path of the extension node", re);
- nodePath = getNode().toString();
- }
- }
-
- return nodePath;
- }
-
- /**
- * Returns the identification of the extension type implemented by this
- * extension.
- */
- public final String getId() {
- return id;
- }
-
- /**
- * Returns the name of this extension.
- */
- public final String getName() {
- return name;
- }
-
- /**
- * Returns the fully qualified name of the class implementing this extension
- * or <code>null</code> if none is configured in the extension descriptor
- * node.
- */
- public final String getClassName() {
- return className;
- }
-
- /**
- * Returns the extension class path or <code>null</code> if none has been
- * configured in the extension descriptor. Note that an empty array is
- * never returned by this method.
- */
- public final String[] getClassPath() {
- return classPath;
- }
-
- /**
- * Returns the fully qualified name of the extensions configuration class
- * or <code>null</code> if none is configured in the extension's node.
- * @see #getConfiguration()
- * @see #getConfigurationNode()
- */
- public final String getConfigurationClassName() {
- return configurationClassName;
- }
-
- //---------- Instantiation support ----------------------------------------
-
- /**
- * Returns the class loader to be used to load the extension object and the
- * configuration for the extension described by this descriptor.
- */
- public ClassLoader getExtensionLoader() {
- return getExtensionType().getClassLoader(this);
- }
-
- /**
- * Creates an instance of the extension class defined by this descriptor.
- * <p>
- * If the descriptor contains a classpath specification, the class loader of
- * the extension type to which the extension belongs, is configured with the
- * additional classpath.
- * <p>
- * The extension class must provide either of two constructors for it to be
- * instantiated by this method:
- * <ol>
- * <li>If a public constructor taking an instance of
- * {@link ExtensionDescriptor} is available, that constructor is used to
- * create the extension instance.</il>
- * <li>Otherwise if a public default constructor taking no paramaters at
- * all is available, that constructor is used to create the extension
- * instance. In this case it is the responsibility of the application to
- * provide the extension instance with more information if required.</li>
- * </ol>
- * <p>
- * If neither constructor is available in the class, this method fails with
- * an {@link ExtensionException}.
- * <p>
- * If the class provides a public method taking a single parameter of
- * type <code>ExtensionDescriptor</code>, that method is called with this
- * instance as the parameter value. This allows for parameterless default
- * constructors in the extension classes while still getting the extension
- * descriptor.
- * <p>
- * If no class has been defined for this extension, an
- * <code>IllegalArgumentException</code> is thrown.
- *
- * @return The instance created for this extension.
- *
- * @throws IllegalArgumentException if no extension class specification is
- * available in this extension descriptor.
- * @throws ExtensionException if the extension class has no suitable
- * constructor or if an error occurrs loading or instantiating the
- * class.
- */
- public Object getExtension() throws ExtensionException {
-
- // immediately return the extension, if it is already defined
- if (extension != null) {
- return extension;
- }
- // otherwise, we have to instantiate
-
- // fail if there is no class name in the descriptor
- if (getClassName() == null) {
- throw new IllegalArgumentException("Descriptor has no class definition");
- }
-
- try {
- log.debug("Loading class " + getClassName());
- Class clazz = getExtensionLoader().loadClass(getClassName());
- Object extension = instantiate(clazz);
- setDescriptor(extension);
- return extension;
-
- } catch (Exception e) {
- throw new ExtensionException("Cannot instantiate extension " +
- getClassName(), e);
- }
- }
-
- /**
- * Returns the node containing the configuration of this extension. If the
- * extension's node has a child node <code>rep:configuration</code>, that
- * child node is returned, otherwise the extension's node is returned.
- *
- * @return The configuration node of this extension.
- */
- public Node getConfigurationNode() {
- Node node = getNode();
-
- try {
- if (node.hasNode(NODE_REP_CONFIGURATION)) {
- return node.getNode(NODE_REP_CONFIGURATION);
- }
- } catch (RepositoryException re) {
- log.warn("Cannot check or access configuration node " +
- NODE_REP_CONFIGURATION + ". Using extension node", re);
- }
-
- return node;
- }
-
- /**
- * Returns the <code>Configuration</code> object used to configure this
- * extension.
- * <p>
- * If the extension descriptor does not contain the fully qualified name of
- * a configuration class, this method returns an instance of the
- * {@link ItemConfiguration} class loaded from the extension's node.
- * <p>
- * Otherwise the named class is loaded through the extensions class loader
- * (see {@link #getExtensionLoader()}) and instantiated. A class to be used
- * like this must implement the <code>Configuration</code> interface and
- * provide a public default constructor. If any of the requirements is not
- * met by the configured class, this method throws an exception.
- * <p>
- * If the configured class implements the {@link RepositoryConfiguration}
- * interface, the configuration is configured with the extension's node
- * and loaded.
- * <p>
- * The main use of this method is for the extension class itself to
- * configure itself. Another use may be for an administrative application
- * to update configuration and optionally store it back.
- *
- * @return The <code>Configuration</code> object used to configured this
- * extension.
- *
- * @throws ExtensionException If the configuration class has no public
- * default constructor or if the configuration class is not an
- * implementation of the <code>Configuration</code> interface or if an
- * error occurrs loading or instantiating the configuration class.
- */
- public Configuration getConfiguration() throws ExtensionException {
- // immediately return the configuration, if it is already defined
- if (configuration != null) {
- return configuration;
- }
- // otherwise, we have to instantiate
-
- // use a default configuration if no specific class defined
- if (getConfigurationClassName() == null) {
- log.debug("No configurationClass setting, using ItemConfiguration");
- try {
- return new ItemConfiguration(getConfigurationNode());
- } catch (ConfigurationException ce) {
- throw new ExtensionException(
- "Cannot load ItemConfiguration from " + getNodePath());
- }
- }
-
- try {
- log.debug("Loading class " + getConfigurationClassName());
- Class clazz =
- getExtensionLoader().loadClass(getConfigurationClassName());
-
- // create an instance using the one taking an extension descriptor
- // if available otherwise use the default constructor
- log.debug("Creating configuration object instance");
- Object configObject = clazz.newInstance();
- if (!(configObject instanceof Configuration)) {
- throw new ExtensionException("Configuration class " +
- getClassName() +
- " does not implement Configuration interface");
- }
-
- // load the repository configuration from the extension node
- if (configObject instanceof RepositoryConfiguration) {
- RepositoryConfiguration repoConfig =
- (RepositoryConfiguration) configObject;
- repoConfig.setNode(getConfigurationNode());
- repoConfig.load();
- }
-
- configuration = (Configuration) configObject;
- return configuration;
-
- } catch (Exception e) {
- throw new ExtensionException("Cannot instantiate extension " +
- getClassName(), e);
- }
- }
-
- //---------- Comparable interface -----------------------------------------
-
- /**
- * Compares this object with the specified object for order. Returns a
- * negative integer, zero, or a positive integer as this object is less
- * than, equal to, or greater than the specified object.
-
- * @param obj the Object to be compared, which must be an instance of this
- * class.
- *
- * @return a negative integer, zero, or a positive integer as this
- * descriptor is less than, equal to, or greater than the specified
- * descriptor.
- *
- * @throws NullPointerException if <code>obj</code> is <code>null</code>.
- * @throws ClassCastException if <code>obj</code> is not an
- * <code>ExtensionDescriptor</code>.
- */
- public int compareTo(Object obj) {
- // throws documented ClassCastException
- ExtensionDescriptor other = (ExtensionDescriptor) obj;
-
- // check the order amongst the id and return if not equal
- int idOrder = id.compareTo(other.id);
- if (idOrder != 0) {
- return idOrder;
- }
-
- // id's are the same, so return order amongst names
- return name.compareTo(other.name);
- }
-
- //---------- Object overwrite ---------------------------------------------
-
- /**
- * Returns a combined hash code of the {@link #getId() type identification}
- * and the {@link #getName() name} of this extension as this extension's
- * hash code.
- */
- public int hashCode() {
- return id.hashCode() + 17 * name.hashCode();
- }
-
- /**
- * Returns <code>true</code> if <code>obj</code> is the same as this or
- * if it is a <code>ExtensionDescriptor</code> whose type identification
- * and name equals the type identification and name of this extension.
- */
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof ExtensionDescriptor) {
- ExtensionDescriptor other = (ExtensionDescriptor) obj;
- return id.equals(other.id) && name.equals(other.name);
- } else {
- return false;
- }
- }
-
- /**
- * Returns a string representation of this extension descriptor which
- * contains the extension type identification and the extension name.
- */
- public String toString() {
- return "Extension " + id + ":" + name;
- }
-
- //---------- innternal ----------------------------------------------------
-
- /**
- * Returns the value of the {@link #PROP_REP_NAME} property of the
- * <code>extensionNode</code> or <code>null</code> if no such property
- * exists.
- *
- * @param extensionNode The <code>Node</code> whose extension name property
- * value is to bereturned.
- *
- * @throws RepositoryException if an error occurrs accessing the extension
- * name property.
- */
- /* package */ static String getExtensionName(Node extensionNode)
- throws RepositoryException {
- return getPropertyOrNull(extensionNode, PROP_REP_NAME);
- }
-
- /**
- * Returns the string value of the named (single-value) property of the
- * node or <code>null</code> if the the property does not exists or its
- * value is empty.
- *
- * @param node The <code>Node</code> containing the named property.
- * @param property The name of the property to reutrn.
- *
- * @return The property's string value or <code>null</code> if the property
- * does not exist or is empty.
- *
- * @throws RepositoryException If an error occurrs accesing the node or
- * property.
- */
- private static String getPropertyOrNull(Node node, String property)
- throws RepositoryException {
- if (node.hasProperty(property)) {
- String value = node.getProperty(property).getString();
- return (value == null || value.length() == 0) ? null : value;
- }
-
- return null;
- }
-
- /**
- * Returns the string values of the named (multi-valued) property of the
- * node or <code>null</code> if the the property does not exists or its
- * value is empty.
- *
- * @param node The <code>Node</code> containing the named property.
- * @param property The name of the property to reutrn.
- *
- * @return A string array containing the string representations of the
- * property's values or <code>null</code> if the property does not
- * exist or is empty.
- *
- * @throws RepositoryException If an error occurrs accesing the node or
- * property.
- */
- private static String[] getPropertiesOrNull(Node node, String property)
- throws RepositoryException {
-
- if (node.hasProperty(property)) {
- Value[] clsPath = node.getProperty(property).getValues();
- if (clsPath != null && clsPath.length >= 0) {
- List pathList = new ArrayList();
- for (int i=0; i < clsPath.length; i++) {
- String pathEntry = clsPath[i].getString().trim();
-
- // ignore empty or existing path entry
- if (pathEntry.length() == 0 ||
- pathList.contains(pathEntry)) {
- continue;
- }
-
- // new class path entry, add
- pathList.add(pathEntry);
- }
-
- if (pathList.size() > 0) {
- return (String[]) pathList.toArray(new String[pathList.size()]);
- }
- }
- }
-
- return null;
- }
-
- /**
- * Creates an instance of the given <code>clazz</code>. If the class has
- * a public constructor taking a single parameter of type
- * <code>ExtensionDescriptor</code> that constructor is used to create the
- * instance. Otherwise the public default constructor is used if available.
- * If none of both is available or if an error occurrs creating the instance
- * a <code>ExtensionException</code> is thrown.
- *
- * @param clazz The <code>Class</code> to instantiate.
- *
- * @return The instance created.
- *
- * @throws ExtensionException If an error occurrs instantiating the class.
- * If instantiation failed due to an exception while calling the
- * constructor, the causing exception is available as the cause of
- * the exception.
- */
- private Object instantiate(Class clazz) throws ExtensionException {
- // find constructors (taking descriptor and default)
- Constructor defaultConstr = null;
- Constructor descrConstr = null;
- Constructor[] constructors = clazz.getConstructors();
- for (int i=0; i < constructors.length; i++) {
- Class parms[] = constructors[i].getParameterTypes();
- if (parms.length == 0) {
- defaultConstr = constructors[i];
- } else if (parms.length == 1 && parms[i].equals(getClass())) {
- descrConstr = constructors[i];
- }
- }
-
- try {
- // create an instance using the one taking an extension descriptor
- // if available otherwise use the default constructor
- if (descrConstr != null) {
- log.debug("Creating instance with descriptor " + this);
- return descrConstr.newInstance(new Object[]{ this });
- } else if (defaultConstr != null) {
- log.debug("Creating default instance without descriptor");
- return defaultConstr.newInstance(null);
- } else {
- throw new ExtensionException("No suitable constructor found " +
- "to instantiate " + getClassName());
- }
- } catch (InstantiationException ie) {
- throw new ExtensionException(
- "Cannot instantiate " + getClassName(), ie);
- } catch (IllegalAccessException iae) {
- throw new ExtensionException("Cannot access constructor of "
- + getClassName(), iae);
- } catch (InvocationTargetException ite) {
- throw new ExtensionException("Error while instantiating "
- + getClassName(), ite);
- }
- }
-
- /**
- * Calls a method taking a single parameter of type
- * <code>ExtensionDescriptor</code> to provide the extension descriptor to
- * the extension loaded.
- * <p>
- * If an error occurrs calling a method found, an WARN message is logged and
- * other methods according to the required signature are looked for. If no
- * suitable method can be found, an INFO method is logged and the extension
- * could not be provided with the extension descriptor.
- *
- * @param extension The extension to provide witch the extension descriptor.
- */
- private void setDescriptor(Object extension) {
- Method[] methods = extension.getClass().getMethods();
- for (int i=0; i < methods.length; i++) {
- Class[] parTypes = methods[i].getParameterTypes();
- if (parTypes.length == 1 && parTypes[0].equals(getClass())) {
- try {
- methods[i].invoke(extension, new Object[]{ this });
- return;
- } catch (Exception ite) {
- log.warn("setDescriptor: Calling " +
- extension.getClass().getName() + "." +
- methods[i].getName() + " failed", ite);
- }
- }
- }
-
- log.info("setDescriptor: No setter method for ExtensionDescriptor " +
- "found in class " + extension.getClass().getName() +
- " of extension " + getId() + ":" + getName());
- }
-}
diff --git a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionException.java b/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionException.java
deleted file mode 100644
index 3b2ff05..0000000
--- a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionException.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.extension;
-
-/**
- * The <code>ExtensionException</code> class defines an exception which may be
- * thrown in the Jackrabbit Extension Framework.
- *
- * @author Felix Meschberger
- */
-public class ExtensionException extends Exception {
-
- /**
- * serialization identification
- */
- private static final long serialVersionUID = 535080559025771531L;
-
- /**
- * Creates an instance of this exception with a message.
- *
- * @param message The message describing the problem.
- */
- public ExtensionException(String message) {
- super(message);
- }
-
- /**
- * Creates an instance of this exception with causing <code>Throwable</code>.
- *
- * @param cause The <code>Throwable</code> causing the problem.
- */
- public ExtensionException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Creates an instance of this exception with a message and a causing
- * <code>Throwable</code>.
- *
- * @param message The message describing the problem.
- * @param cause The <code>Throwable</code> causing the problem.
- */
- public ExtensionException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionIterator.java b/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionIterator.java
deleted file mode 100644
index b585374..0000000
--- a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionIterator.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.extension;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * The <code>ExtensionIterator</code> class implements the iterator
- * over instances of the {@link ExtensionDescriptor}s.
- *
- * @author Felix Meschberger
- */
-public class ExtensionIterator implements Iterator {
-
- /** Default log */
- private static final Log log = LogFactory.getLog(ExtensionIterator.class);
-
- /**
- * The type of the extension descriptors returned.
- */
- private final ExtensionType type;
-
- /**
- * The underlying iterator of nodes containing the extension descriptors.
- */
- private final NodeIterator nodes;
-
- /**
- * The preloaded next <code>EventDescriptor</code>. If <code>null</code>
- * no more descriptors are available in this iterator.
- */
- private ExtensionDescriptor next;
-
- /**
- * Creates an instance for the given underlying iterator of nodes.
- *
- * @param nodes The underlying <code>NodeIterator</code>.
- */
- /* package */ ExtensionIterator(ExtensionType type, NodeIterator nodes) {
- this.type = type;
- this.nodes = nodes;
- seek();
- }
-
- /**
- * Returns <code>true</code> if there is at least one more extension
- * descriptor available in this iterator.
- */
- public boolean hasNext() {
- return next != null;
- }
-
- /**
- * Returns the next available extension descriptor.
- *
- * @throws NoSuchElementException If no more extension descriptors are
- * available.
- */
- public Object next() {
- return nextExtension();
- }
-
- /**
- * Returns the next available extension descriptor.
- *
- * @throws NoSuchElementException If no more extension descriptors are
- * available.
- */
- public ExtensionDescriptor nextExtension() {
- if (next == null) {
- throw new NoSuchElementException("No more Descriptors");
- }
-
- ExtensionDescriptor toReturn = next;
- seek();
- return toReturn;
- }
-
- /**
- * Throws <code>UnsupportedOpertationException</code> because this
- * method is not supported by this implementation.
- */
- public void remove() {
- throw new UnsupportedOperationException("remove");
- }
-
- /**
- * Preload the next <code>ExtensionDescriptor</code> from the next node
- * in the underlying node iterator.
- * <p>
- * If an error occurrs instantiating an extension descriptor for any
- * node in the iterator, the node is ignored and the next node is
- * used. This is repeated until either no more nodes are available in
- * the underlying iterator or an extension descriptor can sucessfully
- * be created.
- */
- private void seek() {
- while (nodes.hasNext()) {
- try {
- Node extNode = nodes.nextNode();
- String name = ExtensionDescriptor.getExtensionName(extNode);
- next = type.getOrCreateExtension(name, extNode);
- return;
- } catch (RepositoryException re) {
- log.warn("Cannot get the extension name", re);
- } catch (ExtensionException ee) {
- log.warn("Cannot create extensions descriptor", ee);
- }
- }
-
- // fallback if no more nodes
- next = null;
- }
-}
diff --git a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionManager.java b/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionManager.java
deleted file mode 100644
index f82dd72..0000000
--- a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionManager.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.extension;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Workspace;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryManager;
-import javax.jcr.query.QueryResult;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.classloader.RepositoryClassLoader;
-
-/**
- * The <code>ExtensionManager</code> class provides the core functionality
- * of the Jackrabbit Extension Framework by methods for finding extensions.
- * <p>
- * Instances of this class are created with a <code>Session</code> to the
- * repository. Consequently all access to the repository is confined to the
- * workspace to which the session is attached. That is, only extensions located
- * in the session's workspace are found.
- * <p>
- * Additionally the class provides functionality to define the extension node
- * types on demand.
- *
- * @author Felix Meschberger
- */
-public final class ExtensionManager {
-
- /** default logger */
- private static final Log log = LogFactory.getLog(ExtensionManager.class);
-
- /**
- * The name of the repository node type defining the properties making up
- * an extension description (value is "rep:extension").
- */
- public static final String NODE_EXTENSION_TYPE = "rep:extension";
-
- /**
- * The session providing access to the repository for loading extensions.
- */
- private final Session session;
-
- /**
- * The application's class loader as provided to the constructor.
- */
- private final ClassLoader applicationLoader;
-
- /**
- * The map of extension types by the extension type identifiers.
- */
- private Map extensionTypes;
-
- /**
- * Creates an instance of this manager accessing the repository through the
- * given <code>session</code>.
- * <p>
- * This also confines the extensions available to this manager to the
- * extensions available through the workspace accessed by the
- * <code>session</code>.
- * <p>
- * If the <code>applicationLoader</code> parameter is <code>null</code>
- * either the current thread's context class loader is used or if that one
- * is <code>null</code>, too, the class loader of this class is used.
- * It is recommended, that the caller of the constructor provides a
- * non-<code>null</code> class loader to prevent unexpected class loading
- * issues.
- * <p>
- * To make sure extensions may actually be correctly handled, the
- * {@link #checkNodeType(Session)} method is called.
- *
- * @param session The <code>Session</code> to search for and load extensions.
- * @param applicationLoader The <code>ClassLoader</code> used as the parent
- * for the repository class loaders.
- *
- * @throws NullPointerException If <code>session</code> is <code>null</code>.
- */
- public ExtensionManager(Session session, ClassLoader applicationLoader)
- throws ExtensionException {
-
- // check session
- if (session == null) {
- throw new NullPointerException("session");
- }
-
- // make sure the extension system node type is available
- checkNodeType(session);
-
- // make sure the application class loader is non-null
- // - first try current thread context loader
- // - otherwise use this class's class loader
- if (applicationLoader == null) {
- applicationLoader = Thread.currentThread().getContextClassLoader();
- }
- if (applicationLoader == null) {
- applicationLoader = getClass().getClassLoader();
- }
-
- // assign fields
- this.session = session;
- this.applicationLoader = applicationLoader;
- }
-
- /**
- * Searches in the workspace of this instance's <code>Session</code> for
- * extensions of type <code>id</code> returning an <code>Iterator</code>
- * of {@link ExtensionDescriptor} instances. If <code>root</code> is
- * non-<code>null</code> the search for extensions only takes place in the
- * indicated subtree.
- * <p>
- * <b>NOTE</B>: This method may return more than one extension with the same
- * name for a given <code>id</code>. This is the only place in the Jackrabbit
- * Extension Framework which handles duplicate extension names. The rest
- * relies on extensions to have unique <code>id</code>/name pairs.
- * <p>
- * Calling this method multiple times with the same <code>id</code> will
- * return the same {@link ExtensionDescriptor} instances. Previously
- * available instances will not returned though if their extension node
- * has been removed in the meantime. Such instances will still be available
- * through {@link #getExtension(String, String, String)} but will not be
- * available on next system restart.
- *
- * @param id The extension type identification describing the extensions to
- * be found.
- * @param root The root node below which the extensions are looked for. This
- * path is taken as an absolute path regardless of whether it begins
- * with a slash or not. If <code>null</code> or empty, the search
- * takes place in the complete workspace.
- *
- * @return An <code>Iterator</code> of {@link ExtensionDescriptor} instances
- * describing the extensions found.
- *
- * @throws IllegalArgumentException If <code>id</code> is empty or
- * <code>null</code>.
- * @throws ExtensionException If an error occurrs looking for extensions.
- */
- public Iterator getExtensions(String id, String root)
- throws ExtensionException {
-
- // delegate finding/loading to the extension type
- return getExtensionType(id).getExtensions(root);
- }
-
- /**
- * Searches in the workspace of this instance's <code>Session</code> for
- * an extension with the given <code>name</code> of type <code>id</code>.
- * If <code>root</code> is non-<code>null</code> the search for extensions
- * only takes place in the indicated subtree.
- * <p>
- * This method fails with an exception if more than one extension with the
- * same name of the same type is found in the workspace. Not finding the
- * requested extension also yields an exception.
- * <p>
- * Two consecutive calls to this method with the same arguments, namely
- * the same <code>id</code> and <code>name</code> will return the same
- * {@link ExtensionDescriptor} instance.
- *
- * @param id The extension type identification describing the extensions to
- * be found.
- * @param name The name of the extension of the indicated type to be found.
- * @param root The root node below which the extensions are looked for. This
- * path is taken as an absolute path regardless of whether it begins
- * with a slash or not. If <code>null</code> or empty, the search
- * takes place in the complete workspace.
- *
- * @return The named {@link ExtensionDescriptor} instances.
- *
- * @throws IllegalArgumentException If <code>id</code> or <code>name</code>
- * is empty or <code>null</code>.
- * @throws ExtensionException If no or more than one extensions with the
- * same name and type can be found or if another error occurrs looking
- * for extensions.
- */
- public ExtensionDescriptor getExtension(String id, String name, String root)
- throws ExtensionException {
-
- // delegate finding/loading to the extension type
- return getExtensionType(id).getExtension(name, root);
- }
-
- //---------- Extension type helper methods --------------------------------
-
- /**
- * Creates a new instance of the <code>RepositoryClassLoader</code> class
- * with an empty path accessing the repository through the session of this
- * manager instance.
- * <p>
- * Note, that each call to this method returns a new RepositoryClassLoader
- * instance.
- */
- /* package */ RepositoryClassLoader createClassLoader() {
- return new RepositoryClassLoader(session, new String[0],
- applicationLoader);
- }
-
- /**
- * Executes the given XPath query on this mnanager's session and returns
- * a <code>NodeIterator</code> over the nodes matching the query.
- *
- * @param xpath The XPath query to execute
- *
- * @return The <code>NodeIterator</code> on the nodes matching the query.
- *
- * @throws ExtensionException If an error occurrs executing the query.
- * The underlying exception is available as the cause of the exception.
- */
- /* package */ NodeIterator findNodes(String xpath) throws ExtensionException {
- try {
- // look for the extension nodes
- QueryManager qm = session.getWorkspace().getQueryManager();
- Query query = qm.createQuery(xpath, Query.XPATH);
- QueryResult res = query.execute();
-
- // check whether we found at least one node
- return res.getNodes();
- } catch (RepositoryException re) {
- throw new ExtensionException("Problem executing query '" +
- xpath + "'", re);
- }
- }
-
- //---------- internal helper ----------------------------------------------
-
- /**
- * Returns an {@link ExtensionType} instance for the given name.
- *
- * @throws IllegalArgumentException if <code>id</code> is <code>null</code>
- * or an empty string.
- */
- /* package */ ExtensionType getExtensionType(String id) {
- if (id == null || id.length() == 0) {
- throw new IllegalArgumentException("Extension type identifier " +
- "must not be null or empty string");
- }
-
- if (extensionTypes == null) {
- extensionTypes = new TreeMap();
- }
-
- ExtensionType type = (ExtensionType) extensionTypes.get(id);
- if (type == null) {
- type = new ExtensionType(this, id);
- extensionTypes.put(id, type);
- }
-
- return type;
- }
-
- /**
- * Makes sure the <code>rep:extension</code> node type is registered with
- * the <code>session</code>'s repository.
- * <p>
- * If the required extension descriptor node type is not defined in the
- * repository yet, it is tried to be registered. If an error occurrs
- * registering the node type a message is logged and an
- * <code>ExtensionException</code> is thrown.
- *
- * @param session The <code>Session</code> used to access the repository
- * to test and optionally register the node.
- *
- * @throws ExtensionException If an error occurrs checking ro defining the
- * node type.
- */
- public static void checkNodeType(Session session) throws ExtensionException {
- // quick check for the node type, succeed if defined
- try {
- session.getWorkspace().getNodeTypeManager().getNodeType(NODE_EXTENSION_TYPE);
- log.debug("Required node type exists, can expand archives");
- return;
- } catch (NoSuchNodeTypeException nst) {
- log.debug("Required node types does not exist, try to define");
- } catch (RepositoryException re) {
- log.debug("Cannot check for required node type, cannot expand " +
- "archives", re);
- throw new ExtensionException("Cannot check for required node type", re);
- }
-
- try {
- Workspace workspace = session.getWorkspace();
- if (!NodeTypeSupport.registerNodeType(workspace)) {
- throw new ExtensionException("Registering required node type failed");
- }
- } catch (ExtensionException ee) {
- throw ee;
- } catch (Throwable t) {
- // Prevent anything from hapening if node type registration fails
- // due to missing libraries or other errors
- log.debug("Error registering node type", t);
- throw new ExtensionException("Cannot register required node type", t);
- }
- }
-}
diff --git a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionType.java b/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionType.java
deleted file mode 100644
index cc18172..0000000
--- a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/ExtensionType.java
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.extension;
-
-import java.net.URL;
-import java.text.MessageFormat;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.classloader.RepositoryClassLoader;
-
-/**
- * The <code>ExtensionType</code> class represents a collection of extensions
- * sharing the same Extension Type Identification. Instances of this class
- * maintain the extension types class loader and the set of extenions of the
- * same type which have been loaded through this instance.
- * <p>
- * The equality of instances of this class is defined by the equality of the
- * Extension Type Identifier. If two instances have same extension type
- * identifier, they are considered equal.
- *
- * @author Felix Meschberger
- *
- * @see org.apache.jackrabbit.extension.ExtensionManager
- * @see org.apache.jackrabbit.extension.ExtensionDescriptor
- */
-public class ExtensionType {
-
- /** default log */
- private static final Log log = LogFactory.getLog(ExtensionType.class);
-
- /**
- * Pattern used to create an XPath query to look for extensions of a certain
- * type. The parameters in the patterns are the root path below which to
- * search (<i>{0}</i>) and the extension type identificatio (<i>{1}</i>).
- *
- * @see #findExtensions(String, String)
- */
- private static final MessageFormat EXTENSION_QUERY_PATTERN =
- new MessageFormat("{0}//element(*, " + ExtensionManager.NODE_EXTENSION_TYPE + ")[@rep:id = ''{1}'']");
-
- /**
- * Pattern used to create an XPath query to look for a specific extension
- * by its name and type type. The parameters in the patterns are the root
- * path below which to search (<i>{0}</i>), the extension type
- * identification (<i>{1}</i>) and the extension name (<i>{1}</i>).
- *
- * @see #findExtension(String, String, String)
- */
- private static final MessageFormat EXTENSION_QUERY_PATTERN2 =
- new MessageFormat("{0}//element(*, " + ExtensionManager.NODE_EXTENSION_TYPE + ")[@rep:id = ''{1}'' and @rep:name = ''{2}'']");
-
- /**
- * The {@link ExtensionManager} responsible for accessing this instance.
- */
- private final ExtensionManager manager;
-
- /**
- * The Extension Type Identification of this extension type instance. No
- * two instances of this class with the same manager share their id.
- */
- private final String id;
-
- /**
- * The set of extensions loaded with this extension type, indexed by their
- * names.
- */
- private final Map extensions;
-
- /**
- * The <code>RepositoryClassLoader</code> used for extensions of this type.
- * This field is set on demand by the
- * {@link #getClassLoader(ExtensionDescriptor)} method.
- */
- private RepositoryClassLoader loader;
-
- /**
- * Creates a new extension type instance in the {@link ExtensionManager}
- * with the given extension type identification.
- *
- * @param manager The {@link ExtensionManager} managing this extension
- * type and its extensions.
- * @param id The Extension Type Identification of this instance.
- */
- /* package */ ExtensionType(ExtensionManager manager, String id) {
- this.manager = manager;
- this.id = id;
- this.extensions = new TreeMap();
- }
-
- /**
- * Returns the Extension Type Identification of this extension type.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Searches in the workspace of this instance's <code>Session</code> for
- * extensions of this type returning an <code>Iterator</code> of
- * {@link ExtensionDescriptor} instances. If <code>root</code> is non-<code>null</code>
- * the search for extensions only takes place in the indicated subtree.
- * <p>
- * <b>NOTE</B>: This method may return more than one extension with the
- * same name for this type. This is the only place in the Jackrabbit
- * Extension Framework which handles duplicate extension names. The rest
- * relies on extensions to have unique <code>id/name</code> pairs.
- * <p>
- * Calling this method multiple times will return the same
- * {@link ExtensionDescriptor} instances. Previously available instances
- * will not be returned though if their extension node has been removed in
- * the meantime. Such instances will still be available through
- * {@link #getExtension(String, String)} but will not be available on next
- * system restart.
- *
- * @param root The root node below which the extensions are looked for. This
- * path is taken as an absolute path regardless of whether it
- * begins with a slash or not. If <code>null</code> or empty,
- * the search takes place in the complete workspace.
- *
- * @return An {@link ExtensionIterator} providing the extensions of this
- * type.
- *
- * @throws ExtensionException If an error occurrs looking for extensions.
- */
- public ExtensionIterator getExtensions(String root) throws ExtensionException {
-
- // make sure root is not null and has no leading slash
- if (root == null) {
- root = "";
- } else if (root.length() >= 1 && root.charAt(0) == '/') {
- root = root.substring(1);
- }
-
- // build the query string from the query pattern
- String queryXPath;
- synchronized (EXTENSION_QUERY_PATTERN) {
- queryXPath = EXTENSION_QUERY_PATTERN.format(new Object[]{ root, id });
- }
-
- log.debug("Looking for extensions of type " + id + " below /" + root);
-
- NodeIterator nodes = manager.findNodes(queryXPath);
- return new ExtensionIterator(this, nodes);
- }
-
- /**
- * Searches in the workspace of this instance's <code>Session</code> for
- * an extension with the given <code>name</code> of type <code>id</code>.
- * If <code>root</code> is non-<code>null</code> the search for extensions
- * only takes place in the indicated subtree.
- * <p>
- * This method fails with an exception if more than one extension with the
- * same name of the same type is found in the workspace. Not finding the
- * requested extension also yields an exception.
- * <p>
- * Two consecutive calls to this method with the same arguments, namely
- * the same <code>id</code> and <code>name</code> will return the same
- * {@link ExtensionDescriptor} instance.
- *
- * @param name The name of the extension of the indicated type to be found.
- * @param root The root node below which the extensions are looked for. This
- * path is taken as an absolute path regardless of whether it begins
- * with a slash or not. If <code>null</code> or empty, the search
- * takes place in the complete workspace.
- *
- * @return The named {@link ExtensionDescriptor} instances.
- *
- * @throws IllegalArgumentException If <code>name</code> is empty or
- * <code>null</code>.
- * @throws ExtensionException If no or more than one extensions with the
- * same name and type can be found or if another error occurrs looking
- * for extensions.
- */
- public ExtensionDescriptor getExtension(String name, String root)
- throws ExtensionException {
-
- // check name
- if (name == null || name.length() == 0) {
- throw new IllegalArgumentException("Extension name must not be" +
- " null or empty string");
- }
-
- // check whether we already loaded the extension
- ExtensionDescriptor ed = getOrCreateExtension(name, null);
- if (ed != null) {
- return ed;
- }
-
- // make sure root is not null and has no leading slash
- if (root == null) {
- root = "";
- } else if (root.length() >= 1 && root.charAt(0) == '/') {
- root = root.substring(1);
- }
-
- // build the query string from the query pattern
- String queryXPath;
- synchronized (EXTENSION_QUERY_PATTERN2) {
- queryXPath = EXTENSION_QUERY_PATTERN2.format(new Object[]{ root, id, name});
- }
-
- log.debug("Looking for extension " + id + "/" + name + " below /" + root);
-
- NodeIterator nodes = manager.findNodes(queryXPath);
- if (!nodes.hasNext()) {
- throw new ExtensionException("Extension " + id + "/" + name +
- " not found");
- }
-
- Node extNode = nodes.nextNode();
- if (nodes.hasNext()) {
- throw new ExtensionException("More than one extension " +
- id + "/" + name + " found");
- }
-
- // load the descriptor and return
- return createExtension(name, extNode);
- }
-
- /**
- * Returns a repository class loader for the given extension. If the
- * extension contains a class path definition, that class path is added to
- * the class loader before returning.
- *
- * @param extension The {@link ExtensionDescriptor} for which to return
- * the class loader.
- *
- * @return The <code>ClassLoader</code> used to load the extension and
- * extension configuration class.
- *
- * @see ExtensionDescriptor#getExtensionLoader()
- * @see ExtensionDescriptor#getExtension()
- */
- /* package */ ClassLoader getClassLoader(ExtensionDescriptor extension) {
-
- if (loader == null) {
- // not created yet, so we create
- loader = manager.createClassLoader();
- }
-
- // make sure the class path for the class path is already defined
- fixClassPath(loader, extension);
-
- // return the class loader now
- return loader;
- }
-
- /**
- * Makes sure, the class path defined in the <code>extension</code> is
- * known to the <code>loader</code>.
- *
- * @param loader The repository class loader whose current class path is
- * ensured to contain the extension's class path.
- * @param extension The extension providing additions to the repository
- * class loader's class path.
- */
- private static void fixClassPath(RepositoryClassLoader loader,
- ExtensionDescriptor extension) {
-
- if (extension.getClassPath() == null) {
- return;
- }
-
- URL[] urls = loader.getURLs();
- Set paths = new HashSet();
- for (int i=0; i < urls.length; i++) {
- paths.add(urls[i].getPath());
- }
-
- String[] classPath = extension.getClassPath();
- for (int i=0; i < classPath.length; i++) {
- if (!paths.contains(classPath[i])) {
- loader.addHandle(classPath[i]);
- }
- }
- }
-
- //---------- Object overwrite ---------------------------------------------
-
- /**
- * Returns the hash code of this types extension type identification.
- */
- public int hashCode() {
- return id.hashCode();
- }
-
- /**
- * Returns <code>true</code> if <code>obj</code> is <code>this</code> or
- * if it is an <code>ExtensionType</code> with the same extension type
- * identification as <code>this</code>.
- */
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof ExtensionType) {
- return id.equals(((ExtensionType) obj).getId());
- } else {
- return false;
- }
- }
-
- /**
- * Returns a string representation of this instance including the extension
- * type identification.
- */
- public String toString() {
- return "Extension type " + getId();
- }
-
- //--------- internal helper -----------------------------------------------
-
- /**
- * Returns an {@link ExtensionDescriptor} for the name extension optionally
- * loaded from the <code>extNode</code>. If this type has already loaded
- * an extension with the given name, that extension descriptor is returned.
- * Otherwise a new extension descriptor is created from the extension node
- * and internally cached before being returned.
- *
- * @param name The name of the extension for which to return the descriptor.
- * @param extNode The <code>Node</code> containing the extension definition
- * to be loaded if this instance has not loaded the named extension
- * yet. This may be <code>null</code> to prevent loading an extension
- * descriptor if the named extension has not been loaded yet.
- *
- * @return The name {@link ExtensionDescriptor} or <code>null</code> if this
- * instance has not loaded the named extension yet and
- * <code>extNode</code> is <code>null</code>.
- *
- * @throws ExtensionException If an error occurrs loading the extension
- * descriptor from the <code>extNode</code>.
- */
- /* package */ ExtensionDescriptor getOrCreateExtension(String name, Node extNode)
- throws ExtensionException {
-
- // check whether we already loaded the extension
- ExtensionDescriptor ed = (ExtensionDescriptor) extensions.get(name);
- if (ed != null) {
- return ed;
- }
-
- if (extNode != null) {
- return createExtension(name, extNode);
- }
-
- // fallback to nothing
- return null;
- }
-
- /**
- * Creates and locally registers an {@link ExtensionDescriptor} instance
- * with the given <code>name</code> reading the descriptor from the
- * <code>extNode</code>.
- *
- * @param name The name of the extension to create. This is the name used to
- * register the extension as.
- * @param extNode The <code>Node</code> from which the extension is
- * loaded.
- *
- * @return The newly created and registered {@link ExtensionDescriptor}.
- *
- * @throws ExtensionException If an error occurrs loading the
- * {@link ExtensionDescriptor} from the <code>extNode</code>.
- */
- private ExtensionDescriptor createExtension(String name, Node extNode)
- throws ExtensionException {
- ExtensionDescriptor ed = new ExtensionDescriptor(this, extNode);
- extensions.put(name, ed);
- return ed;
- }
-}
diff --git a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/NodeTypeSupport.java b/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/NodeTypeSupport.java
deleted file mode 100644
index 466e711..0000000
--- a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/NodeTypeSupport.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.extension;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.util.List;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Workspace;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
-import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
-import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
-import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefReader;
-import org.apache.jackrabbit.core.nodetype.compact.ParseException;
-
-/**
- * The <code>NodeTypeSupport</code> contains a single utility method
- * {@link #registerNodeType(Workspace)} to register the required mixin node
- * type <code>rep:jarFile</code> with the repository.
- * <p>
- * If the class loader is not used on a Jackrabbit based repository, loading
- * this class or calling the {@link #registerNodeType(Workspace)} methods may
- * fail with link errors.
- *
- * @author Felix Meschberger
- */
-/* package */ class NodeTypeSupport {
-
- /** Default log */
- private static final Log log = LogFactory.getLog(NodeTypeSupport.class);
-
- /**
- * The name of the class path resource containing the node type definition
- * file used by the {@link #registerNodeType(Workspace)} method to register
- * the required mixin node type (value is "type.cnd").
- */
- private static final String TYPE_FILE = "type.cnd";
-
- /**
- * The encoding used to read the node type definition file (value is
- * "ISO-8859-1").
- */
- private static final String ENCODING = "ISO-8859-1";
-
- /**
- * Registers the required node type (<code>rep:jarFile</code>) with the
- * node type manager available from the given <code>workspace</code>.
- * <p>
- * The <code>NodeTypeManager</code> returned by the <code>workspace</code>
- * is expected to be of type
- * <code>org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl</code> for
- * the node type registration to succeed.
- * <p>
- * This method is not synchronized. It is up to the calling method to
- * prevent paralell execution.
- *
- * @param workspace The <code>Workspace</code> providing the node type
- * manager through which the node type is to be registered.
- *
- * @return <code>true</code> if this class can be used to handle archive
- * class path entries. See above for a description of the test used.
- */
- /* package */ static boolean registerNodeType(Workspace workspace) {
-
- // Access the node type definition file, "fail" if not available
- InputStream ins = NodeTypeSupport.class.getResourceAsStream(TYPE_FILE);
- if (ins == null) {
- log.error("Node type definition file " + TYPE_FILE +
- " not in class path. Cannot define required node type");
- return false;
- }
-
- // Wrap the stream with a reader
- InputStreamReader reader = null;
- try {
- reader = new InputStreamReader(ins, ENCODING);
- } catch (UnsupportedEncodingException uee) {
- log.warn("Required Encoding " + ENCODING + " not supported, " +
- "using platform default encoding", uee);
-
- reader = new InputStreamReader(ins);
- }
-
- try {
- // Create a CompactNodeTypeDefReader
- CompactNodeTypeDefReader cndReader =
- new CompactNodeTypeDefReader(reader, TYPE_FILE);
-
- // Get the List of NodeTypeDef objects
- List ntdList = cndReader.getNodeTypeDefs();
-
- // Get the NodeTypeManager from the Workspace.
- // Note that it must be cast from the generic JCR NodeTypeManager
- // to the Jackrabbit-specific implementation.
- NodeTypeManagerImpl ntmgr =
- (NodeTypeManagerImpl) workspace.getNodeTypeManager();
-
- // Acquire the NodeTypeRegistry
- NodeTypeRegistry ntreg = ntmgr.getNodeTypeRegistry();
-
- // register the node types from the file in a batch
- ntreg.registerNodeTypes(ntdList);
-
- // get here and succeed
- return true;
-
- } catch (ParseException pe) {
- log.error("Unexpected failure to parse compact node defintion " + TYPE_FILE, pe);
-
- } catch (InvalidNodeTypeDefException ie) {
- log.error("Cannot define required node type", ie);
-
- } catch (RepositoryException re) {
- log.error("General problem accessing the repository", re);
-
- } catch (ClassCastException cce) {
- log.error("Unexpected object type encountered", cce);
-
- } finally {
- // make sure the reader is closed - expect to be non-null here !
- try {
- reader.close();
- } catch (IOException ioe) {
- // ignore
- }
- }
-
- // fall back to failure
- return false;
- }
-}
diff --git a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/configuration/ConfigurationIODelegate.java b/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/configuration/ConfigurationIODelegate.java
deleted file mode 100644
index d342871..0000000
--- a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/configuration/ConfigurationIODelegate.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.extension.configuration;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.FileConfiguration;
-
-/**
- * The <code>ConfigurationIODelegate</code> class provides common IO
- * functionality for the
- * {@link org.apache.jackrabbit.extension.configuration.PropertiesNodeConfiguration} and
- * {@link org.apache.jackrabbit.extension.configuration.XMLNodeConfiguration} classes to
- * access configuration Repository Properties to load and save configuration
- * data. In fact, this class may be used to extend any
- * <code>FileConfiguration</code> implementation with support for loading and
- * saveing from/to a JCR repository, not just the above mentioned.
- *
- * @author Felix Meschberger
- */
-public class ConfigurationIODelegate {
-
- /**
- * The <code>FileConfiguration</code> object used to write the
- * configuration.
- */
- private final FileConfiguration config;
-
- /**
- * The <code>Node</code> from which the configuration is loaded.
- */
- private Node jcrNode;
-
- /**
- * The default character encoding when serializing strings from/to files
- * (value is "UTF-8").
- */
- /* package */ static final String ENCODING = "UTF-8";
-
- /**
- * Creates a new instance delegating actual writing of the data to the
- * underlying repository to the given <code>FileConfiguration</code>.
- *
- * @param config The <code>FileConfiguration</code> used for
- * (de-)serializing the configuration data.
- */
- /* package */ ConfigurationIODelegate(FileConfiguration config) {
- this.config = config;
- }
-
- /**
- * Returns the repository <code>Node</code> from which the configuration is
- * loaded resp. to which it is stored.
- */
- /* package */ Node getNode() {
- return jcrNode;
- }
-
- /**
- * Sets the repository <code>Node</code> from which the configuration is
- * loaded resp. to whch it is stored.
- */
- /* package */ void setNode(Node node) {
- this.jcrNode = node;
- }
-
- /**
- * Calls the {@link #load(Node)} method if a repository <code>Node</code>
- * has been set on this delegate. Otherwise calls the <code>load()</code>
- * method of the <code>FileConfiguration</code> object which has been
- * given to this instance at construction time.
- *
- * @throws ConfigurationException If an error occurrs loading the
- * configuration.
- */
- public void load() throws ConfigurationException {
- if (jcrNode != null) {
- load(jcrNode);
- } else {
- config.load();
- }
- }
-
- /**
- * Accesses the configuration property of the given repository
- * <code>Node</code> to open an <code>InputStream</code> and calls the
- * <code>FileConfiguration</code>'s <code>load(InputStream)</code> method
- * to actually load the configuration.
- *
- * @param node The configuration <code>Node</code> from which the
- * configuration is to be read.
- *
- * @throws ConfigurationException If an error occurrs accessing the
- * repository or loading the configuration.
- */
- public void load(Node node) throws ConfigurationException {
- InputStream ins = null;
- try {
- Property configProp = getConfigurationProperty(node);
- ins = configProp.getStream();
-
- config.load(ins);
-
- } catch (RepositoryException re) {
- throw new ConfigurationException(re);
- } finally {
- tryClose(ins);
- }
- }
-
- /**
- * Calls the {@link #save(Node)} method if a repository <code>Node</code>
- * has been set on this delegate. Otherwise calls the <code>save()</code>
- * method of the <code>FileConfiguration</code> object which has been
- * given to this instance at construction time.
- *
- * @throws ConfigurationException If an error occurrs saving the
- * configuration.
- */
- public void save() throws ConfigurationException {
- if (jcrNode != null) {
- save(jcrNode);
- } else {
- config.save();
- }
- }
-
- /**
- * Calls the <code>save(OutputStream)</code> method of the
- * <code>FileConfiguration</code> to store the configuration data into a
- * temporary file, which is then fed into the configuration property
- * retrieved from the given <code>Node</code>.
- *
- * @param node The configuration <code>Node</code> to which the
- * configuration is to be saved.
- *
- * @throws ConfigurationException If an error occurrs accessing the
- * repository or saving the configuration.
- */
- public void save(javax.jcr.Node node) throws ConfigurationException {
- // write the configuration to a temporary file
- OutputStream out = null;
- File tmp = null;
- boolean success = false;
- try {
- tmp = File.createTempFile("srvcfg", ".tmp");
- out = new FileOutputStream(tmp);
- config.save(out);
- success = true;
- } catch (IOException ioe) {
- throw new ConfigurationException(ioe);
- } finally {
- tryClose(out);
-
- // delete the temp file, if saving failed (--> success == false)
- if (!success && tmp != null) {
- tmp.delete();
- }
- }
-
- InputStream ins = null;
- try {
- ins = new FileInputStream(tmp);
- Property configProp = getConfigurationProperty(node);
-
- // create version before update ???
- boolean doCheckIn = false;
- if (configProp.getParent().isNodeType("mix:versionable") &&
- !configProp.getParent().isCheckedOut()) {
- configProp.getParent().checkout();
- doCheckIn = true;
- }
-
- configProp.setValue(ins);
- configProp.save();
-
- if (doCheckIn) {
- configProp.getParent().checkin();
- }
-
- } catch (IOException ioe) {
- throw new ConfigurationException(ioe);
- } catch (RepositoryException re) {
- throw new ConfigurationException(re);
- } finally {
- tryClose(ins);
- tmp.delete();
- }
- }
-
- /**
- * Returns the property containing configuration data in the given
- * <code>configurationNode</code>. The property to use is found following
- * the the node's primary item trail: While the primary item is a node,
- * the node's primary item is accessed. If it is a property which is not a
- * reference, the property is returned. If the property is a reference,
- * the reference is resolved and this step is repeated.
- * <p>
- * If no configuration property can be found this method throws a
- * <code>RepositoryException</code>.
- *
- * @param configurationNode The <code>Node</code> containing property to
- * access at the end of the primary item trail.
- *
- * @return The property containing the configuration.
- *
- * @throws RepositoryException If an error occurrs accessing the node or if
- * no configuration property can be found.
- */
- /* package */ static Property getConfigurationProperty(
- Node configurationNode) throws RepositoryException {
-
- // find the primary item now
- for (;;) {
- Item item = configurationNode.getPrimaryItem();
- if (!item.isNode()) {
- Property prop = (Property) item;
-
- // if the property is not a reference return it
- if (prop.getType() != PropertyType.REFERENCE) {
- return prop;
- }
-
- // otherwise get the referred to node and continue finding
- // the primary item
- item = prop.getNode();
- }
-
- configurationNode = (Node) item;
- }
- }
-
- /**
- * Closes the <code>InputStream</code> <code>in</code> if not
- * <code>null</code> and ignores a potential <code>IOException</code> thrown
- * from closing the stream.
- *
- * @param in The <code>InputStream</code> to close. This may be
- * <code>null</code>.
- */
- public static void tryClose(InputStream in) {
- if (in != null) {
- try {
- in.close();
- } catch (IOException ioe) {
- // ignored by intent
- }
- }
- }
-
- /**
- * Closes the <code>OutputStream</code> <code>out</code> if not
- * <code>null</code> and ignores a potential <code>IOException</code> thrown
- * from closing the stream.
- *
- * @param out The <code>OutputStream</code> to close. This may be
- * <code>null</code>.
- */
- public static void tryClose(OutputStream out) {
- if (out != null) {
- try {
- out.close();
- } catch (IOException ioe) {
- // ignored by intent
- }
- }
- }
-}
diff --git a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/configuration/ItemConfiguration.java b/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/configuration/ItemConfiguration.java
deleted file mode 100644
index c3bb20b..0000000
--- a/contrib/extension-framework/src/main/java/org/apache/jackrabbit/extension/configuration/ItemConfiguration.java
+++ /dev/null
@@ -1,817 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.extension.configuration;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.jcr.NodeIterator;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Value;
-import javax.jcr.ValueFactory;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.ConfigurationKey;
-import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.extension.ExtensionDescriptor;
-
-/**
- * The <code>ItemConfiguration</code> extends the
- * <code>HierarchicalConfiguration</code> class providing support to load the
- * configuration from a repository. It represents the repository subtree from
- * which the configuration is loaded as a configuration tree of configuration
- * nodes and attributes.
- * <p>
- * The configuration is rooted at a user supplied repository node which must be
- * defined such, that properties and child nodes of any type and name may be
- * added. The best way to achieve this is to define the node as of type
- * <code>nt:unstructured</code>.
- * <p>
- * <b>Note on names</b>
- * <p>
- * This implementation uses the repository item names as (basis of) the names of
- * the hierarchy configuration nodes. As such there exists a restriction on
- * those names: The <code>HierarchicalConfiguration</code> extended by this
- * class uses dots (<code>.</code>) as hierarchy level separators. Therefore
- * any configuration node's name with a dot in it will likely lead to unsuable
- * configuration.
- * <p>
- * <i>Therefore it is strongly recommended to not use dots in repository element
- * names to be used by this configuration class.</i>
- * <p id="dataTypeConversion">
- * <b>Data Type Conversion</b>
- * <p>
- * This implementation tries its best to preserve the configuration data type
- * when loading or saving the configuration data. Because the mapping between
- * Java data types supported by the configuration objects and the data types
- * supported by the repository, a mapping has to be applied, which may lead to a
- * certain but acceptable loss of accuracy.
- * <p>
- * When loading values from the repository, the following type conversion
- * applies: <table>
- * <tr>
- * <th>JCR Type
- * <th>Java Type</tr>
- * <tr>
- * <td>Boolean
- * <td>Boolean</tr>
- * <tr>
- * <td>Date
- * <td>Calendar</tr>
- * <tr>
- * <td>Double
- * <td>Double</tr>
- * <tr>
- * <td>Long
- * <td>Long</tr>
- * <tr>
- * <td>Binary, Name, Path, Reference, String, Undefined
- * <td>String</tr>
- * </table>
- * <p>
- * When saveing configuaration data to the repository, the following type
- * conversion applies: <table>
- * <tr>
- * <th>Java Type
- * <th>JCR Type</tr>
- * <tr>
- * <td>String
- * <td>String</tr>
- * <tr>
- * <td>Boolean
- * <td>Boolean</tr>
- * <tr>
- * <td>Calendar
- * <td>Date</tr>
- * <tr>
- * <td>Double or Float
- * <td>Double</tr>
- * <tr>
- * <td>Number except Double and Float
- * <td>Long</tr>
- * <tr>
- * <td>Other types, incl. <code>null</code>
- * <td>String</tr>
- * </table>
- *
- * @author Felix Meschberger
- */
-public class ItemConfiguration extends HierarchicalConfiguration implements
- RepositoryConfiguration {
-
- /** default log */
- private static final Log log = LogFactory.getLog(ExtensionDescriptor.class);
-
- /**
- * The name of the property providing the configuration value of a
- * configuration node.
- */
- private static final String NODE_CONTENT_PROPERTY = "__DEFAULT__";
-
- /**
- * The <code>Node</code> to which this configuration is attached. The
- * configuration data itself is loaded and saved from/to the
- * <code>configuration</code> child node of this node.
- *
- * @see #load(javax.jcr.Node)
- * @see #save(javax.jcr.Node)
- */
- private javax.jcr.Node jcrNode;
-
- /**
- * The backlog of absolute paths of items which backed removed configuration
- * data. This set is worked through to remove the items when the
- * configuration is saved.
- *
- * @see #save(javax.jcr.Node)
- * @see ItemNode#removeReference()
- */
- private Set deleteBackLog;
-
- /**
- * Creates an empty configuration not hooked to any node.
- */
- public ItemConfiguration() {
- super();
- }
-
- /**
- * Creates a configuration attached to the given <code>node</code> and
- * load the configuration data from the <code>configuration</code> child
- * node.
- * <p>
- * If <code>node</code> is <code>null</code>, this constructor has the same
- * effect as the default constructor ({@link #ItemConfiguration()} in that
- * this configuration is not attached to a <code>Node</code> and
- * configuration is not loaded.
- *
- * @param node The <code>Node</code> containing the configuration data.
- *
- * @throws ConfigurationException If an error occurrs loading the
- * configuration data.
- */
- public ItemConfiguration(javax.jcr.Node node) throws ConfigurationException {
- super();
-
- setNode(node);
- load();
- }
-
- /**
- * Returns the <code>Node</code> to which this configuration is attached.
- * If this configuration is not attached to a node, this method returns
- * <code>null</code>.
- */
- public javax.jcr.Node getNode() {
- return jcrNode;
- }
-
- /**
- * Attaches this configuration to the given node to provide
- * ({@link #load(javax.jcr.Node)}) or take ({@link #save(javax.jcr.Node)})
- * configuration data. To detach this configuration from the repository,
- * set <code>node</code> to <code>null</code>.
- *
- * @param node The <code>Node</code> to which this configuration is
- * attached or <code>null</code> to detach the configuration.
- */
- public void setNode(javax.jcr.Node node) {
- // if the new node is different from the old node, remove the current
- // configuration's references
- if (isDifferent(node)) {
- removeReferences(getRoot());
- }
-
- // set the new node
- this.jcrNode = node;
- }
-
- /**
- * Creates an instance of the <code>ItemNode</code> class with an empty
- * reference.
- * <p>
- * As noted in the class comment, the name should not contain a dot,
- * otherwise the <code>HierarchicalConfiguration</code> class will have
- * problems resolving the configuration.
- *
- * @param name The name of the new configuratio node.
- */
- protected Node createNode(String name) {
- return new ItemNode(name, null);
- }
-