Move branches/spring2/trunk to trunk
git-svn-id: https://svn.apache.org/repos/asf/geronimo/xbean/branches/spring2@412595 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/trunk/KEYS b/trunk/KEYS
deleted file mode 100644
index 683f59e..0000000
--- a/trunk/KEYS
+++ /dev/null
@@ -1,46 +0,0 @@
-This file contains the PGP keys of various developers.
-
-Users: pgp < KEYS
- gpg --import KEYS
-Developers:
- pgp -kxa <your name> and append it to this file.
- (pgpk -ll <your name> && pgpk -xa <your name>) >> this file.
- (gpg --list-sigs <your name>
- && gpg --armor --export <your name>) >> this file.
-
-pub 1024D/B4493B94 2006-04-18
-uid Guillaume Nodet <gnodet@apache.org>
-sig 3 B4493B94 2006-04-18 Guillaume Nodet <gnodet@apache.org>
-sub 2048g/25778C36 2006-04-18
-sig B4493B94 2006-04-18 Guillaume Nodet <gnodet@apache.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.4.3 (MingW32)
-
-mQGiBERFeVERBACjfASThn15ynIICr0Gu8quGCl2rSSRar8TsjrbiwYB2MTW35Rg
-NjLU6MN5Nq4d5G8D5aMeoyGODstIHH8zA52sDGeHOMKfDaAraL+lGzElbpmaqP2s
-P+y+J4gDMlxSBoXY5HjfZUTogP4olWYJS0tWTFc6EiXcSH1zCo1rdo1TTwCg9/U5
-q+Us2XbjevKghRbRabl//R0EAIcimKSJf1w/3yVwrYeUh2Op0fM23y+JUAPcG8SD
-lRnHRnIrf2e0pAkQQ32us1zRaHbuHzcJc0lP1eyoQh0KoRZIUq/7mj9q6Dp3H63b
-VNAxU7O4DyPMMmlgTiZCjwN2qBclZ9zegGx51v2UR4b+qKhZZCHOSjdj0Xhq6P1L
-O7G9A/wItw9LtJhVBqXVxL/pNVNA++NneLMdl5OpAAqJtI44oflJpo/FJlnDFuHP
-ueLYZVWWGoOlPW0odKxI3fvMO0ZfTtm4VO0mjEN2kZ/OR8L3c2Tdx9AHS5lVqIh/
-T4fRqXl/zjbdE+ZqYqhEYelZat3V4EhBAmj2jFQiHsSbfMiSerQjR3VpbGxhdW1l
-IE5vZGV0IDxnbm9kZXRAYXBhY2hlLm9yZz6IYAQTEQIAIAUCREV5UQIbAwYLCQgH
-AwIEFQIIAwQWAgMBAh4BAheAAAoJEOzf6jy0STuUE5kAoLn8tQysgB+HBQX+QJxG
-5pnWDb2aAKCbBR+UU/lCBV7JNCUPjOmkmAR9T7kCDQRERXljEAgA3nHJ+5JvtwQI
-Fzw95ZTPdB/4+Do6JzhZssC1L6ZtgjDh3zdEDbloXsyroawwcY6U+unak24iTXlb
-cI/IgZnYIzZcdHM70hi9KtfhSAMRDI+UaFsxLhvx8hcTUV0fzx+B8q6nvdI/8fnj
-J6Cr0EaCmWOqEjERs9NL7va7Y33JirQQ3pwe6VpzaejE+OzpqQMAvfhLw9ucq+l2
-KGTTk/LccQU3sUIF0osAakPXbTPDHXFmqWkIp0GQIExCorW7FBbq+4Edd0n4H54z
-0kP/BLh3M6HgHTUQurV5yw+/enSv7B0wJPiULiUCWN1hb/Vyds9WYo4NPL/MIlxH
-/ZVTUids0wADBQf/WpR4MjKrxrf6G20J+TXBnRV7cZPdx4FsUE8sCQFay4ZzXP24
-tkmWXQ1b8AcmUr6opnuMio6QXV1lFBIU2rrdoJ3uQihrc21cTE5/FzYkFrWH3ESl
-OuYUaqefWJp3B5i8lNoUdShAK4iwjxsM6J1Mnl/TT5V2nwvB38CoAcuKQTmUGNOA
-nECAPGmTy5NQ2YLZzRMHn9HzyWpNKLAEkp0qN9EVZK5TBGSnFP0fBfYPWHg+kaLV
-zpT3KhkzSGjE4cyWoyuIYwSb6/3FLnaCCalYaC8k2mEhw9oFaJc8yyIasKaoAnbP
-WdMXQR32ZSTUwWBd7GyA9U+wLaNamJramQEBFYhJBBgRAgAJBQJERXljAhsMAAoJ
-EOzf6jy0STuUac8AoK8Mz00VwJP+L1IEB+9rlPaWwPAkAKD1W5wHsZzmsaj6pFkp
-umu/OmsStg==
-=EoxD
------END PGP PUBLIC KEY BLOCK-----
diff --git a/trunk/LICENSE.txt b/trunk/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/NOTICE.txt b/trunk/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/maven-xbean-plugin/pom.xml b/trunk/maven-xbean-plugin/pom.xml
deleted file mode 100644
index 92d9d74..0000000
--- a/trunk/maven-xbean-plugin/pom.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>maven-xbean-plugin</artifactId>
- <packaging>maven-plugin</packaging>
- <name>Maven XBean Plugin</name>
- <version>2.4-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-archiver</artifactId>
- <version>1.0-alpha-5</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-archiver</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>xbean-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>qdox</groupId>
- <artifactId>qdox</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>2.0</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java b/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
deleted file mode 100644
index 208ddee..0000000
--- a/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.maven;
-
-import java.beans.PropertyEditorManager;
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.apache.maven.model.Resource;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.apache.tools.ant.BuildException;
-import org.apache.xbean.spring.generator.DocumentationGenerator;
-import org.apache.xbean.spring.generator.GeneratorPlugin;
-import org.apache.xbean.spring.generator.LogFacade;
-import org.apache.xbean.spring.generator.MappingLoader;
-import org.apache.xbean.spring.generator.NamespaceMapping;
-import org.apache.xbean.spring.generator.QdoxMappingLoader;
-import org.apache.xbean.spring.generator.XmlMetadataGenerator;
-import org.apache.xbean.spring.generator.XsdGenerator;
-
-/**
- * @author <a href="gnodet@apache.org">Guillaume Nodet</a>
- * @version $Id: GenerateApplicationXmlMojo.java 314956 2005-10-12 16:27:15Z brett $
- * @goal mapping
- * @description Creates xbean mapping file
- * @phase generate-sources
- */
-public class XBeanMojo extends AbstractMojo implements LogFacade {
-
- /**
- * @parameter expression="${project}"
- * @required
- */
- private MavenProject project;
-
- /**
- * @parameter
- * @required
- */
- private String namespace;
-
- /**
- * @parameter expression="${basedir}/src/main/java"
- * @required
- */
- private File srcDir;
-
- /**
- * @parameter expression="${basedir}/target/xbean/"
- * @required
- */
- private File outputDir;
-
- /**
- * @parameter
- */
- private File schema;
-
- /**
- * @parameter expression="org.apache.xbean.spring.context.impl"
- */
- private String propertyEditorPaths;
-
-
- public void execute() throws MojoExecutionException, MojoFailureException {
- getLog().debug( " ======= XBeanMojo settings =======" );
- getLog().debug( "namespace[" + namespace + "]" );
- getLog().debug( "srcDir[" + srcDir + "]" );
- getLog().debug( "schema[" + schema + "]" );
- getLog().debug( "outputDir[" + outputDir + "]" );
- getLog().debug( "propertyEditorPaths[" + propertyEditorPaths + "]" );
-
- if (schema == null) {
- schema = new File(outputDir, project.getArtifactId() + ".xsd");
- }
-
- if (propertyEditorPaths != null) {
- List editorSearchPath = new LinkedList(Arrays.asList(PropertyEditorManager.getEditorSearchPath()));
- StringTokenizer paths = new StringTokenizer(propertyEditorPaths, " ,");
- editorSearchPath.addAll(Collections.list(paths));
- PropertyEditorManager.setEditorSearchPath((String[]) editorSearchPath.toArray(new String[editorSearchPath.size()]));
- }
-
- ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- try {
- schema.getParentFile().mkdirs();
-
- MappingLoader mappingLoader = new QdoxMappingLoader(namespace, new File[] { srcDir });
- GeneratorPlugin[] plugins = new GeneratorPlugin[]{
- new XmlMetadataGenerator(this, outputDir.getAbsolutePath()),
- new DocumentationGenerator(this, schema),
- new XsdGenerator(this, schema)
- };
-
- // load the mappings
- Set namespaces = mappingLoader.loadNamespaces();
- if (namespaces.isEmpty()) {
- System.out.println("Warning: no namespaces found!");
- }
-
- // generate the files
- for (Iterator iterator = namespaces.iterator(); iterator.hasNext();) {
- NamespaceMapping namespaceMapping = (NamespaceMapping) iterator.next();
- for (int i = 0; i < plugins.length; i++) {
- GeneratorPlugin plugin = plugins[i];
- plugin.generate(namespaceMapping);
- }
- }
-
- Resource res = new Resource();
- res.setDirectory(outputDir.toString());
- project.addResource(res);
-
- log("...done.");
- } catch (Exception e) {
- throw new BuildException(e);
- } finally {
- Thread.currentThread().setContextClassLoader(oldCL);
- }
- }
-
- public void log(String message) {
- getLog().info(message);
- }
-
- public void log(String message, int level) {
- getLog().info(message);
- }
-}
diff --git a/trunk/maven-xbean-plugin/src/main/resources/META-INF/LICENSE b/trunk/maven-xbean-plugin/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/maven-xbean-plugin/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/maven-xbean-plugin/src/main/resources/META-INF/NOTICE b/trunk/maven-xbean-plugin/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/maven-xbean-plugin/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/pom.xml b/trunk/pom.xml
deleted file mode 100644
index ccb756a..0000000
--- a/trunk/pom.xml
+++ /dev/null
@@ -1,310 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>apache</artifactId>
- <groupId>org.apache</groupId>
- <version>1</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean</artifactId>
- <packaging>pom</packaging>
-
- <name>XBean</name>
- <version>2.4-SNAPSHOT</version>
- <description>XBean is a plugin based server architecture.</description>
- <url>http://xbean.org</url>
-
- <issueManagement>
- <system>jira</system>
- <url>http://issues.apache.org/jira/browse/XBEAN</url>
- </issueManagement>
-
- <ciManagement>
- <system>continuum</system>
- <notifiers>
- <notifier>
- <sendOnError>false</sendOnError>
- <sendOnFailure>false</sendOnFailure>
- <address>dev@xbean.org</address>
- </notifier>
- </notifiers>
- </ciManagement>
-
- <mailingLists>
- <mailingList>
- <name>xbean developers</name>
- <subscribe>mailto:dev-subscribe@xbean.org</subscribe>
- <unsubscribe>mailto:dev-unsubscribe@xbean.org</unsubscribe>
- </mailingList>
- <mailingList>
- <name>xbean users</name>
- <subscribe>mailto:user-subscribe@xbean.org</subscribe>
- <unsubscribe>mailto:user-unsubscribe@xbean.org</unsubscribe>
- </mailingList>
- <mailingList>
- <name>xbean source control messages</name>
- <subscribe>mailto:scm-subscribe@xbean.org</subscribe>
- <unsubscribe>mailto:scm-unsubscribe@xbean.org</unsubscribe>
- </mailingList>
- </mailingLists>
-
- <developers>
- <developer>
- <id>chirino</id>
- <name>Hiram Chirino</name>
- <roles>
- <role>Commiter</role>
- </roles>
- <timezone>-5</timezone>
- </developer>
- <developer>
- <id>dain</id>
- <name>Dain Sundstrom</name>
- <email>dain@iq80.com</email>
- <roles>
- <role>Commiter</role>
- </roles>
- <timezone>-8</timezone>
- </developer>
- <developer>
- <id>dblevins</id>
- <name>David Blevins</name>
- <email>dblevins@visi.com</email>
- <roles>
- <role>Commiter</role>
- </roles>
- <timezone>-8</timezone>
- </developer>
- <developer>
- <id>jstrachan</id>
- <name>James Strachan</name>
- <roles>
- <role>Commiter</role>
- </roles>
- <timezone>-8</timezone>
- </developer>
- <developer>
- <id>jvanzyl</id>
- <name>Jason van Zyl</name>
- <roles>
- <role>Commiter</role>
- </roles>
- <timezone>-8</timezone>
- </developer>
- <developer>
- <id>maguro</id>
- <name>Alan D. Cabrera</name>
- <roles>
- <role>Commiter</role>
- </roles>
- <timezone>-8</timezone>
- </developer>
- <developer>
- <id>gnodet</id>
- <name>Guillaume Nodet</name>
- <roles>
- <role>Commiter</role>
- </roles>
- <timezone>+1</timezone>
- </developer>
- </developers>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/geronimo/xbean/trunk</connection>
- <developerConnection>scm:svn:https://${maven.username}@svn.apache.org/repos/asf/geronimo/xbean/trunk</developerConnection>
- <url>http://svn.apache.org/repos/asf/geronimo/xbean/trunk</url>
- </scm>
-
- <build>
- <extensions>
- <extension>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh-external</artifactId>
- <version>1.0-alpha-6</version>
- </extension>
- </extensions>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-release-plugin</artifactId>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-one-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <goals>
- <goal>install-maven-one-repository</goal>
- <goal>deploy-maven-one-repository</goal>
- </goals>
- <configuration>
- <remoteRepositoryId>apache.m1.releases</remoteRepositoryId>
- <remoteRepositoryUrl>scp://minotaur.apache.org/www/cvs.apache.org/repository</remoteRepositoryUrl>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <modules>
- <module>xbean-classpath</module>
- <!--
- <module>xbean-jmx</module>
- -->
- <module>xbean-kernel</module>
- <module>xbean-osgi</module>
- <module>xbean-reflect</module>
- <module>xbean-server</module>
- <module>xbean-spring-common</module>
- <module>xbean-spring-v1</module>
- <module>xbean-spring-v2</module>
- <module>xbean-spring</module>
- <module>xbean-spring-itests</module>
- <module>xbean-telnet</module>
- <module>xbean-tiger</module>
- <module>maven-xbean-plugin</module>
- </modules>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <reporting>
- <plugins>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jxr-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>surefire-report-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </reporting>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- <version>1.6.2</version>
- </dependency>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <version>2.1_2</version>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.7.0</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.3</version>
- </dependency>
- <dependency>
- <groupId>groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>1.0-jsr-03</version>
- </dependency>
- <dependency>
- <groupId>lingo</groupId>
- <artifactId>sca-api</artifactId>
- <version>SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j</artifactId>
- <version>3.0.1</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.equinox</groupId>
- <artifactId>osgi</artifactId>
- <version>3.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.livetribe</groupId>
- <artifactId>livetribe-jmx</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.snmp4j</groupId>
- <artifactId>snmp4j</artifactId>
- <version>1.7.1</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- <version>1.2.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-kernel</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-common</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-v1</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-v2</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>qdox</groupId>
- <artifactId>qdox</artifactId>
- <version>1.5</version>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <distributionManagement>
- <site>
- <id>xbean-website</id>
- <url>scpexe://xbean.org/home/projects/xbean/public_html/maven</url>
- </site>
- </distributionManagement>
-
-</project>
diff --git a/trunk/xbean-classpath/LICENSE.txt b/trunk/xbean-classpath/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-classpath/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-classpath/NOTICE.txt b/trunk/xbean-classpath/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-classpath/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-classpath/pom.xml b/trunk/xbean-classpath/pom.xml
deleted file mode 100644
index 20126e0..0000000
--- a/trunk/xbean-classpath/pom.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-classpath</artifactId>
- <name>XBean :: ClassPath</name>
- <version>2.4-SNAPSHOT</version>
-</project>
diff --git a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/ClassPath.java b/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/ClassPath.java
deleted file mode 100644
index a3cf4a0..0000000
--- a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/ClassPath.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.classpath;
-
-import java.io.File;
-import java.net.URL;
-
-public interface ClassPath {
-
- ClassLoader getClassLoader();
-
- void addJarsToPath(File dir) throws Exception;
-
- void addJarToPath(URL dir) throws Exception;
-}
diff --git a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/ClassPathFactory.java b/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/ClassPathFactory.java
deleted file mode 100644
index b9611ce..0000000
--- a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/ClassPathFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.classpath;
-
-public class ClassPathFactory {
- public static ClassPath createClassPath(String name){
- if (name.equalsIgnoreCase("tomcat")) {
- return new TomcatClassPath();
- } else if (name.equalsIgnoreCase("tomcat-common")) {
- return new TomcatClassPath();
- } else if (name.equalsIgnoreCase("tomcat-webapp")) {
- return new TomcatWebAppClassPath();
- } else if (name.equalsIgnoreCase("bootstrap")) {
- return new SystemClassPath();
- } else if (name.equalsIgnoreCase("system")) {
- return new SystemClassPath();
- } else if (name.equalsIgnoreCase("thread")) {
- return new ContextClassPath();
- } else if (name.equalsIgnoreCase("context")) {
- return new ContextClassPath();
- } else {
- return new ContextClassPath();
- }
- }
-}
diff --git a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/ContextClassPath.java b/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/ContextClassPath.java
deleted file mode 100644
index 68b661a..0000000
--- a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/ContextClassPath.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.classpath;
-
-import java.io.File;
-import java.net.URLClassLoader;
-import java.net.URL;
-
-public class ContextClassPath extends SunURLClassPath {
-
- public ClassLoader getClassLoader() {
- return getContextClassLoader();
- }
-
- public void addJarsToPath(File dir) throws Exception {
- ClassLoader contextClassLoader = getContextClassLoader();
- if (contextClassLoader instanceof URLClassLoader) {
- URLClassLoader loader = (URLClassLoader) contextClassLoader;
- this.addJarsToPath(dir, loader);
- }
- }
-
- public void addJarToPath(URL jar) throws Exception {
- ClassLoader contextClassLoader = getContextClassLoader();
- if (contextClassLoader instanceof URLClassLoader) {
- URLClassLoader loader = (URLClassLoader) contextClassLoader;
- this.addJarToPath(jar, loader);
- }
- }
-}
diff --git a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/SunURLClassPath.java b/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/SunURLClassPath.java
deleted file mode 100644
index 0ea2202..0000000
--- a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/SunURLClassPath.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.classpath;
-
-import java.io.File;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-public abstract class SunURLClassPath implements ClassPath {
- public static ClassLoader getContextClassLoader() {
- return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- }
-
- private java.lang.reflect.Field ucpField;
-
- protected void addJarToPath(final URL jar, final URLClassLoader loader) throws Exception {
- this.getURLClassPath(loader).addURL(jar);
- }
-
- protected void addJarsToPath(final File dir, final URLClassLoader loader) throws Exception {
- if (dir == null || !dir.exists()) return;
- //System.out.println("DIR "+dir);
- // Get the list of jars and zips
- String[] jarNames = dir.list(new java.io.FilenameFilter() {
- public boolean accept(File dir, String name) {
- //System.out.println("FILE "+name);
- return (name.endsWith(".jar") || name.endsWith(".zip"));
- }
- });
-
- // Create URLs from them
- final URL[] jars = new URL[jarNames.length];
- for (int j = 0; j < jarNames.length; j++) {
- jars[j] = new File(dir, jarNames[j]).toURL();
- }
-
- sun.misc.URLClassPath path = getURLClassPath(loader);
- for (int i = 0; i < jars.length; i++) {
- //System.out.println("URL "+jars[i]);
- path.addURL(jars[i]);
- }
- }
-
- protected sun.misc.URLClassPath getURLClassPath(URLClassLoader loader) throws Exception {
- return (sun.misc.URLClassPath) getUcpField().get(loader);
- }
-
- private java.lang.reflect.Field getUcpField() throws Exception {
- if (ucpField == null) {
- // Add them to the URLClassLoader's classpath
- ucpField = (java.lang.reflect.Field) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- java.lang.reflect.Field ucp = null;
- try {
- ucp = URLClassLoader.class.getDeclaredField("ucp");
- ucp.setAccessible(true);
- } catch (Exception e2) {
- e2.printStackTrace();
- }
- return ucp;
- }
- });
- }
-
- return ucpField;
- }
-
-}
diff --git a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/SystemClassPath.java b/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/SystemClassPath.java
deleted file mode 100644
index 57d3a6d..0000000
--- a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/SystemClassPath.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.classpath;
-
-import java.net.URLClassLoader;
-import java.net.URL;
-import java.io.File;
-
-public class SystemClassPath extends SunURLClassPath {
-
- private URLClassLoader sysLoader;
-
- public void addJarsToPath(File dir) throws Exception {
- this.addJarsToPath(dir, getSystemLoader());
- this.rebuildJavaClassPathVariable();
- }
-
- public void addJarToPath(URL jar) throws Exception {
- //System.out.println("[|] SYSTEM "+jar.toExternalForm());
- this.addJarToPath(jar, getSystemLoader());
- this.rebuildJavaClassPathVariable();
- }
-
- public ClassLoader getClassLoader() {
- try {
- return getSystemLoader();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private URLClassLoader getSystemLoader() throws Exception {
- if (sysLoader == null) {
- sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
- }
- return sysLoader;
- }
-
- private void rebuildJavaClassPathVariable() throws Exception {
- sun.misc.URLClassPath cp = getURLClassPath(getSystemLoader());
- URL[] urls = cp.getURLs();
- //for (int i=0; i < urls.length; i++){
- // System.out.println(urls[i].toExternalForm());
- //}
- if (urls.length < 1)
- return;
-
- StringBuffer path = new StringBuffer(urls.length * 32);
-
- File s = new File(urls[0].getFile());
- path.append(s.getPath());
- //System.out.println(s.getPath());
-
- for (int i = 1; i < urls.length; i++) {
- path.append(File.pathSeparator);
-
- s = new File(urls[i].getFile());
- //System.out.println(s.getPath());
- path.append(s.getPath());
- }
- try {
- System.setProperty("java.class.path", path.toString());
- } catch (Exception e) {
- }
- }
-}
diff --git a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/TomcatClassPath.java b/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/TomcatClassPath.java
deleted file mode 100644
index 81f87e2..0000000
--- a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/TomcatClassPath.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.classpath;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-public class TomcatClassPath extends SunURLClassPath {
-
- /**
- * The Tomcat Common ClassLoader
- */
- private final ClassLoader classLoader;
-
- /**
- * The addRepository(String jar) method of the Tomcat Common ClassLoader
- */
- private Method addRepositoryMethod;
- private Method addURLMethod;
-
-
- public TomcatClassPath() {
- this(getCommonLoader(getContextClassLoader()).getParent());
- }
-
- public TomcatClassPath(ClassLoader classLoader){
- this.classLoader = classLoader;
- try {
- addRepositoryMethod = getAddRepositoryMethod();
- } catch (Exception tomcat4Exception) {
- // Must be tomcat 5
- try {
- addURLMethod = getAddURLMethod();
- } catch (Exception tomcat5Exception) {
- throw new RuntimeException("Failed accessing classloader for Tomcat 4 or 5", tomcat5Exception);
- }
- }
- }
-
- private static ClassLoader getCommonLoader(ClassLoader loader) {
- if (loader.getClass().getName().equals("org.apache.catalina.loader.StandardClassLoader")) {
- return loader;
- } else {
- return getCommonLoader(loader.getParent());
- }
- }
-
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-
- public void addJarsToPath(File dir) throws Exception {
- String[] jarNames = dir.list(new java.io.FilenameFilter() {
- public boolean accept(File dir, String name) {
- return (name.endsWith(".jar") || name.endsWith(".zip"));
- }
- });
-
- if (jarNames == null) {
- return;
- }
-
- for (int j = 0; j < jarNames.length; j++) {
- this.addJarToPath(new File(dir, jarNames[j]).toURL());
- }
- rebuild();
- }
-
- public void addJarToPath(URL jar) throws Exception {
- this._addJarToPath(jar);
- rebuild();
- }
-
- public void _addJarToPath(URL jar) throws Exception {
- String path = jar.toExternalForm();
- this.addRepository(path);
- }
-
- public void addRepository(String path) throws Exception {
- if (addRepositoryMethod != null){
- addRepositoryMethod.invoke(getClassLoader(), new Object[]{path});
- } else {
- addURLMethod.invoke(getClassLoader(), new Object[]{new File(path).toURL()});
- }
- }
-
- protected void rebuild() {
- try {
- sun.misc.URLClassPath cp = getURLClassPath((URLClassLoader) getClassLoader());
- URL[] urls = cp.getURLs();
- //for (int i=0; i < urls.length; i++){
- // System.out.println(urls[i].toExternalForm());
- //}
- if (urls.length < 1)
- return;
-
- StringBuffer path = new StringBuffer(urls.length * 32);
-
- File s = new File(urls[0].getFile());
- path.append(s.getPath());
- //System.out.println(s.getPath());
-
- for (int i = 1; i < urls.length; i++) {
- path.append(File.pathSeparator);
-
- s = new File(urls[i].getFile());
- //System.out.println(s.getPath());
- path.append(s.getPath());
- }
- System.setProperty("java.class.path", path.toString());
- } catch (Exception e) {
- }
-
- }
-
- /**
- * This method gets the Tomcat StandardClassLoader.addRepository method
- * via reflection. This allows us to call the addRepository method for
- * Tomcat integration, but doesn't require us to include or ship any
- * Tomcat libraries.
- *
- * @return URLClassLoader.addURL method instance
- */
- private Method getAddURLMethod() throws Exception {
- return (Method) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- Method method = null;
- try {
- Class clazz = URLClassLoader.class;
- method = clazz.getDeclaredMethod("addURL", new Class[]{URL.class});
- method.setAccessible(true);
- return method;
- } catch (Exception e2) {
- e2.printStackTrace();
- }
- return method;
- }
- });
- }
-
- private Method getAddRepositoryMethod() throws Exception {
- return (Method) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- Method method = null;
- try {
- Class clazz = getClassLoader().getClass();
- method = clazz.getDeclaredMethod("addRepository", new Class[]{String.class});
- method.setAccessible(true);
- return method;
- } catch (Exception e2) {
- throw (IllegalStateException) new IllegalStateException("Unable to find or access the addRepository method in StandardClassLoader").initCause(e2);
- }
- }
- });
- }
-
-}
diff --git a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/TomcatWebAppClassPath.java b/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/TomcatWebAppClassPath.java
deleted file mode 100644
index 22ee946..0000000
--- a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/TomcatWebAppClassPath.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.classpath;
-
-public class TomcatWebAppClassPath extends TomcatClassPath {
-
- public TomcatWebAppClassPath() {
- this(getContextClassLoader());
- }
-
- public TomcatWebAppClassPath(ClassLoader classLoader){
- super(classLoader);
- }
-
- protected void rebuild() {
- }
-}
diff --git a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/maven/MavenResolver.java b/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/maven/MavenResolver.java
deleted file mode 100644
index dc0ddb0..0000000
--- a/trunk/xbean-classpath/src/main/java/org/apache/xbean/classpath/maven/MavenResolver.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.classpath.maven;
-
-import java.net.URL;
-
-/**
- * Transitively resolves dependencies using Maven.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class MavenResolver {
-// private final ArtifactFactory artifactFactory;
-// private final Set artifacts = new HashSet();
-
- /**
- * Creates a new resolver.
- */
- public MavenResolver() {
-// artifactFactory = new DefaultArtifactFactory();
- }
-
- /**
- * Add an artifact to resolve.
- * @param groupId the id of the group to which the dependency belongs
- * @param artifactId the id of the artifact to resolve
- * @param version the version of the artifact
- */
- public void addArtifact(String groupId, String artifactId, String version) {
- addArtifact(groupId, artifactId, version, "jar");
- }
-
- /**
- * Add an artifact to resolve.
- * @param groupId the id of the group to which the dependency belongs
- * @param artifactId the id of the artifact to resolve
- * @param version the version of the artifact
- * @param type the type of the artifact
- */
- public void addArtifact(String groupId, String artifactId, String version, String type) {
-// Artifact artifact = artifactFactory.createArtifact( groupId, artifactId, version, "runtime", type );
-// artifacts.add(artifact);
- }
-
- /**
- * Downloads all of the artificts, all of the artificts they depend on and so on.
- * @return the URLs to all artifacts
- */
- public URL[] resolve() {
- return null;
- }
-}
diff --git a/trunk/xbean-classpath/src/main/resources/META-INF/LICENSE b/trunk/xbean-classpath/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-classpath/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-classpath/src/main/resources/META-INF/NOTICE b/trunk/xbean-classpath/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-classpath/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-classpath/src/test/java/org/apache/xbean/classpath/SystemClassPathTest.java b/trunk/xbean-classpath/src/test/java/org/apache/xbean/classpath/SystemClassPathTest.java
deleted file mode 100644
index 9ed78e3..0000000
--- a/trunk/xbean-classpath/src/test/java/org/apache/xbean/classpath/SystemClassPathTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.apache.xbean.classpath;
-
-/**
- * @version $Revision$ $Date$
- */
-
-import junit.framework.TestCase;
-
-public class SystemClassPathTest extends TestCase {
-
- public void testAddJarToPath() throws Exception {
- SystemClassPath systemClassPath = new SystemClassPath();
-
- ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
-
- try {
- systemClassLoader.loadClass("groovy.lang.GroovyShell");
- fail("Class already exists");
- } catch (ClassNotFoundException e) {
- // this should fail
- }
-
-
-// URL groovyJar = new URL("http://www.ibiblio.org/maven/groovy/jars/groovy-SNAPSHOT.jar");
-// systemClassPath.addJarToPath(groovyJar);
-//
-// try {
-// systemClassLoader.loadClass("groovy.lang.GroovyShell");
-// } catch (ClassNotFoundException e) {
-// // this should fail pass
-// fail("Class already exists");
-// }
- }
-}
\ No newline at end of file
diff --git a/trunk/xbean-finder/LICENSE.txt b/trunk/xbean-finder/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-finder/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-finder/NOTICE.txt b/trunk/xbean-finder/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-finder/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-finder/pom.xml b/trunk/xbean-finder/pom.xml
deleted file mode 100644
index 48a486d..0000000
--- a/trunk/xbean-finder/pom.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-finder</artifactId>
- <name>XBean :: Classpath Resource Finder</name>
- <version>2.4-SNAPSHOT</version>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java b/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java
deleted file mode 100644
index 7f4c247..0000000
--- a/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ResourceFinder.java
+++ /dev/null
@@ -1,453 +0,0 @@
-package org.apache.xbean.finder;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.JarURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Iterator;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-public class ResourceFinder {
-
- private final String path;
- private final ClassLoader classLoader;
-
- public ResourceFinder(String path) {
- this(path, Thread.currentThread().getContextClassLoader());
- }
-
- public ResourceFinder(String path, ClassLoader classLoader) {
- this.path = path;
- this.classLoader = classLoader;
- }
-
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- //
- // Find String
- //
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
- public String findString(String key) throws IOException {
- String uri = path + key;
-
- URL resource = classLoader.getResource(uri);
- if (resource == null) {
- throw new IOException("Could not find command in : " + uri);
- }
-
- return readContents(resource);
- }
-
- public List<String> findAllStrings(String key) throws IOException {
- String uri = path + key;
-
- List<String> strings = new ArrayList<String>();
-
- Enumeration<URL> resources = classLoader.getResources(uri);
- while (resources.hasMoreElements()) {
- URL url = resources.nextElement();
- String string = readContents(url);
- strings.add(string);
- }
- return strings;
- }
-
- public List<String> findAvailableStrings(String key) throws IOException {
- String uri = path + key;
-
- List<String> strings = new ArrayList<String>();
-
- Enumeration<URL> resources = classLoader.getResources(uri);
- while (resources.hasMoreElements()) {
- try {
- URL url = resources.nextElement();
- String string = readContents(url);
- strings.add(string);
- } catch (Exception notAvailable) {
- }
- }
- return strings;
- }
-
- public Map<String,String> mapAllStrings(String key) throws IOException {
- Map<String,String> strings = new HashMap<String,String>();
- Map<String, URL> resourcesMap = getResourcesMap(key);
- for (Iterator iterator = resourcesMap.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String name = (String) entry.getKey();
- URL url = (URL) entry.getValue();
- String value = readContents(url);
- strings.put(name,value);
- }
- return strings;
- }
-
- public Map<String,String> mapAvailableStrings(String key) throws IOException {
- Map<String,String> strings = new HashMap<String,String>();
- Map<String, URL> resourcesMap = getResourcesMap(key);
- for (Iterator iterator = resourcesMap.entrySet().iterator(); iterator.hasNext();) {
- try {
- Map.Entry entry = (Map.Entry) iterator.next();
- String name = (String) entry.getKey();
- URL url = (URL) entry.getValue();
- String value = readContents(url);
- strings.put(name,value);
- } catch (Exception notAvailable) {
- }
- }
- return strings;
- }
-
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- //
- // Find Class
- //
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
- public Class findClass(String key) throws IOException, ClassNotFoundException {
- String className = findString(key);
- Class clazz = classLoader.loadClass(className);
- return clazz;
- }
-
- public List<Class> findAllClasses(String key) throws IOException, ClassNotFoundException {
- List<Class> classes = new ArrayList<Class>();
- List<String> strings = findAllStrings(key);
- for (String className : strings) {
- Class clazz = classLoader.loadClass(className);
- classes.add(clazz);
- }
- return classes;
- }
-
- public List<Class> findAvailableClasses(String key) throws IOException {
- List<Class> classes = new ArrayList<Class>();
- List<String> strings = findAvailableStrings(key);
- for (String className : strings) {
- try {
- Class clazz = classLoader.loadClass(className);
- classes.add(clazz);
- } catch (Exception notAvailable) {
- }
- }
- return classes;
- }
-
- public Map<String, Class> mapAllClasses(String key) throws IOException, ClassNotFoundException {
- Map<String, Class> classes = new HashMap<String, Class>();
- Map<String, String> map = mapAllStrings(key);
- for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String string = (String) entry.getKey();
- String className = (String) entry.getValue();
- Class clazz = classLoader.loadClass(className);
- classes.put(string, clazz);
- }
- return classes;
- }
-
- public Map<String, Class> mapAvailableClasses(String key) throws IOException {
- Map<String, Class> classes = new HashMap<String, Class>();
- Map<String, String> map = mapAvailableStrings(key);
- for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
- try {
- Map.Entry entry = (Map.Entry) iterator.next();
- String string = (String) entry.getKey();
- String className = (String) entry.getValue();
- Class clazz = classLoader.loadClass(className);
- classes.put(string, clazz);
- } catch (Exception notAvailable) {
- }
- }
- return classes;
- }
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- //
- // Find Implementation
- //
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
- public Class findImplementation(Class interfase) throws IOException, ClassNotFoundException {
- String className = findString(interfase.getName());
- Class impl = classLoader.loadClass(className);
- if (!interfase.isAssignableFrom(impl)) {
- throw new ClassCastException("Class not of type: " + interfase.getName());
- }
- return impl;
- }
-
- public List<Class> findAllImplementations(Class interfase) throws IOException, ClassNotFoundException {
- List<Class> implementations = new ArrayList<Class>();
- List<String> strings = findAllStrings(interfase.getName());
- for (String className : strings) {
- Class impl = classLoader.loadClass(className);
- if (!interfase.isAssignableFrom(impl)) {
- throw new ClassCastException("Class not of type: " + interfase.getName());
- }
- implementations.add(impl);
- }
- return implementations;
- }
-
- public List<Class> findAvailableImplementations(Class interfase) throws IOException {
- List<Class> implementations = new ArrayList<Class>();
- List<String> strings = findAvailableStrings(interfase.getName());
- for (String className : strings) {
- try {
- Class impl = classLoader.loadClass(className);
- if (interfase.isAssignableFrom(impl)) {
- implementations.add(impl);
- }
- } catch (Exception notAvailable) {
- }
- }
- return implementations;
- }
-
- public Map<String, Class> mapAllImplementations(Class interfase) throws IOException, ClassNotFoundException {
- Map<String, Class> implementations = new HashMap<String, Class>();
- Map<String, String> map = mapAllStrings(interfase.getName());
- for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String string = (String) entry.getKey();
- String className = (String) entry.getValue();
- Class impl = classLoader.loadClass(className);
- if (!interfase.isAssignableFrom(impl)) {
- throw new ClassCastException("Class not of type: " + interfase.getName());
- }
- implementations.put(string, impl);
- }
- return implementations;
- }
-
- public Map<String, Class> mapAvailableImplementations(Class interfase) throws IOException {
- Map<String, Class> implementations = new HashMap<String, Class>();
- Map<String, String> map = mapAvailableStrings(interfase.getName());
- for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
- try {
- Map.Entry entry = (Map.Entry) iterator.next();
- String string = (String) entry.getKey();
- String className = (String) entry.getValue();
- Class impl = classLoader.loadClass(className);
- if (interfase.isAssignableFrom(impl)) {
- implementations.put(string, impl);
- }
- } catch (Exception notAvailable) {
- }
- }
- return implementations;
- }
-
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- //
- // Find Properties
- //
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
- public Properties findProperties(String key) throws IOException {
- String uri = path + key;
-
- URL resource = classLoader.getResource(uri);
- if (resource == null) {
- throw new IOException("Could not find command in : " + uri);
- }
-
- return loadProperties(resource);
- }
-
- public List<Properties> findAllProperties(String key) throws IOException {
- String uri = path + key;
-
- List<Properties> properties = new ArrayList<Properties>();
-
- Enumeration<URL> resources = classLoader.getResources(uri);
- while (resources.hasMoreElements()) {
- URL url = resources.nextElement();
- Properties props = loadProperties(url);
- properties.add(props);
- }
- return properties;
- }
-
- public List<Properties> findAvailableProperties(String key) throws IOException {
- String uri = path + key;
-
- List<Properties> properties = new ArrayList<Properties>();
-
- Enumeration<URL> resources = classLoader.getResources(uri);
- while (resources.hasMoreElements()) {
- try {
- URL url = resources.nextElement();
- Properties props = loadProperties(url);
- properties.add(props);
- } catch (Exception notAvailable) {
- }
- }
- return properties;
- }
-
- public Map<String, Properties> mapAllProperties(String key) throws IOException {
- Map<String, Properties> propertiesMap = new HashMap<String, Properties>();
- Map<String, URL> map = getResourcesMap(key);
- for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String string = (String) entry.getKey();
- URL url = (URL) entry.getValue();
- Properties properties = loadProperties(url);
- propertiesMap.put(string, properties);
- }
- return propertiesMap;
- }
-
- public Map<String, Properties> mapAvailableProperties(String key) throws IOException {
- Map<String, Properties> propertiesMap = new HashMap<String, Properties>();
- Map<String, URL> map = getResourcesMap(key);
- for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
- try {
- Map.Entry entry = (Map.Entry) iterator.next();
- String string = (String) entry.getKey();
- URL url = (URL) entry.getValue();
- Properties properties = loadProperties(url);
- propertiesMap.put(string, properties);
- } catch (Exception notAvailable) {
- }
- }
- return propertiesMap;
- }
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- //
- // Map Resources
- //
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
- public Map<String, URL> getResourcesMap(String key) throws IOException {
- String basePath = path + key;
-
- Map<String, URL> resources = new HashMap<String, URL>();
- if (!basePath.endsWith("/")){
- basePath += "/";
- }
- Enumeration<URL> urls = classLoader.getResources(basePath);
-
- while (urls.hasMoreElements()) {
- URL location = urls.nextElement();
-
- try {
- if (location.getProtocol().equals("jar")) {
-
- readJarEntries(location, basePath, resources);
-
- } else if (location.getProtocol().equals("file")) {
-
- readDirectoryEntries(location, resources);
-
- }
- } catch (Exception e) {
- }
- }
-
- return resources;
- }
-
- private static void readDirectoryEntries(URL location, Map<String, URL> resources) throws MalformedURLException {
- File dir = new File(location.getPath());
- if (dir.isDirectory()) {
- File[] files = dir.listFiles();
- for (File file : files) {
- if (!file.isDirectory()){
- String name = file.getName();
- URL url = file.toURL();
- resources.put(name, url);
- }
- }
- }
- }
-
- private static void readJarEntries(URL location, String basePath, Map<String, URL> resources) throws IOException {
- JarURLConnection conn = (JarURLConnection) location.openConnection();
- JarFile jarfile = conn.getJarFile();
-
- Enumeration<JarEntry> entries = jarfile.entries();
- while (entries != null && entries.hasMoreElements()) {
- JarEntry entry = entries.nextElement();
- String name = entry.getName();
-
- if (entry.isDirectory() || !name.startsWith(basePath) || name.length() == basePath.length()) {
- continue;
- }
-
- name = name.substring(basePath.length());
-
- if (name.contains("/")) {
- continue;
- }
-
- URL resource = new URL(location, name);
- resources.put(name, resource);
- }
- }
-
- private Properties loadProperties(URL resource) throws IOException {
- InputStream in = resource.openStream();
-
- BufferedInputStream reader = null;
- try {
- reader = new BufferedInputStream(in);
- Properties properties = new Properties();
- properties.load(reader);
-
- return properties;
- } finally {
- try {
- in.close();
- reader.close();
- } catch (Exception e) {
- }
- }
- }
-
- private String readContents(URL resource) throws IOException {
- InputStream in = resource.openStream();
- BufferedInputStream reader = null;
- StringBuffer sb = new StringBuffer();
-
- try {
- reader = new BufferedInputStream(in);
-
- int b = reader.read();
- while (b != -1) {
- sb.append((char) b);
- b = reader.read();
- }
-
- return sb.toString().trim();
- } finally {
- try {
- in.close();
- reader.close();
- } catch (Exception e) {
- }
- }
- }
-
-
- public Enumeration doFindCommands() throws IOException {
- return Thread.currentThread().getContextClassLoader().getResources(path);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/main/resources/META-INF/LICENSE b/trunk/xbean-finder/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-finder/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-finder/src/main/resources/META-INF/NOTICE b/trunk/xbean-finder/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-finder/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-finder/src/test/java/org/acme/BarUrlHandler.java b/trunk/xbean-finder/src/test/java/org/acme/BarUrlHandler.java
deleted file mode 100644
index cb7a198..0000000
--- a/trunk/xbean-finder/src/test/java/org/acme/BarUrlHandler.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.acme;
-
-import java.net.URLConnection;
-import java.net.URL;
-import java.io.IOException;
-
-/**
- * @version $Revision$ $Date$
- */
-public class BarUrlHandler extends java.net.URLStreamHandler {
- protected URLConnection openConnection(URL u) throws IOException {
- throw new IOException("bar");
- }
-}
diff --git a/trunk/xbean-finder/src/test/java/org/acme/FooUrlHandler.java b/trunk/xbean-finder/src/test/java/org/acme/FooUrlHandler.java
deleted file mode 100644
index ff0e822..0000000
--- a/trunk/xbean-finder/src/test/java/org/acme/FooUrlHandler.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.acme;
-
-import java.net.URLConnection;
-import java.net.URL;
-import java.io.IOException;
-
-/**
- * @version $Revision$ $Date$
- */
-public class FooUrlHandler extends java.net.URLStreamHandler {
- protected URLConnection openConnection(URL u) throws IOException {
- throw new IOException("foo");
- }
-}
diff --git a/trunk/xbean-finder/src/test/java/org/acme/One.java b/trunk/xbean-finder/src/test/java/org/acme/One.java
deleted file mode 100644
index 41108ab..0000000
--- a/trunk/xbean-finder/src/test/java/org/acme/One.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.acme;
-
-import java.io.Externalizable;
-import java.io.ObjectOutput;
-import java.io.IOException;
-import java.io.ObjectInput;
-
-/**
- * @version $Revision$ $Date$
- */
-public class One implements Externalizable {
- public void writeExternal(ObjectOutput out) throws IOException {
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- }
-
- public String toString() {
- return "one";
- }
-}
diff --git a/trunk/xbean-finder/src/test/java/org/acme/Three.java b/trunk/xbean-finder/src/test/java/org/acme/Three.java
deleted file mode 100644
index 6758b36..0000000
--- a/trunk/xbean-finder/src/test/java/org/acme/Three.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.acme;
-
-/**
- * @version $Revision$ $Date$
- */
-public class Three {
- public String toString() {
- return "three";
- }
-}
diff --git a/trunk/xbean-finder/src/test/java/org/acme/Two.java b/trunk/xbean-finder/src/test/java/org/acme/Two.java
deleted file mode 100644
index a1844c3..0000000
--- a/trunk/xbean-finder/src/test/java/org/acme/Two.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.acme;
-
-import java.io.Externalizable;
-import java.io.ObjectOutput;
-import java.io.IOException;
-import java.io.ObjectInput;
-
-/**
- * @version $Revision$ $Date$
- */
-public class Two implements Externalizable {
- public void writeExternal(ObjectOutput out) throws IOException {
- }
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- }
-
- public String toString() {
- return "two";
- }
-}
diff --git a/trunk/xbean-finder/src/test/java/org/acme/javaURLContextFactory.java b/trunk/xbean-finder/src/test/java/org/acme/javaURLContextFactory.java
deleted file mode 100644
index 02c872b..0000000
--- a/trunk/xbean-finder/src/test/java/org/acme/javaURLContextFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.acme;
-
-import javax.naming.spi.ObjectFactory;
-import javax.naming.Name;
-import javax.naming.Context;
-import java.util.Hashtable;
-
-/**
- * @version $Revision$ $Date$
- */
-public class javaURLContextFactory implements ObjectFactory {
- public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
- return "java";
- }
-}
diff --git a/trunk/xbean-finder/src/test/java/org/acme/kernelURLContextFactory.java b/trunk/xbean-finder/src/test/java/org/acme/kernelURLContextFactory.java
deleted file mode 100644
index 42a30e1..0000000
--- a/trunk/xbean-finder/src/test/java/org/acme/kernelURLContextFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.acme;
-
-import javax.naming.spi.ObjectFactory;
-import javax.naming.Name;
-import javax.naming.Context;
-import java.util.Hashtable;
-
-/**
- * @version $Revision$ $Date$
- */
-public class kernelURLContextFactory implements ObjectFactory {
- public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
- return "kernel";
- }
-}
diff --git a/trunk/xbean-finder/src/test/java/org/acme/ldapURLContextFactory.java b/trunk/xbean-finder/src/test/java/org/acme/ldapURLContextFactory.java
deleted file mode 100644
index 4f31864..0000000
--- a/trunk/xbean-finder/src/test/java/org/acme/ldapURLContextFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.acme;
-
-import javax.naming.spi.ObjectFactory;
-import javax.naming.Name;
-import javax.naming.Context;
-import java.util.Hashtable;
-
-/**
- * @version $Revision$ $Date$
- */
-public class ldapURLContextFactory implements ObjectFactory {
- public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
- return "ldap";
- }
-}
diff --git a/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ResourceFinderTest.java b/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ResourceFinderTest.java
deleted file mode 100644
index b1fc5c0..0000000
--- a/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ResourceFinderTest.java
+++ /dev/null
@@ -1,357 +0,0 @@
-package org.apache.xbean.finder;
-/**
- * @version $Revision$ $Date$
- */
-
-import junit.framework.TestCase;
-import org.acme.BarUrlHandler;
-import org.acme.FooUrlHandler;
-import org.acme.One;
-import org.acme.Three;
-import org.acme.Two;
-import org.acme.javaURLContextFactory;
-import org.acme.kernelURLContextFactory;
-import org.acme.ldapURLContextFactory;
-
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-public class ResourceFinderTest extends TestCase {
- ResourceFinder resourceFinder = new ResourceFinder("META-INF/");
-
- public void testGetResourcesMap1() throws Exception {
- Map<String, URL> resourcesMap = resourceFinder.getResourcesMap("");
- Set<Map.Entry<String, URL>> entries = resourcesMap.entrySet();
- for (Map.Entry<String, URL> entry : entries) {
- String key = entry.getKey();
- URL value = entry.getValue();
-
- assertTrue("key not a directory", !key.contains("/"));
- assertTrue("contains META-INF/", value.getPath().contains("META-INF/"));
- assertTrue("ends with META-INF/" + key, value.getPath().endsWith("META-INF/" + key));
- assertTrue("value not a directory", !value.getPath().endsWith("/"));
- }
- }
-
- public void testGetResourcesMap2() throws Exception {
- String token = "tvshows";
- Map<String, URL> resourcesMap = resourceFinder.getResourcesMap(token);
- Set<Map.Entry<String, URL>> entries = resourcesMap.entrySet();
- for (Map.Entry<String, URL> entry : entries) {
- String key = entry.getKey();
- URL value = entry.getValue();
-
- assertTrue("key not a directory", !key.contains("/"));
- assertTrue("contains META-INF/", value.getPath().contains("META-INF/"));
- assertTrue("ends with META-INF/" + token + "/" + key, value.getPath().endsWith("META-INF/" + token + "/" + key));
- assertTrue("value not a directory", !value.getPath().endsWith("/"));
- }
-
- assertTrue("map contains simpsons.properties", resourcesMap.containsKey("simpsons.properties"));
- assertTrue("map contains familyguy.properties", resourcesMap.containsKey("familyguy.properties"));
- }
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- //
- // Find String
- //
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
- public void testFindString() throws Exception {
- String expected = One.class.getName();
- String actual = resourceFinder.findString("java.io.Serializable");
- assertEquals(expected, actual);
- }
-
- public void testFindAllStrings() throws Exception {
- List<String> manifests = null;
- try {
- manifests = resourceFinder.findAllStrings("MANIFEST.MF");
- } catch (Exception thisIsLegal) {
- return;
- }
-
- assertTrue("manifests found", manifests.size() > 1);
- for (String manifest : manifests) {
- assertTrue("starts with 'Manifest-Version'", manifest.startsWith("Manifest-Version"));
- }
- }
-
- public void testFindAvailableStrings() throws Exception {
- List<String> manifests = resourceFinder.findAvailableStrings("MANIFEST.MF");
-
- assertTrue("manifests found", manifests.size() > 1);
- for (String manifest : manifests) {
- assertTrue("starts with 'Manifest-Version'", manifest.startsWith("Manifest-Version"));
- }
- }
-
- public void testMapAllStrings() throws Exception {
- Map<String, String> resourcesMap = resourceFinder.mapAllStrings("serializables");
-
- assertEquals("map size", 3, resourcesMap.size());
- assertTrue("map contains key 'one'", resourcesMap.containsKey("one"));
- assertEquals(One.class.getName(), resourcesMap.get("one"));
-
- assertTrue("map contains key 'two'", resourcesMap.containsKey("two"));
- assertEquals(Two.class.getName(), resourcesMap.get("two"));
-
- assertTrue("map contains key 'three'", resourcesMap.containsKey("three"));
- assertEquals(Three.class.getName(), resourcesMap.get("three"));
- }
-
- public void testMapAvailableStrings() throws Exception {
- Map<String, String> resourcesMap = resourceFinder.mapAvailableStrings("serializables");
-
- assertEquals("map size", 3, resourcesMap.size());
- assertTrue("map contains key 'one'", resourcesMap.containsKey("one"));
- assertEquals(One.class.getName(), resourcesMap.get("one"));
-
- assertTrue("map contains key 'two'", resourcesMap.containsKey("two"));
- assertEquals(Two.class.getName(), resourcesMap.get("two"));
-
- assertTrue("map contains key 'three'", resourcesMap.containsKey("three"));
- assertEquals(Three.class.getName(), resourcesMap.get("three"));
- }
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- //
- // Find Class
- //
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
- public void testFindClass() throws Exception {
- Class actual = resourceFinder.findClass("java.io.Serializable");
- assertEquals(One.class, actual);
-
- try {
- resourceFinder.findClass("java.io.OutputStream");
- fail("ClassNotFoundException should be thrown");
- } catch (ClassNotFoundException success) {
- // pass
- } catch (Exception e) {
- fail("Wrong exception type was thrown: " + e.getClass().getName());
- }
- }
-
- public void testFindAllClasses() throws Exception {
- List<Class> classes = resourceFinder.findAllClasses("java.io.Serializable");
- assertEquals("size", 1, classes.size());
- assertEquals(One.class, classes.get(0));
-
- try {
- resourceFinder.findAllClasses("java.io.OutputStream");
- fail("ClassNotFoundException should be thrown");
- } catch (ClassNotFoundException success) {
- // pass
- } catch (Exception e) {
- fail("Wrong exception type was thrown: " + e.getClass().getName());
- }
- }
-
- public void testFindAvailableClasses() throws Exception {
- List<Class> classes = resourceFinder.findAvailableClasses("java.io.Serializable");
- assertEquals("size", 1, classes.size());
- assertEquals(One.class, classes.get(0));
-
- classes = resourceFinder.findAvailableClasses("java.io.OutputStream");
- assertEquals("size", 0, classes.size());
- }
-
- public void testMapAllClasses() throws Exception {
- Map<String, Class> resourcesMap = resourceFinder.mapAllClasses("serializables");
-
- assertEquals("map size", 3, resourcesMap.size());
- assertTrue("map contains key 'one'", resourcesMap.containsKey("one"));
- assertEquals(One.class, resourcesMap.get("one"));
-
- assertTrue("map contains key 'two'", resourcesMap.containsKey("two"));
- assertEquals(Two.class, resourcesMap.get("two"));
-
- assertTrue("map contains key 'three'", resourcesMap.containsKey("three"));
- assertEquals(Three.class, resourcesMap.get("three"));
-
- try {
- resourceFinder.mapAllClasses("externalizables");
- fail("ClassNotFoundException should be thrown");
- } catch (ClassNotFoundException success) {
- // pass
- } catch (Exception e) {
- fail("Wrong exception type was thrown: " + e.getClass().getName());
- }
- }
-
- public void testMapAvailableClasses() throws Exception {
- Map<String, Class> resourcesMap = resourceFinder.mapAvailableClasses("externalizables");
-
- assertEquals("map size", 2, resourcesMap.size());
- assertTrue("map contains key 'one'", resourcesMap.containsKey("one"));
- assertEquals(One.class, resourcesMap.get("one"));
-
- assertTrue("map contains key 'two'", resourcesMap.containsKey("two"));
- assertEquals(Two.class, resourcesMap.get("two"));
- }
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- //
- // Find Implementation
- //
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
- public void testFindImplementation() throws Exception {
- Class expected = One.class;
- Class actual = resourceFinder.findImplementation(java.io.Serializable.class);
- assertEquals(expected, actual);
-
- try {
- resourceFinder.findImplementation(java.io.InputStream.class);
- fail("ClassCastException should be thrown");
- } catch (ClassCastException success) {
- } catch (Exception e) {
- fail("Wrong exception type was thrown: " + e.getClass().getName());
- }
- }
-
- public void testFindAllImplementations() throws Exception {
- List<Class> classes = resourceFinder.findAllImplementations(java.io.Serializable.class);
- assertEquals("size", 1, classes.size());
- assertEquals(One.class, classes.get(0));
-
- try {
- resourceFinder.findAllImplementations(java.io.InputStream.class);
- fail("ClassNotFoundException should be thrown");
- } catch (ClassCastException success) {
- } catch (Exception e) {
- fail("Wrong exception type was thrown: " + e.getClass().getName());
- }
- }
-
- public void testMapAllImplementations() throws Exception {
- Map<String, Class> resourcesMap = resourceFinder.mapAllImplementations(javax.naming.spi.ObjectFactory.class);
-
- assertEquals("map size", 3, resourcesMap.size());
- assertTrue("map contains key 'java'", resourcesMap.containsKey("java"));
- assertEquals(javaURLContextFactory.class, resourcesMap.get("java"));
-
- assertTrue("map contains key 'kernel'", resourcesMap.containsKey("kernel"));
- assertEquals(kernelURLContextFactory.class, resourcesMap.get("kernel"));
-
- assertTrue("map contains key 'ldap'", resourcesMap.containsKey("ldap"));
- assertEquals(ldapURLContextFactory.class, resourcesMap.get("ldap"));
-
- try {
- resourceFinder.mapAllImplementations(java.net.URLStreamHandler.class);
- fail("ClassNotFoundException should be thrown");
- } catch (ClassCastException success) {
- // pass
- } catch (Exception e) {
- fail("Wrong exception type was thrown: " + e.getClass().getName());
- }
- }
-
- public void testMapAvailableImplementations() throws Exception {
- Map<String, Class> resourcesMap = resourceFinder.mapAvailableImplementations(java.net.URLStreamHandler.class);
-
- assertEquals("map size", 2, resourcesMap.size());
- assertTrue("map contains key 'bar'", resourcesMap.containsKey("bar"));
- assertEquals(BarUrlHandler.class, resourcesMap.get("bar"));
-
- assertTrue("map contains key 'foo'", resourcesMap.containsKey("foo"));
- assertEquals(FooUrlHandler.class, resourcesMap.get("foo"));
- }
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- //
- // Find Properties
- //
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
- public void testFindProperties() throws Exception {
- Properties properties = resourceFinder.findProperties("tvshows/familyguy.properties");
- assertNotNull("properties", properties);
- validateFamilyGuy(properties);
-
- properties = resourceFinder.findProperties("tvshows/simpsons.properties");
- assertNotNull("properties", properties);
- validateSimpsons(properties);
- }
-
- public void testFindAllProperties() throws Exception {
- List<Properties> propertiesLists = resourceFinder.findAllProperties("tvshows/familyguy.properties");
- assertNotNull("properties", propertiesLists);
- assertEquals("list size", 1, propertiesLists.size());
-
- Properties properties = propertiesLists.get(0);
- validateFamilyGuy(properties);
- }
-
- public void testFindAvailableProperties() throws Exception {
- List<Properties> propertiesLists = resourceFinder.findAvailableProperties("tvshows/familyguy.properties");
- assertNotNull("properties", propertiesLists);
- assertEquals("list size", 1, propertiesLists.size());
-
- Properties properties = propertiesLists.get(0);
- validateFamilyGuy(properties);
- }
-
- public void testMapAllProperties() throws Exception {
- Map<String, Properties> propertiesMap = resourceFinder.mapAllProperties("tvshows");
- assertNotNull("properties", propertiesMap);
- assertEquals("map size", 2, propertiesMap.size());
-
- assertTrue("contains 'familyguy.properties'", propertiesMap.containsKey("familyguy.properties"));
- validateFamilyGuy(propertiesMap.get("familyguy.properties"));
-
- assertTrue("contains 'simpsons.properties'", propertiesMap.containsKey("simpsons.properties"));
- validateSimpsons(propertiesMap.get("simpsons.properties"));
-
- try {
- resourceFinder.mapAllProperties("movies");
- } catch (Exception success) {
- }
-
- }
-
- public void testMapAvailableProperties() throws Exception {
- Map<String, Properties> propertiesMap = resourceFinder.mapAvailableProperties("movies");
- assertNotNull("properties", propertiesMap);
- assertEquals("map size", 2, propertiesMap.size());
-
- assertTrue("contains 'serenity.properties'", propertiesMap.containsKey("serentity.properties"));
- Properties properties = propertiesMap.get("serentity.properties");
- assertEquals("director", "Joss Whedon", properties.getProperty("director"));
- assertEquals("star", "Nathan Fillion", properties.getProperty("star"));
- assertEquals("year", "2005", properties.getProperty("year"));
-
- assertTrue("contains 'kingkong.properties'", propertiesMap.containsKey("kingkong.properties"));
- properties = propertiesMap.get("kingkong.properties");
- assertEquals("director", "Peter Jackson", properties.getProperty("director"));
- assertEquals("star", "Naomi Watts", properties.getProperty("star"));
- assertEquals("year", "2005", properties.getProperty("year"));
- }
-
- private void validateSimpsons(Properties properties) {
- assertEquals("props size", 6, properties.size());
- assertEquals("creator", "Matt Groening", properties.getProperty("creator"));
- assertEquals("father", "Homer", properties.getProperty("father"));
- assertEquals("mother", "Marge", properties.getProperty("mother"));
- assertEquals("son", "Bart", properties.getProperty("son"));
- assertEquals("daughter", "Lisa", properties.getProperty("daughter"));
- assertEquals("baby", "Maggie", properties.getProperty("baby"));
- }
-
- private void validateFamilyGuy(Properties properties) {
- assertEquals("props size", 6, properties.size());
- assertEquals("creator", "Seth MacFarlane", properties.getProperty("creator"));
- assertEquals("father", "Peter", properties.getProperty("father"));
- assertEquals("mother", "Lois", properties.getProperty("mother"));
- assertEquals("son", "Chris", properties.getProperty("son"));
- assertEquals("daughter", "Meg", properties.getProperty("daughter"));
- assertEquals("baby", "Stewie", properties.getProperty("baby"));
- }
-
-
-}
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/externalizables/one b/trunk/xbean-finder/src/test/resources/META-INF/externalizables/one
deleted file mode 100644
index cf3474e..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/externalizables/one
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.One
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/externalizables/three b/trunk/xbean-finder/src/test/resources/META-INF/externalizables/three
deleted file mode 100644
index c343100..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/externalizables/three
+++ /dev/null
@@ -1 +0,0 @@
-org.openejb.ClassThatDoesntExist
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/externalizables/two b/trunk/xbean-finder/src/test/resources/META-INF/externalizables/two
deleted file mode 100644
index 6b1951b..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/externalizables/two
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.Two
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/java.io.InputStream b/trunk/xbean-finder/src/test/resources/META-INF/java.io.InputStream
deleted file mode 100644
index cf3474e..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/java.io.InputStream
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.One
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/java.io.OutputStream b/trunk/xbean-finder/src/test/resources/META-INF/java.io.OutputStream
deleted file mode 100644
index c343100..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/java.io.OutputStream
+++ /dev/null
@@ -1 +0,0 @@
-org.openejb.ClassThatDoesntExist
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/java.io.Serializable b/trunk/xbean-finder/src/test/resources/META-INF/java.io.Serializable
deleted file mode 100644
index cf3474e..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/java.io.Serializable
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.One
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/bar b/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/bar
deleted file mode 100644
index 784873d..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/bar
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.BarUrlHandler
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/baz b/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/baz
deleted file mode 100644
index 1ac2eee..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/baz
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.Three
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/foo b/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/foo
deleted file mode 100644
index bd28e83..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/java.net.URLStreamHandler/foo
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.FooUrlHandler
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/java b/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/java
deleted file mode 100644
index 5a12376..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/java
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.javaURLContextFactory
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/kernel b/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/kernel
deleted file mode 100644
index 3f367b5..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/kernel
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.kernelURLContextFactory
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/ldap b/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/ldap
deleted file mode 100644
index 3022d0f..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/javax.naming.spi.ObjectFactory/ldap
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.ldapURLContextFactory
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/movies/ishtar.properties b/trunk/xbean-finder/src/test/resources/META-INF/movies/ishtar.properties
deleted file mode 100644
index 8fa77df..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/movies/ishtar.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-# Malformed \uxxxx encoding
-\u999
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/movies/kingkong.properties b/trunk/xbean-finder/src/test/resources/META-INF/movies/kingkong.properties
deleted file mode 100644
index 3d16ad2..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/movies/kingkong.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-director=Peter Jackson
-star=Naomi Watts
-year=2005
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/movies/serentity.properties b/trunk/xbean-finder/src/test/resources/META-INF/movies/serentity.properties
deleted file mode 100644
index 0034eaf..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/movies/serentity.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-director=Joss Whedon
-star=Nathan Fillion
-year=2005
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/serializables/one b/trunk/xbean-finder/src/test/resources/META-INF/serializables/one
deleted file mode 100644
index cf3474e..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/serializables/one
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.One
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/serializables/three b/trunk/xbean-finder/src/test/resources/META-INF/serializables/three
deleted file mode 100644
index 1ac2eee..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/serializables/three
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.Three
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/serializables/two b/trunk/xbean-finder/src/test/resources/META-INF/serializables/two
deleted file mode 100644
index 6b1951b..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/serializables/two
+++ /dev/null
@@ -1 +0,0 @@
-org.acme.Two
\ No newline at end of file
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/tvshows/familyguy.properties b/trunk/xbean-finder/src/test/resources/META-INF/tvshows/familyguy.properties
deleted file mode 100644
index 443d03d..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/tvshows/familyguy.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-creator=Seth MacFarlane
-father=Peter
-mother=Lois
-son=Chris
-daughter=Meg
-baby=Stewie
diff --git a/trunk/xbean-finder/src/test/resources/META-INF/tvshows/simpsons.properties b/trunk/xbean-finder/src/test/resources/META-INF/tvshows/simpsons.properties
deleted file mode 100644
index 28a98f5..0000000
--- a/trunk/xbean-finder/src/test/resources/META-INF/tvshows/simpsons.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-creator=Matt Groening
-father=Homer
-mother=Marge
-son=Bart
-daughter=Lisa
-baby=Maggie
diff --git a/trunk/xbean-jaxb/.classpath b/trunk/xbean-jaxb/.classpath
deleted file mode 100644
index 4f76bfb..0000000
--- a/trunk/xbean-jaxb/.classpath
+++ /dev/null
@@ -1,16 +0,0 @@
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
- <classpathentry kind="src" path="src/test/resources" output="target/test-classes"/>
- <classpathentry kind="src" path="target/generated-sources/xjc"/>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/jaxb/activation/1.0.2/activation-1.0.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/jaxb/jsr173_api/1.0/jsr173_api-1.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/springframework/spring/2.0-m4/spring-2.0-m4.jar"/>
- <classpathentry kind="var" path="M2_REPO/jaxb/jaxb-impl/2.0-SNAPSHOT/jaxb-impl-2.0-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/jaxb/jaxb-api/2.0-SNAPSHOT/jaxb-api-2.0-SNAPSHOT.jar"/>
-</classpath>
\ No newline at end of file
diff --git a/trunk/xbean-jaxb/.project b/trunk/xbean-jaxb/.project
deleted file mode 100644
index b9c99cf..0000000
--- a/trunk/xbean-jaxb/.project
+++ /dev/null
@@ -1,14 +0,0 @@
-<projectDescription>
- <name>xbean-jaxb</name>
- <comment>XBean is a plugin based server architecture.</comment>
- <projects/>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments/>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
\ No newline at end of file
diff --git a/trunk/xbean-jaxb/.settings/org.eclipse.jdt.core.prefs b/trunk/xbean-jaxb/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 5451173..0000000
--- a/trunk/xbean-jaxb/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-#Mon May 08 11:59:13 PDT 2006
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
diff --git a/trunk/xbean-jaxb/LICENSE.txt b/trunk/xbean-jaxb/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-jaxb/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-jaxb/NOTICE.txt b/trunk/xbean-jaxb/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-jaxb/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-jaxb/README.txt b/trunk/xbean-jaxb/README.txt
deleted file mode 100644
index 46f23cb..0000000
--- a/trunk/xbean-jaxb/README.txt
+++ /dev/null
@@ -1 +0,0 @@
-This module provides a simple dependency injection container using JAXB2
diff --git a/trunk/xbean-jaxb/pom.xml b/trunk/xbean-jaxb/pom.xml
deleted file mode 100644
index 85660b1..0000000
--- a/trunk/xbean-jaxb/pom.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright 2005 The Apache Software Foundation
-
- 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.
--->
-<!-- $Rev: 356052 $ $Date: 2005-12-11 14:41:20 -0800 (dim., 11 déc. 2005) $ -->
-<project>
-
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-jaxb</artifactId>
- <name>XBean :: JAXB</name>
- <version>2.4-SNAPSHOT</version>
-
- <pluginRepositories>
- <pluginRepository>
- <id>java.net</id>
- <name>java.net Maven Repository</name>
- <url>https://maven-repository.dev.java.net/nonav/repository</url>
- <layout>legacy</layout>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
-
- <repositories>
- <repository>
- <id>java.net</id>
- <name>java.net Maven Repository</name>
- <url>https://maven-repository.dev.java.net/nonav/repository</url>
- <layout>legacy</layout>
- </repository>
- </repositories>
-
- <build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- <testResource>
- <directory>target/test-generated</directory>
- </testResource>
- </testResources>
-
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>com.sun.tools.xjc.maven2</groupId>
- <artifactId>maven-jaxb-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <generatePackage>org.apache.xbean.jaxb.schema</generatePackage>
- <includeSchemas>
- <includeSchema>spring-beans.xsd</includeSchema>
- </includeSchemas>
- <excludeSchemas>
- <excludeSchema>test*.xsd</excludeSchema>
- </excludeSchemas>
- <includeBindings>
- <includeBinding>*.xjb</includeBinding>
- </includeBindings>
- <strict>true</strict>
- <verbose>true</verbose>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>jaxb</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>jaxb</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- <version>2.0-m4</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextEntry.java b/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextEntry.java
deleted file mode 100644
index 1e0ba65..0000000
--- a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextEntry.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jaxb;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAnyElement;
-import javax.xml.bind.annotation.XmlAttribute;
-
-/**
- * Represents an entry in a context
- *
- * @version $Revision: 1.1 $
- */
-@XmlAccessorType(value=XmlAccessType.FIELD)
-public class ContextEntry {
- @XmlAttribute
- private String key;
- @XmlAnyElement(lax = true)
- private Object value;
-
- public ContextEntry() {
- }
-
- public ContextEntry(String key, Object value) {
- this.key = key;
- this.value = value;
- }
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return "ContextEntry[key: " + key + " value: " + value + "]";
- }
-}
diff --git a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextImpl.java b/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextImpl.java
deleted file mode 100644
index e8bc283..0000000
--- a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/ContextImpl.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.apache.xbean.jaxb;
-
-import org.apache.xbean.jaxb.jndi.DefaultContext;
-
-import javax.naming.Context;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-@XmlRootElement(name = "context")
-public class ContextImpl {
- @XmlTransient
- public Map<String, Object> entries = new HashMap<String, Object>();
-
- // for JAXB
- @XmlElement(name = "entry")
- private ContextEntry[] getEntries() {
- ContextEntry[] r = new ContextEntry[entries.size()];
- int i = 0;
- for (Map.Entry<String, Object> e : entrySet()) {
- r[i++] = new ContextEntry(e.getKey(), e.getValue());
- }
- return r;
- }
-
- private void setEntries(ContextEntry[] v) {
- entries.clear();
- for (ContextEntry e : v)
- entries.put(e.getKey(), e.getValue());
- }
-
- @Override
- public String toString() {
- return "Context" + entries;
- }
-
- public Object get(String name) {
- return entries.get(name);
- }
-
- public void put(String key, Object value) {
- entrySet();
- entries.put(key, value);
- }
-
- public Set<Entry<String, Object>> entrySet() {
- return entries.entrySet();
- }
-
- // JAXB helper methods
- // -------------------------------------------------------------------------
- public void marshal(JAXBContext context, OutputStream os) throws Exception {
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- m.marshal(this, os);
- }
-
- public static ContextImpl load(JAXBContext context, InputStream in) throws Exception {
- return (ContextImpl) context.createUnmarshaller().unmarshal(in);
- }
-
- /**
- * Converts this context into a full JNDI context
- */
- public Context createJndiContext(Hashtable environment) {
- return new DefaultContext(environment, entries);
- }
-
- public void putAll(ContextImpl context) {
- entries.putAll(context.entries);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jaxb.index b/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jaxb.index
deleted file mode 100644
index 87f260e..0000000
--- a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jaxb.index
+++ /dev/null
@@ -1 +0,0 @@
-ContextImpl
\ No newline at end of file
diff --git a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/DefaultContext.java b/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/DefaultContext.java
deleted file mode 100644
index 4833617..0000000
--- a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/DefaultContext.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/**
- *
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jaxb.jndi;
-
-import javax.naming.Binding;
-import javax.naming.CompositeName;
-import javax.naming.Context;
-import javax.naming.LinkRef;
-import javax.naming.Name;
-import javax.naming.NameClassPair;
-import javax.naming.NameNotFoundException;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.NotContextException;
-import javax.naming.OperationNotSupportedException;
-import javax.naming.Reference;
-import javax.naming.spi.NamingManager;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * A simple JNDI context which is mutable
- *
- * @version $Revision: 657 $
- */
-public class DefaultContext implements Context, Serializable {
-
- private static final long serialVersionUID = -5754338187296859149L;
- protected static final NameParser nameParser = new NameParserImpl();
-
- private boolean freeze = false;
-
- protected final Hashtable environment; // environment for this context
- protected final Map bindings; // bindings at my level
- protected final Map treeBindings; // all bindings under me
-
- private boolean frozen = false;
- private String nameInNamespace = "";
- public static final String SEPARATOR = "/";
-
- public DefaultContext() {
- environment = new Hashtable();
- bindings = new HashMap();
- treeBindings = new HashMap();
- }
-
- public DefaultContext(Hashtable env) {
- if (env == null) {
- this.environment = new Hashtable();
- }
- else {
- this.environment = new Hashtable(env);
- }
- this.bindings = new HashMap();
- this.treeBindings = new HashMap();
- }
-
- public DefaultContext(Hashtable environment, Map bindings) {
- if (environment == null) {
- this.environment = new Hashtable();
- }
- else {
- this.environment = new Hashtable(environment);
- }
- this.bindings = bindings;
- treeBindings = new HashMap();
- frozen = true;
- }
-
- public DefaultContext(Hashtable environment, Map bindings, String nameInNamespace) {
- this(environment, bindings);
- this.nameInNamespace = nameInNamespace;
- }
-
- protected DefaultContext(DefaultContext clone, Hashtable env) {
- this.bindings = clone.bindings;
- this.treeBindings = clone.treeBindings;
- this.environment = new Hashtable(env);
- }
-
- protected DefaultContext(DefaultContext clone, Hashtable env, String nameInNamespace) {
- this(clone, env);
- this.nameInNamespace = nameInNamespace;
- }
-
- public Object addToEnvironment(String propName, Object propVal) throws NamingException {
- return environment.put(propName, propVal);
- }
-
- public Hashtable getEnvironment() throws NamingException {
- return (Hashtable) environment.clone();
- }
-
- public Object removeFromEnvironment(String propName) throws NamingException {
- return environment.remove(propName);
- }
-
- public Object lookup(String name) throws NamingException {
- if (name.length() == 0) {
- return this;
- }
- Object result = treeBindings.get(name);
- if (result == null) {
- result = bindings.get(name);
- }
- if (result == null) {
- int pos = name.indexOf(':');
- if (pos > 0) {
- String scheme = name.substring(0, pos);
- Context ctx = NamingManager.getURLContext(scheme, environment);
- if (ctx == null) {
- throw new NamingException("scheme " + scheme + " not recognized");
- }
- return ctx.lookup(name);
- }
- else {
- // Split out the first name of the path
- // and look for it in the bindings map.
- CompositeName path = new CompositeName(name);
-
- if (path.size() == 0) {
- return this;
- }
- else {
- String first = path.get(0);
- Object obj = bindings.get(first);
- if (obj == null) {
- throw new NameNotFoundException(name);
- }
- else if (obj instanceof Context && path.size() > 1) {
- Context subContext = (Context) obj;
- obj = subContext.lookup(path.getSuffix(1));
- }
- return obj;
- }
- }
- }
- if (result instanceof LinkRef) {
- LinkRef ref = (LinkRef) result;
- result = lookup(ref.getLinkName());
- }
- if (result instanceof Reference) {
- try {
- result = NamingManager.getObjectInstance(result, null, null, this.environment);
- }
- catch (NamingException e) {
- throw e;
- }
- catch (Exception e) {
- throw (NamingException) new NamingException("could not look up : " + name).initCause(e);
- }
- }
- if (result instanceof DefaultContext) {
- String prefix = getNameInNamespace();
- if (prefix.length() > 0) {
- prefix = prefix + SEPARATOR;
- }
- result = new DefaultContext((DefaultContext) result, environment, prefix + name);
- }
- return result;
- }
-
- public Object lookup(Name name) throws NamingException {
- return lookup(name.toString());
- }
-
- public Object lookupLink(String name) throws NamingException {
- return lookup(name);
- }
-
- public Name composeName(Name name, Name prefix) throws NamingException {
- Name result = (Name) prefix.clone();
- result.addAll(name);
- return result;
- }
-
- public String composeName(String name, String prefix) throws NamingException {
- CompositeName result = new CompositeName(prefix);
- result.addAll(new CompositeName(name));
- return result.toString();
- }
-
- public NamingEnumeration list(String name) throws NamingException {
- Object o = lookup(name);
- if (o == this) {
- return new DefaultContext.ListEnumeration();
- }
- else if (o instanceof Context) {
- return ((Context) o).list("");
- }
- else {
- throw new NotContextException();
- }
- }
-
- public NamingEnumeration listBindings(String name) throws NamingException {
- Object o = lookup(name);
- if (o == this) {
- return new DefaultContext.ListBindingEnumeration();
- }
- else if (o instanceof Context) {
- return ((Context) o).listBindings("");
- }
- else {
- throw new NotContextException();
- }
- }
-
- public Object lookupLink(Name name) throws NamingException {
- return lookupLink(name.toString());
- }
-
- public NamingEnumeration list(Name name) throws NamingException {
- return list(name.toString());
- }
-
- public NamingEnumeration listBindings(Name name) throws NamingException {
- return listBindings(name.toString());
- }
-
- public void bind(Name name, Object value) throws NamingException {
- bind(name.toString(), value);
- }
-
- public void bind(String name, Object value) throws NamingException {
- checkFrozen();
- internalBind(name, value);
- }
-
- public void close() throws NamingException {
- // ignore
- }
-
- public Context createSubcontext(Name name) throws NamingException {
- throw new OperationNotSupportedException();
- }
-
- public Context createSubcontext(String name) throws NamingException {
- throw new OperationNotSupportedException();
- }
-
- public void destroySubcontext(Name name) throws NamingException {
- throw new OperationNotSupportedException();
- }
-
- public void destroySubcontext(String name) throws NamingException {
- throw new OperationNotSupportedException();
- }
-
- public String getNameInNamespace() throws NamingException {
- return nameInNamespace;
- }
-
- public NameParser getNameParser(Name name) throws NamingException {
- return nameParser;
- }
-
- public NameParser getNameParser(String name) throws NamingException {
- return nameParser;
- }
-
- public void rebind(Name name, Object value) throws NamingException {
- rebind(name.toString(), value);
- }
-
- public void rebind(String name, Object value) throws NamingException {
- checkFrozen();
- internalBind(name, value, true);
- }
-
- public void rename(Name oldName, Name newName) throws NamingException {
- checkFrozen();
- Object value = lookup(oldName);
- unbind(oldName);
- bind(newName, value);
- }
-
- public void rename(String oldName, String newName) throws NamingException {
- Object value = lookup(oldName);
- unbind(oldName);
- bind(newName, value);
- }
-
- public void unbind(Name name) throws NamingException {
- unbind(name.toString());
- }
-
- public void unbind(String name) throws NamingException {
- checkFrozen();
- internalBind(name, null, true);
- }
-
- private abstract class LocalNamingEnumeration implements NamingEnumeration {
- private Iterator i = bindings.entrySet().iterator();
-
- public boolean hasMore() throws NamingException {
- return i.hasNext();
- }
-
- public boolean hasMoreElements() {
- return i.hasNext();
- }
-
- protected Map.Entry getNext() {
- return (Map.Entry) i.next();
- }
-
- public void close() throws NamingException {
- }
- }
-
- private class ListEnumeration extends DefaultContext.LocalNamingEnumeration {
- public Object next() throws NamingException {
- return nextElement();
- }
-
- public Object nextElement() {
- Map.Entry entry = getNext();
- return new NameClassPair((String) entry.getKey(), entry.getValue().getClass().getName());
- }
- }
-
- private class ListBindingEnumeration extends DefaultContext.LocalNamingEnumeration {
- public Object next() throws NamingException {
- return nextElement();
- }
-
- public Object nextElement() {
- Map.Entry entry = getNext();
- return new Binding((String) entry.getKey(), entry.getValue());
- }
- }
-
- public Map getEntries() {
- return new HashMap(bindings);
- }
-
- public void setEntries(Map entries) throws NamingException {
- if (entries != null) {
- for (Iterator iter = entries.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- String name = (String) entry.getKey();
- Object value = entry.getValue();
- internalBind(name, value);
- }
- }
- }
-
- public boolean isFreeze() {
- return freeze;
- }
-
- public void setFreeze(boolean freeze) {
- this.freeze = freeze;
- }
-
- /**
- * internalBind is intended for use only during setup or possibly by suitably synchronized superclasses.
- * It binds every possible lookup into a map in each context. To do this, each context
- * strips off one name segment and if necessary creates a new context for it. Then it asks that context
- * to bind the remaining name. It returns a map containing all the bindings from the next context, plus
- * the context it just created (if it in fact created it). (the names are suitably extended by the segment
- * originally lopped off).
- *
- * @param name
- * @param value
- * @return
- * @throws javax.naming.NamingException
- */
- protected Map internalBind(String name, Object value) throws NamingException {
- return internalBind(name, value, false);
-
- }
- protected Map internalBind(String name, Object value, boolean allowRebind) throws NamingException {
-
- if (name == null || name.length() == 0){
- throw new NamingException("Invalid Name " + name);
- }
- if (frozen){
- throw new NamingException("Read only");
- }
-
- Map newBindings = new HashMap();
- int pos = name.indexOf('/');
- if (pos == -1) {
- Object oldValue = treeBindings.put(name, value);
- if (!allowRebind && oldValue != null) {
- throw new NamingException("Something already bound at " + name);
- }
- bindings.put(name, value);
- newBindings.put(name, value);
- }
- else {
- String segment = name.substring(0, pos);
-
- if (segment == null || segment.length()==0){
- throw new NamingException("Invalid segment " + segment);
- }
- Object o = treeBindings.get(segment);
- if (o == null) {
- o = newContext();
- treeBindings.put(segment, o);
- bindings.put(segment, o);
- newBindings.put(segment, o);
- }
- else if (!(o instanceof DefaultContext)) {
- throw new NamingException("Something already bound where a subcontext should go");
- }
- DefaultContext defaultContext = (DefaultContext) o;
- String remainder = name.substring(pos + 1);
- Map subBindings = defaultContext.internalBind(remainder, value, allowRebind);
- for (Iterator iterator = subBindings.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String subName = segment + "/" + (String) entry.getKey();
- Object bound = entry.getValue();
- treeBindings.put(subName, bound);
- newBindings.put(subName, bound);
- }
- }
- return newBindings;
- }
-
- protected void checkFrozen() throws OperationNotSupportedException {
- if (isFreeze()) {
- throw new OperationNotSupportedException("JNDI context is frozen!");
- }
- }
-
- protected DefaultContext newContext() {
- return new DefaultContext();
- }
-
-}
diff --git a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/JaxbInitialContextFactory.java b/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/JaxbInitialContextFactory.java
deleted file mode 100644
index 1c8c885..0000000
--- a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/JaxbInitialContextFactory.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.jaxb.jndi;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.xbean.jaxb.ContextImpl;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.spi.InitialContextFactory;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Hashtable;
-
-/**
- * A simple JNDI initial context which loads the JNDI namespace from an XML
- * configuration file using JAXB2. The configuration file can be specified by
- * the {@link Context#PROVIDER_URL} property which can be any spring resource
- * string (classpath://foo.xml, or file://foo/bar.xml or a URL) otherwise the
- * jndi.xml file is found on the classpath.
- *
- * @version $Revision: 657 $
- */
-public class JaxbInitialContextFactory implements InitialContextFactory {
- public static final String JAXB_PACKAGES = "jaxb.packages";
- public static final String DEFAULT_URL = "jndi.xml";
-
- private static final transient Log log = LogFactory.getLog(JaxbInitialContextFactory.class);
-
- private static Context singleton;
-
- /**
- * A factory method which can be used to initialise a singleton JNDI context
- * from inside a Spring.xml such that future calls to new InitialContext()
- * will reuse it
- */
- public static Context makeInitialContext() {
- singleton = new DefaultContext();
- return singleton;
- }
-
- public Context getInitialContext(Hashtable environment) throws NamingException {
- if (singleton != null) {
- return singleton;
- }
- Object value = environment.get(Context.PROVIDER_URL);
- if (value == null) {
- value = DEFAULT_URL;
- }
-
- InputStream in = null;
- ContextImpl answer = null;
- try {
- in = loadResource(value);
- if (in != null) {
- answer = ContextImpl.load(createJaxbContext(environment), in);
- }
- }
- catch (Exception e) {
- log.warn("Caught: " + e, e);
- throw new NamingException("Failed to parse resource: " + value + ". Reason: " + e);
- }
- if (in == null) {
- throw new NamingException("Could not find resource: " + value);
- }
- if (answer == null) {
- throw new NamingException("No context returned after parsing resource: " + value);
- }
- return answer.createJndiContext(environment);
- }
-
- /**
- * Loads the given resource. If the resource is not a URL then it is assumed
- * to be a classpath relative string
- */
- protected InputStream loadResource(Object value) throws IOException, NamingException {
- URL url = null;
- if (value instanceof URL) {
- url = (URL) value;
- }
- else if (value instanceof String) {
- String text = (String) value;
- if (text.indexOf(":") > 0) {
- url = new URL(text);
- }
- else {
- return loadResourceFromClassPath(text);
- }
- }
- if (url != null) {
- if ("classpath".equals(url.getProtocol())) {
- return loadResourceFromClassPath(url.getPath());
- }
- else {
- return url.openStream();
- }
- }
- return null;
- }
-
- protected InputStream loadResourceFromClassPath(String text) throws NamingException {
- InputStream answer = Thread.currentThread().getContextClassLoader().getResourceAsStream(text);
- if (answer == null) {
- answer = getClass().getResourceAsStream(text);
- if (answer == null) {
- throw new NamingException("Could not find resourcE: " + text + " on the classpath");
- }
- }
- return answer;
- }
-
- /**
- * Factory method to create the JAXBContext
- */
- protected JAXBContext createJaxbContext(Hashtable environment) throws JAXBException {
- // TODO dirty hack!!!
- String packages = (String) environment.get(JAXB_PACKAGES);
- if (packages == null) {
- packages = "org.apache.xbean.jaxb";
- }
- return JAXBContext.newInstance(packages);
- }
-}
diff --git a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/NameParserImpl.java b/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/NameParserImpl.java
deleted file mode 100644
index 660aab6..0000000
--- a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/jndi/NameParserImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-
-package org.apache.xbean.jaxb.jndi;
-
-import javax.naming.CompositeName;
-import javax.naming.Name;
-import javax.naming.NameParser;
-import javax.naming.NamingException;
-
-/**
- * A default implementation of {@link NameParser}
- *
- * @version $Revision: 1.2 $
- */
-public class NameParserImpl implements NameParser {
-
- public Name parse(String name) throws NamingException {
- return new CompositeName(name);
- }
-}
diff --git a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/package-info.java b/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/package-info.java
deleted file mode 100644
index 4cf3427..0000000
--- a/trunk/xbean-jaxb/src/main/java/org/apache/xbean/jaxb/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@javax.xml.bind.annotation.XmlSchema(namespace="andi",elementFormDefault=javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
-
-package org.apache.xbean.jaxb;
-
diff --git a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/ContextMarshalTest.java b/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/ContextMarshalTest.java
deleted file mode 100644
index b75881c..0000000
--- a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/ContextMarshalTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jaxb;
-
-import org.apache.xbean.jaxb.example.Address;
-import org.apache.xbean.jaxb.example.BusinessCard;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import java.io.File;
-import java.io.FileOutputStream;
-
-import junit.framework.TestCase;
-
-/**
- *
- * @version $Revision: $
- */
-public class ContextMarshalTest extends TestCase {
-
- protected JAXBContext context;
-
- public void testMarshalThenUnmarshal() throws Exception {
- File dir = new File("target/jaxb-xml");
- dir.mkdirs();
- File file = new File(dir, "xbean.xml");
-
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- ContextImpl oldValue = getBeans();
- System.out.println("OldValue: " + oldValue);
-
- m.marshal(oldValue, new FileOutputStream(file));
- unmarshallContext(file);
- }
-
- public void testUnmarshalExample1() throws Exception {
- unmarshallContext(new File("src/test/resources/org/apache/xbean/jaxb/example1.xml"));
- }
-
- protected void unmarshallContext(File file) throws JAXBException {
- Unmarshaller um = context.createUnmarshaller();
- // um.setSchema(getSchema("schema1.xsd"));
- ContextImpl newValue = (ContextImpl) um.unmarshal(file);
- System.out.println("new Value: " + newValue);
-
- Object foo = newValue.get("foo");
- System.out.println("Foo: " + foo);
- assertNotNull("entry for foo should not be null!", foo);
- System.out.println("Foo is of type: " + foo.getClass());
- }
-
- @Override
- protected void setUp() throws Exception {
- context = JAXBContext.newInstance("org.apache.xbean.jaxb:org.apache.xbean.jaxb.example");
- }
-
- protected ContextImpl getBeans() {
- ContextImpl beans = new ContextImpl();
- beans.put("foo", new BusinessCard("John Doe", "Sr. Widget Designer", "Acme, Inc.", new Address(null,
- "123 Widget Way", "Anytown", "MA", (short) 12345), "123.456.7890", null, "123.456.7891",
- "John.Doe@Acme.ORG"));
- return beans;
- }
-}
diff --git a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/Address.java b/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/Address.java
deleted file mode 100644
index ce54abc..0000000
--- a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/Address.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the "License"). You may not use this file except
- * in compliance with the License.
- *
- * You can obtain a copy of the license at
- * https://jwsdp.dev.java.net/CDDLv1.0.html
- * See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * HEADER in each file and include the License file at
- * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
- * add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your
- * own identifying information: Portions Copyright [yyyy]
- * [name of copyright owner]
- */
-
-package org.apache.xbean.jaxb.example;
-
-import javax.xml.bind.annotation.*;
-
-@XmlType
-public class Address {
-
- private String name;
- private String street;
- private String city;
- private String state;
- private short zip;
-
- public Address() {}
-
- public Address(String name, String street, String city, String state, short zip) {
- this.name = name;
- this.street = street;
- this.city = city;
- this.state = state;
- this.zip = zip;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getStreet() {
- return street;
- }
-
- public void setStreet(String street) {
- this.street = street;
- }
-
- public String getCity() {
- return city;
- }
-
- public void setCity(String city) {
- this.city = city;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public short getZip() {
- return zip;
- }
-
- public void setZip(short zip) {
- this.zip = zip;
- }
-
- public String toString() {
- StringBuilder s = new StringBuilder();
- if(name!=null) s.append(name).append('\n');
- s.append(street).append('\n').append(city).append(", ").append(state).append(" ").append(zip);
- return s.toString();
- }
-}
diff --git a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/BusinessCard.java b/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/BusinessCard.java
deleted file mode 100644
index 1921f40..0000000
--- a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/BusinessCard.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * The contents of this file are subject to the terms
- * of the Common Development and Distribution License
- * (the "License"). You may not use this file except
- * in compliance with the License.
- *
- * You can obtain a copy of the license at
- * https://jwsdp.dev.java.net/CDDLv1.0.html
- * See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL
- * HEADER in each file and include the License file at
- * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
- * add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your
- * own identifying information: Portions Copyright [yyyy]
- * [name of copyright owner]
- */
-
-package org.apache.xbean.jaxb.example;
-
-import javax.xml.bind.annotation.*;
-
-@XmlRootElement
-public class BusinessCard {
-
- private String name;
- private String title;
- private String company;
- private Address address;
- private String phone;
- private String cellPhone;
- private String fax;
- private String email;
-
- public BusinessCard() {}
-
- public BusinessCard(String name, String title, String company, Address address,
- String phone, String cellPhone, String fax, String email) {
- this.name = name;
- this.title = title;
- this.company = company;
- this.address = address;
- this.phone = phone;
- this.cellPhone = cellPhone;
- this.fax = fax;
- this.email = email;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getCompany() {
- return company;
- }
-
- public void setCompany(String company) {
- this.company = company;
- }
-
- public Address getAddress() {
- return address;
- }
-
- public void setAddress(Address address) {
- this.address = address;
- }
-
- public String getPhone() {
- return phone;
- }
-
- public void setPhone(String phone) {
- this.phone = phone;
- }
-
- public String getFax() {
- return fax;
- }
-
- public void setFax(String fax) {
- this.fax = fax;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getCellPhone() {
- return cellPhone;
- }
-
- public void setCellPhone(String cellPhone) {
- this.cellPhone = cellPhone;
- }
-
- public String toString() {
- StringBuilder s = new StringBuilder("BusinessCard: ");
- if(name!=null) s.append(name).append('\n');
- if(title!=null) s.append(title).append('\n');
- if(company!=null) s.append(company).append('\n');
- if(address!=null) s.append(address.toString()).append('\n');
- if(phone!=null) s.append("phone: ").append(phone).append('\n');
- if(cellPhone!=null) s.append("cell: ").append(cellPhone).append('\n');
- if(fax!=null) s.append("fax: ").append(fax).append('\n');
- if(email!=null) s.append(email).append('\n');
- return s.toString();
- }
-}
diff --git a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/jaxb.index b/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/jaxb.index
deleted file mode 100644
index a400130..0000000
--- a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/jaxb.index
+++ /dev/null
@@ -1,2 +0,0 @@
-BusinessCard
-Address
diff --git a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/package-info.java b/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/package-info.java
deleted file mode 100644
index cc4598c..0000000
--- a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/example/package-info.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package org.apache.xbean.jaxb.example;
-
-import javax.xml.bind.annotation.XmlAccessorType;
diff --git a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/jndi/JndiTest.java b/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/jndi/JndiTest.java
deleted file mode 100644
index 0826dfb..0000000
--- a/trunk/xbean-jaxb/src/test/java/org/apache/xbean/jaxb/jndi/JndiTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.jaxb.jndi;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import java.util.Hashtable;
-
-import junit.framework.TestCase;
-
-/**
- *
- * @version $Revision: $
- */
-public class JndiTest extends TestCase {
-
- protected Context context;
-
- public void testContextFromJAXB() throws Exception {
- Object foo = context.lookup("foo");
- System.out.println("Foo: " + foo);
- assertNotNull("entry for foo should not be null!", foo);
- System.out.println("Foo is of type: " + foo.getClass());
- }
-
- @Override
- protected void setUp() throws Exception {
- Hashtable environment = createEnvironment();
- context = new InitialContext(environment );
-
- assertNotNull("Should have created a context!", context);
- }
-
- protected Hashtable createEnvironment() {
- Hashtable answer = new Hashtable();
- answer.put(Context.PROVIDER_URL, "file:src/test/resources/org/apache/xbean/jaxb/example1.xml");
- answer.put(Context.INITIAL_CONTEXT_FACTORY, JaxbInitialContextFactory.class.getName());
- answer.put(JaxbInitialContextFactory.JAXB_PACKAGES, "org.apache.xbean.jaxb:org.apache.xbean.jaxb.example");
- return answer ;
- }
-}
diff --git a/trunk/xbean-jaxb/src/test/resources/org/apache/xbean/jaxb/example1.xml b/trunk/xbean-jaxb/src/test/resources/org/apache/xbean/jaxb/example1.xml
deleted file mode 100644
index e79e53f..0000000
--- a/trunk/xbean-jaxb/src/test/resources/org/apache/xbean/jaxb/example1.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<x:context xmlns:x="andi">
- <x:entry key="foo">
- <businessCard>
- <address>
- <city>Anytown</city>
- <state>MA</state>
- <street>123 Widget Way</street>
- <zip>12345</zip>
- </address>
- <company>Acme, Inc.</company>
- <email>John.Doe@Acme.ORG</email>
- <fax>123.456.7891</fax>
- <name>John Doe</name>
- <phone>123.456.7890</phone>
- <title>Sr. Widget Designer</title>
- </businessCard>
- </x:entry>
-</x:context>
diff --git a/trunk/xbean-jmx/LICENSE.txt b/trunk/xbean-jmx/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-jmx/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-jmx/NOTICE.txt b/trunk/xbean-jmx/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-jmx/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-jmx/pom.xml b/trunk/xbean-jmx/pom.xml
deleted file mode 100644
index 26bf3c4..0000000
--- a/trunk/xbean-jmx/pom.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2005-2006 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean</artifactId>
- <version>2.4-SNAPSHOT</version>
- </parent>
-
- <artifactId>xbean-jmx</artifactId>
- <name>XBean :: JMX</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.xbean</groupId>
- <artifactId>maven-xbean-plugin</artifactId>
- <version>${pom.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>mapping</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <namespace>http://xbean.apache.org/schemas/jmx</namespace>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.livetribe</groupId>
- <artifactId>livetribe-jmx</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.snmp4j</groupId>
- <artifactId>snmp4j</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/EventAdapter.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/EventAdapter.java
deleted file mode 100644
index 1a83b10..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/EventAdapter.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import javax.management.Notification;
-
-
-/**
- * @version $Revision: $ $Date: $
- * @org.apache.xbean.XBean element="listen"
- */
-public class EventAdapter {
- private Object bean;
- private Class listenerClass;
- private String addMethodName;
- private String removeMethodName;
- private Object listener;
-
- public void setBean(Object bean) {
- this.bean = bean;
- }
-
- /**
- * @org.apache.xbean.Property alias="listener"
- */
- public void setListenerClass(Class listenerClass) {
- this.listenerClass = listenerClass;
- }
-
- public void setAddMethodName(String addMethodName) {
- this.addMethodName = addMethodName;
- }
-
- public void setRemoveMethodName(String removeMethodName) {
- this.removeMethodName = removeMethodName;
- }
-
- public void bindListener(Object mbeanAdapter) {
- listener = Proxy.newProxyInstance(listenerClass.getClassLoader(), new Class[]{listenerClass}, new EventInvocationHandler(mbeanAdapter));
- String methodName = addMethodName;
- if (methodName == null) methodName = "add" + getSimpleClassName(listenerClass);
- try {
- Method addMethod = bean.getClass().getMethod(methodName, new Class[]{listenerClass});
- addMethod.invoke(bean, new Object[]{listener});
- }
- catch (NoSuchMethodException x) {
- throw new JMXException(x);
- }
- catch (IllegalAccessException x) {
- throw new JMXException(x);
- }
- catch (InvocationTargetException x) {
- throw new JMXException(x.getCause());
- }
- }
-
- public void unbindListener() {
- String methodName = removeMethodName;
- if (methodName == null) methodName = "remove" + getSimpleClassName(listenerClass);
- try {
- Method addMethod = bean.getClass().getMethod(methodName, new Class[]{listenerClass});
- addMethod.invoke(bean, new Object[]{listener});
- }
- catch (NoSuchMethodException x) {
- throw new JMXException(x);
- }
- catch (IllegalAccessException x) {
- throw new JMXException(x);
- }
- catch (InvocationTargetException x) {
- throw new JMXException(x.getCause());
- }
- }
-
- private String getSimpleClassName(Class cls) {
- String name = cls.getName();
- return name.substring(name.lastIndexOf('.') + 1);
- }
-
- private static class EventInvocationHandler implements InvocationHandler {
- private final Object emitter;
-
- public EventInvocationHandler(Object emitter) {
- this.emitter = emitter;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- if (method.getDeclaringClass() == Object.class) return method.invoke(this, args);
-
- Object event = args[0];
- Notification notification = new Notification(event.getClass().getName(), emitter, 0, System.currentTimeMillis());
- notification.setUserData(event);
-
- try {
- Method send = emitter.getClass().getMethod("sendNotification", new Class[]{Notification.class});
- send.invoke(emitter, new Object[]{notification});
- return null;
- }
- catch (NoSuchMethodException x) {
- throw new JMXException(x);
- }
- catch (IllegalAccessException x) {
- throw new JMXException(x);
- }
- catch (InvocationTargetException x) {
- throw new JMXException(x.getCause());
- }
- }
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/Heartbeat.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/Heartbeat.java
deleted file mode 100644
index 86956a4..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/Heartbeat.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import java.util.Date;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-
-/**
- * Creates JMX heartbeat notifications for the specified timer and at the
- * specified interval.
- *
- * @version $Rev$ $Date$
- */
-public class Heartbeat
-{
- private static final Log log = LogFactory.getLog(Heartbeat.class);
-
- public static final String HEARTBEAT_TYPE = "heartbeat";
- public static final String HEARTBEAT_MESSAGE = "heartbeat message";
-
- private long interval = 10000;
- private ObjectName timerName;
- private MBeanServer server;
- private Integer timerId;
-
- public Heartbeat(MBeanServer server, ObjectName timerName, long interval)
- {
- this.interval = interval;
- this.timerName = timerName;
- this.server = server;
- }
-
- public void start()
- {
- Set lBeans = server.queryMBeans(timerName, null);
-
- if (lBeans.isEmpty())
- {
- throw new RuntimeException("Cannot find Timer MBean!");
- }
-
- ObjectInstance lTimer = (ObjectInstance) lBeans.iterator().next();
-
- try
- {
- log.debug("Adding heartbeat notification.");
- timerId = (Integer) server.invoke(lTimer.getObjectName(),
- "addNotification",
- new Object[]{
- HEARTBEAT_TYPE,
- HEARTBEAT_MESSAGE,
- null, // No user object
- new Date(), // start now
- new Long(interval), // with this interval
- new Long(0) // forever
- },
- new String[]{
- String.class.getName(),
- String.class.getName(),
- Object.class.getName(),
- Date.class.getName(),
- Long.TYPE.getName(),
- Long.TYPE.getName()
- });
- }
- catch (Exception e)
- {
- log.error("Could not register Timer notification!", e);
- }
- }
-
- public void stop()
- {
- try
- {
- server.invoke(timerName,
- "removeNotification",
- new Object[]{timerId},
- new String[]{Integer.class.getName()});
- }
- catch (Exception e)
- {
- log.error("Could not remove Timer notification!", e);
- }
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXException.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXException.java
deleted file mode 100644
index 6058681..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-/**
- * @version $Revision: $ $Date: $
- */
-public class JMXException extends RuntimeException {
- public JMXException() {
- }
-
- public JMXException(String message) {
- super(message);
- }
-
- public JMXException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public JMXException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXServiceException.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXServiceException.java
deleted file mode 100644
index 5add558..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXServiceException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-
-/**
- * @version $Revision: $ $Date: $
- */
-public class JMXServiceException extends Exception {
-
- /**
- * {@inheritDoc}
- */
- public JMXServiceException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public JMXServiceException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public JMXServiceException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public JMXServiceException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXStrategyFinder.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXStrategyFinder.java
deleted file mode 100644
index 34b475d..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXStrategyFinder.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.WeakHashMap;
-
-
-/**
- * @version $Revision: $ $Date: $
- */
-public class JMXStrategyFinder {
-
- private final static String PROPERTY_NAME = "org.apache.xbean.jmx.WrapperStrategyClass";
- private final static String PATH = "META-INF/org.apache.xbean.jmx.StrategyFinder/";
- private final static WeakHashMap classCache = new WeakHashMap();
-
- /**
- * Creates a new instance of the given key
- *
- * @param key is the key to add to the path to find a text file
- * containing the factory name
- * @return a newly created instance
- */
- public static JMXWrappingStrategy newInstance(String key) throws JMXServiceException {
-
- if (key == null) key = "xbean.default";
-
- JMXWrappingStrategy result = null;
- try {
- synchronized (classCache) {
- Class clazz = (Class) classCache.get(key);
- if (clazz == null) {
- clazz = loadClass(doFindServiceWrapperProperies(key));
- classCache.put(key, clazz);
- }
- result = (JMXWrappingStrategy) clazz.newInstance();
- }
- }
- catch (ClassNotFoundException doNothing) {
- throw new JMXServiceException(doNothing);
- }
- catch (IOException doNothing) {
- throw new JMXServiceException(doNothing);
- }
- catch (InstantiationException doNothing) {
- throw new JMXServiceException(doNothing);
- }
- catch (IllegalAccessException doNothing) {
- throw new JMXServiceException(doNothing);
- }
- return result;
- }
-
- private static Class loadClass(Properties properties) throws ClassNotFoundException, IOException {
-
- String className = properties.getProperty(PROPERTY_NAME);
- if (className == null) {
- throw new IOException("Expected property is missing: " + PROPERTY_NAME);
- }
- try {
- return Thread.currentThread().getContextClassLoader().loadClass(className);
- }
- catch (ClassNotFoundException e) {
- return JMXStrategyFinder.class.getClassLoader().loadClass(className);
- }
- }
-
- private static Properties doFindServiceWrapperProperies(String key) throws IOException {
- String uri = PATH + key;
-
- InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri);
- if (in == null) {
- in = JMXStrategyFinder.class.getClassLoader().getResourceAsStream(uri);
- if (in == null) {
- throw new IOException("Could not find strategy class for resource: " + uri);
- }
- }
-
- BufferedInputStream reader = null;
- try {
- reader = new BufferedInputStream(in);
- Properties properties = new Properties();
- properties.load(reader);
- return properties;
- }
- finally {
- try {
- reader.close();
- }
- catch (Exception e) {
- }
- }
- }
-}
\ No newline at end of file
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXWrappingStrategy.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXWrappingStrategy.java
deleted file mode 100644
index 6c4b94c..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/JMXWrappingStrategy.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import java.util.Properties;
-
-
-/**
- * @version $Revision: $ $Date: $
- */
-public interface JMXWrappingStrategy {
-
- /**
- * @param service
- * @param config
- */
- public Object wrapObject(Object service, Properties config) throws JMXServiceException;
-
- /**
- * @param service
- * @param config
- */
- public void unwrapObject(Object service, Properties config);
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanExporter.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanExporter.java
deleted file mode 100644
index eef8662..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanExporter.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import javax.management.InstanceNotFoundException;
-import javax.management.JMException;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-
-/**
- * Exports services to an MBeanServer for management.
- *
- * @version $Revision: $ $Date: $
- * @org.apache.xbean.XBean element="export"
- */
-public class MBeanExporter {
- private MBeanServer mbeanServer;
- private List wrapStrategies;
- private List mbeans;
- private List connectors;
- private Map registeredMBeans = new HashMap();
- private Map configuredClasses = new HashMap();
-
- /**
- * @org.apache.xbean.Property alias="mbeanserver"
- */
- public void setMbeanServer(MBeanServer mbeanServer) {
- this.mbeanServer = mbeanServer;
- }
-
- public MBeanServer getMbeanServer() {
- return mbeanServer;
- }
-
- /**
- * @org.apache.xbean.Property alias="wrapStrategies"
- */
- public void setWrapStrategies(List wrapStrategies) {
- this.wrapStrategies = wrapStrategies;
- }
-
- public List getWrapStrategies() {
- return wrapStrategies;
- }
-
- /**
- * @org.apache.xbean.Property alias="mbeans"
- */
- public void setMbeans(List mbeans) {
- this.mbeans = mbeans;
- }
-
- public List getMbeans() {
- return mbeans;
- }
-
- public void setConnectors(List connectors) {
- this.connectors = connectors;
- }
-
- public List getConnectors() {
- return connectors;
- }
-
- /**
- * @org.apache.xbean.InitMethod
- */
- public void start() {
-
- List strategies = getWrapStrategies();
-
- if (strategies != null) {
- for (int i = 0; i < strategies.size(); i++) {
- MBeanWrap wrap = (MBeanWrap) strategies.get(i);
-
- if (configuredClasses.containsKey(wrap.getBeanClass()))
- throw new IllegalStateException(wrap.getBeanClass() + "configured multiple times in <wrapStrategies/>");
-
- if (wrap.getConfig() == null) wrap.setConfig(new Properties());
-
- configuredClasses.put(wrap.getBeanClass(), wrap);
- }
- }
-
- try {
- MBeanServer server = findMBeanServer();
- List mbeanElements = getMbeans();
- for (int i = 0; i < mbeanElements.size(); i++) {
- MBeanHolder mbean = (MBeanHolder) mbeanElements.get(i);
- MBeanWrap wrap = getWrapConfig(mbean);
-
- ObjectName objectName = mbean.createObjectName();
- JMXWrappingStrategy strategy = JMXStrategyFinder.newInstance(wrap.getStrategy());
- Object mbeanAdapter = strategy.wrapObject(mbean.getBean(), wrap.getConfig());
-
- server.registerMBean(mbeanAdapter, objectName);
-
- mbean.bindListeners(mbeanAdapter);
-
- registeredMBeans.put(objectName, mbean);
- }
- } catch (JMException x) {
- throw new JMXException(x);
- } catch (JMXServiceException e) {
- throw new JMXException(e);
- }
- }
-
- /**
- * @org.apache.xbean.DestroyMethod
- */
- public void stop() {
- MBeanServer server = findMBeanServer();
- for (Iterator iterator = registeredMBeans.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- try {
- server.unregisterMBean((ObjectName) entry.getKey());
- ((MBeanHolder) entry.getValue()).unbindListeners();
- }
- catch (InstanceNotFoundException ignored) {
- }
- catch (MBeanRegistrationException x) {
- throw new JMXException(x);
- }
- }
- }
-
- protected MBeanServer findMBeanServer() {
- MBeanServer server = getMbeanServer();
- if (server != null) return server;
-
- // TODO: handle JDK 5 Platform MBeanServer if data member is null
- throw new JMXException("Cannot find MBeanServer");
- }
-
- protected MBeanWrap getWrapConfig(MBeanHolder mbean) {
- MBeanWrap result;
-
- String className = mbean.getBean().getClass().getName();
- String strategyName = mbean.getWrapStrategy();
-
- result = (MBeanWrap) configuredClasses.get(className);
- if (result != null) {
- if (strategyName != null && !result.getStrategy().equals(strategyName))
- throw new IllegalStateException(className + "configured with " + strategyName + " and " + result.getStrategy());
- } else {
- result = new MBeanWrap();
-
- result.setBeanClass(className);
- result.setStrategy(strategyName);
- result.setConfig(new Properties());
-
- configuredClasses.put(className, result);
- }
-
- return result;
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanHolder.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanHolder.java
deleted file mode 100644
index ea7f001..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanHolder.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-import javax.management.MBeanInfo;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.livetribe.jmx.DynamicMBeanAdapter;
-
-
-/**
- * @version $Revision: $ $Date: $
- * @org.apache.xbean.XBean element="mbean"
- */
-public class MBeanHolder {
- private Object bean;
- private String objectName;
- private String wrapStrategy;
- private Class mbeanClass;
- private List eventAdapters;
-
- public void setBean(Object bean) {
- this.bean = bean;
- }
-
- public Object getBean() {
- return bean;
- }
-
- /**
- * @org.apache.xbean.Property alias="objectname"
- */
- public void setObjectName(String objectName) {
- this.objectName = objectName;
- }
-
- private String getObjectName() {
- return objectName;
- }
-
- public String getWrapStrategy() {
- return wrapStrategy;
- }
-
- public void setWrapStrategy(String wrapStrategy) {
- this.wrapStrategy = wrapStrategy;
- }
-
- public void setMbeanClass(Class mbeanClass) {
- this.mbeanClass = mbeanClass;
- }
-
- private Class getMbeanClass() {
- return mbeanClass;
- }
-
- /**
- * @org.apache.xbean.Property alias="listeners"
- */
- public void setEventAdapters(List adapters) {
- this.eventAdapters = adapters;
- }
-
- private List getEventAdapters() {
- return eventAdapters;
- }
-
- public ObjectName createObjectName() {
- String name = getObjectName();
- try {
- return ObjectName.getInstance(name);
- }
- catch (MalformedObjectNameException x) {
- throw new JMXException(x);
- }
- }
-
- protected Object createMBeanAdapter(MBeanInfo mbeanInfo, ObjectName objectName) {
- try {
- Class adapterClass = getMbeanClass();
- if (adapterClass == null) adapterClass = DynamicMBeanAdapter.class;
- Constructor ctor = adapterClass.getConstructor(new Class[]{Object.class, MBeanInfo.class});
- return ctor.newInstance(new Object[]{getBean(), mbeanInfo});
- }
- catch (NoSuchMethodException x) {
- throw new JMXException(x);
- }
- catch (InstantiationException x) {
- throw new JMXException(x);
- }
- catch (IllegalAccessException x) {
- throw new JMXException(x);
- }
- catch (InvocationTargetException x) {
- throw new JMXException(x.getCause());
- }
- }
-
- public void bindListeners(Object mbeanAdapter) {
- List adapters = getEventAdapters();
- if (adapters != null) {
- for (int i = 0; i < adapters.size(); i++) {
- EventAdapter adapter = (EventAdapter) adapters.get(i);
- adapter.bindListener(mbeanAdapter);
- }
- }
- }
-
- public void unbindListeners() {
- List adapters = getEventAdapters();
- if (adapters != null) {
- for (int i = 0; i < adapters.size(); i++) {
- EventAdapter adapter = (EventAdapter) adapters.get(i);
- adapter.unbindListener();
- }
- }
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanInfoGenerator.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanInfoGenerator.java
deleted file mode 100644
index 6187cce..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanInfoGenerator.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import javax.management.MBeanInfo;
-import javax.management.ObjectName;
-
-
-/**
- * @version $Revision: $ $Date: $
- */
-public interface MBeanInfoGenerator {
- public MBeanInfo createMBeanInfo(Object bean, ObjectName objectName);
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanWrap.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanWrap.java
deleted file mode 100644
index 665307c..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/MBeanWrap.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- *
- * Copyright 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import java.util.Properties;
-
-
-/**
- * @version $Revision: $ $Date: $
- * @org.apache.xbean.XBean element="wrap"
- */
-public class MBeanWrap {
- private String beanClass;
- private String strategy;
- private Properties config;
-
- public String getBeanClass() {
- return beanClass;
- }
-
- public void setBeanClass(String beanClass) {
- this.beanClass = beanClass;
- }
-
- public String getStrategy() {
- return strategy;
- }
-
- public void setStrategy(String strategy) {
- this.strategy = strategy;
- }
-
- public Properties getConfig() {
- return config;
- }
-
- public void setConfig(Properties config) {
- this.config = config;
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/assembler/JavaBeanMBeanInfoGenerator.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/assembler/JavaBeanMBeanInfoGenerator.java
deleted file mode 100644
index d10cfad..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/assembler/JavaBeanMBeanInfoGenerator.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.apache.xbean.jmx.assembler;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanConstructorInfo;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.ObjectName;
-
-import org.apache.xbean.jmx.MBeanInfoGenerator;
-import org.livetribe.jmx.MBeanUtils;
-
-
-/**
- * @version $Revision: $ $Date: $
- */
-public class JavaBeanMBeanInfoGenerator implements MBeanInfoGenerator {
- public MBeanInfo createMBeanInfo(Object bean, ObjectName objectName) {
- MBeanAttributeInfo[] attributes = MBeanUtils.getMBeanAttributeInfo(bean);
- MBeanConstructorInfo[] constructors = MBeanUtils.getMBeanConstructorInfo(bean);
- MBeanOperationInfo[] operations = MBeanUtils.getMBeanOperationInfo(bean);
-
- return new MBeanInfo(bean.getClass().getName(), null, attributes, constructors, operations, null);
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/strategies/DefaultWrappingStrategy.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/strategies/DefaultWrappingStrategy.java
deleted file mode 100644
index b6c4602..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/strategies/DefaultWrappingStrategy.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx.strategies;
-
-import java.util.Properties;
-
-import org.apache.xbean.jmx.JMXException;
-import org.apache.xbean.jmx.JMXWrappingStrategy;
-
-
-/**
- * @version $Revision: $ $Date: $
- */
-public class DefaultWrappingStrategy implements JMXWrappingStrategy {
-
- public Object wrapObject(Object service, Properties config) throws JMXException {
- return service;
- }
-
- public void unwrapObject(Object service, Properties config) {
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/strategies/JavaBeanWrappingStrategy.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/strategies/JavaBeanWrappingStrategy.java
deleted file mode 100644
index a0c0972..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/jmx/strategies/JavaBeanWrappingStrategy.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- *
- * Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx.strategies;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanConstructorInfo;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
-
-import org.apache.xbean.jmx.JMXException;
-import org.apache.xbean.jmx.JMXWrappingStrategy;
-import org.livetribe.jmx.DynamicMBeanAdapter;
-import org.livetribe.jmx.MBeanUtils;
-
-
-/**
- * @version $Revision: $ $Date: $
- */
-public class JavaBeanWrappingStrategy implements JMXWrappingStrategy {
-
- public final static String MBEAN_DESCRIPTION = "description";
- public final static List mbeanInfos = new ArrayList();
-
- public static List getMbeanInfos() {
- return mbeanInfos;
- }
-
- public Object wrapObject(Object service, Properties config) throws JMXException {
- return new DynamicMBeanAdapter(service, createMBeanInfo(service, config));
- }
-
- public void unwrapObject(Object service, Properties config) {
- }
-
- private MBeanInfo createMBeanInfo(Object service, Properties config) {
- MBeanAttributeInfo[] attributes = MBeanUtils.getMBeanAttributeInfo(service);
- MBeanConstructorInfo[] constructors = MBeanUtils.getMBeanConstructorInfo(service);
- MBeanOperationInfo[] operations = MBeanUtils.getMBeanOperationInfo(service);
-
- return new MBeanInfo(service.getClass().getName(), (String) config.get(MBEAN_DESCRIPTION), attributes, constructors, operations, null);
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/snmp/SnmpBinding.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/snmp/SnmpBinding.java
deleted file mode 100644
index 7b02c58..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/snmp/SnmpBinding.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.snmp;
-
-/**
- * Specifies a binding between a JMX notification and an SNMP message.
- *
- * @version $Rev$ $Date$
- */
-public class SnmpBinding
-{
- private String oid;
- private String payload;
- private String type;
-
- /**
- * The Type of Notification that this VarBinding applies to.
- */
- public String getType()
- {
- return type;
- }
-
- public void setType(String type)
- {
- this.type = type;
- }
-
- public String getOid()
- {
- return oid;
- }
-
- public void setOid(String oid)
- {
- this.oid = oid;
- }
-
- public String getPayload()
- {
- return payload;
- }
-
- public void setPayload(String payload)
- {
- this.payload = payload;
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/snmp/SnmpEmitter.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/snmp/SnmpEmitter.java
deleted file mode 100644
index 654ffe2..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/snmp/SnmpEmitter.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.snmp;
-
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.snmp4j.CommunityTarget;
-import org.snmp4j.PDU;
-import org.snmp4j.Session;
-import org.snmp4j.Snmp;
-import org.snmp4j.TransportMapping;
-import org.snmp4j.event.ResponseEvent;
-import org.snmp4j.event.ResponseListener;
-import org.snmp4j.mp.SnmpConstants;
-import org.snmp4j.smi.Address;
-import org.snmp4j.smi.Counter64;
-import org.snmp4j.smi.GenericAddress;
-import org.snmp4j.smi.Null;
-import org.snmp4j.smi.OID;
-import org.snmp4j.smi.OctetString;
-import org.snmp4j.smi.Variable;
-import org.snmp4j.smi.VariableBinding;
-import org.snmp4j.transport.DefaultUdpTransportMapping;
-
-
-/**
- * Listens for JMX notifications and then emits them as SNMP traps.
- * The class is configured with the SnmpServer and VarBinding POJOs.
- * <pre>
- * // Create an SnmpServer which describes where the messages are going to go
- * SnmpServer ss = new SnmpServer();
- * ss.setHost("127.0.0.1");
- * ss.setPort(162);
- * <p/>
- * // Create a binding from a notification to the SNMP trap message
- * VarBinding binding = new VarBinding();
- * binding.setOid("1.3.6.1.2.1.1.1");
- * binding.setPayload(SnmpEmitter.PAYLOAD_NOTIFICATION_MESSAGE);
- * ss.getVarBindings().add(binding);
- * <p/>
- * // Create the SNMP emitter
- * SnmpEmitter snmpEmitter = new SnmpEmitter();
- * snmpEmitter.getServers().add(ss);
- * snmpEmitter.start();
- * <p/>
- * // Register the emitter as a JMX listener
- * MBeanServer server = ....;
- * server.addNotificationListener(objectName,
- * snmpEmitter,
- * null, // No filter
- * null // No object handback necessary);
- * </pre>
- * VarBindings specify what data to send to the SNMP server. The OID is the
- * object ID that identifies the message on the SNMP server. The payload is
- * what you desire to send to the server. It can be one of the following items:
- * <ol>
- * <li>PAYLOAD_NOTIFICATION_MESSAGE: The notification message.</li>
- * <li>PAYLOAD_NOTIFICATION_TIMESTAMP: The notification timestamp.</li>
- * <li>PAYLOAD_NOTIFICATION_TYPE: The notification type.</li>
- * <li>PAYLOAD_NOTIFICATION_SEQUENCE: The notification sequence number.
- * <li>UserData: If the payload is not one of the above, the SnmpEmitter w</li>ill
- * see if the Notification's UserData is a Map. If so it will use the payload
- * as the key to lookup data from the Map and send the result. Otherwise, Null
- * will be sent.
- * </li>
- * </ol>
- *
- * @version $Rev$ $Date$
- */
-public class SnmpEmitter implements NotificationListener
-{
-
- private static final Log log = LogFactory.getLog(SnmpEmitter.class);
-
- public static final String PAYLOAD_NOTIFICATION_MESSAGE = "notification-message";
- public static final String PAYLOAD_NOTIFICATION_TIMESTAMP = "notification-date";
- public static final String PAYLOAD_NOTIFICATION_TYPE = "notification-type";
- public static final String PAYLOAD_NOTIFICATION_SEQUENCE = "notification-sequence";
-
- private Set servers = new HashSet();
-
- private Map sessions = new HashMap();
-
- public Set getServers()
- {
- return servers;
- }
-
- public void setServers(Set servers)
- {
- this.servers = servers;
- }
-
- public void start() throws Exception
- {
- log.info("Starting SnmpEmitter");
- for (Iterator itr = servers.iterator(); itr.hasNext();)
- {
- SnmpServer server = (SnmpServer) itr.next();
-
- Snmp sess = createSession(server);
- sessions.put(server, sess);
- }
- }
-
- public void stop()
- {
- for (Iterator itr = sessions.values().iterator(); itr.hasNext();)
- {
- Session session = (Session) itr.next();
- try
- {
- session.close();
- }
- catch (IOException e)
- {
- log.error("Could not close session.", e);
- }
- itr.remove();
- }
- }
-
- public void handleNotification(Notification n, Object o)
- {
- log.debug("Received JMX notification");
- for (Iterator itr = servers.iterator(); itr.hasNext();)
- {
- SnmpServer server = (SnmpServer) itr.next();
- Snmp session = getSession(server);
- Address targetAddress = GenericAddress.parse("udp:" + server.getHost() + "/" + server.getPort());
-
- // setting up target
- CommunityTarget target = new CommunityTarget();
- target.setCommunity(new OctetString("public"));
- target.setAddress(targetAddress);
- target.setRetries(server.getRetries());
- target.setTimeout(server.getTimeout());
- target.setVersion(SnmpConstants.version2c);
-
- // creating PDU
- PDU pdu = new PDU();
-
- addVarBindings(n, server, pdu);
-
- pdu.setType(PDU.TRAP);
-
- // sending request
- ResponseListener listener = new ResponseListener()
- {
- public void onResponse(ResponseEvent event)
- {
- // Always cancel async request when response has been received
- // otherwise a memory leak is created! Not canceling a request
- // immediately can be useful when sending a request to a broadcast
- // address.
- ((Snmp) event.getSource()).cancel(event.getRequest(), this);
- log.debug("Received response PDU is: " + event.getResponse());
- }
- };
- try
- {
- log.debug("Sending SNMP trap to " + targetAddress);
- session.send(pdu, target, null, listener);
- }
- catch (IOException e)
- {
- log.error("Could not send SNMP trap!", e);
- }
- }
- }
-
- protected void addVarBindings(Notification n, SnmpServer server, PDU pdu)
- {
- for (Iterator itr = server.getVarBindings().iterator(); itr.hasNext();)
- {
- addVarBinding(n, (SnmpBinding) itr.next(), pdu);
- }
- }
-
- protected void addVarBinding(Notification n, SnmpBinding binding, PDU pdu)
- {
- String type = binding.getType();
- // See if this VarBinding applies to this notification
- if (type != null && !type.equals(n.getType())) return;
-
- pdu.add(new VariableBinding(new OID(binding.getOid()), getVariable(n, binding)));
- }
-
- protected Variable getVariable(Notification n, SnmpBinding binding)
- {
- String payload = binding.getPayload();
- if (payload.equals(PAYLOAD_NOTIFICATION_TIMESTAMP))
- {
- return new Counter64(n.getTimeStamp());
- }
- else if (payload.equals(PAYLOAD_NOTIFICATION_MESSAGE))
- {
- return new OctetString(n.getMessage());
- }
- else if (payload.equals(PAYLOAD_NOTIFICATION_SEQUENCE))
- {
- return new Counter64(n.getSequenceNumber());
- }
- else if (payload.equals(PAYLOAD_NOTIFICATION_TYPE))
- {
- return new OctetString(n.getType());
- }
- else
- {
- // This isn't a payload that we recognize, so attempt to pull it
- // out of a mMap in the UserData.
- Object data = n.getUserData();
- if (data instanceof Map)
- {
- Object pdata = ((Map) data).get(payload);
- if (pdata != null)
- return new OctetString(pdata.toString());
- else
- return new Null();
- }
- else if (data instanceof CompositeDataSupport)
- {
- CompositeData cdata = (CompositeData) data;
- if (cdata.containsKey(payload))
- return new OctetString(cdata.get(payload).toString());
- else
- return new Null();
- }
- else
- {
- return new Null();
- }
- }
- }
-
- private Snmp getSession(SnmpServer server)
- {
- return (Snmp) sessions.get(server);
- }
-
- private Snmp createSession(SnmpServer server) throws IOException
- {
- TransportMapping transport = new DefaultUdpTransportMapping();
- Snmp snmp = new Snmp(transport);
- transport.listen();
-
- return snmp;
- }
-}
diff --git a/trunk/xbean-jmx/src/main/java/org/apache/xbean/snmp/SnmpServer.java b/trunk/xbean-jmx/src/main/java/org/apache/xbean/snmp/SnmpServer.java
deleted file mode 100644
index d92d0a4..0000000
--- a/trunk/xbean-jmx/src/main/java/org/apache/xbean/snmp/SnmpServer.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.snmp;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * @version $Rev$ $Date$
- */
-public class SnmpServer
-{
- private String host;
- private int port;
- private int timeout = 1000;
- private int retries = 0;
- private List varBindings = new ArrayList();
-
- public int getRetries()
- {
- return retries;
- }
-
- public void setRetries(int retries)
- {
- this.retries = retries;
- }
-
- public List getVarBindings()
- {
- return varBindings;
- }
-
- public void setVarBindings(List varBindings)
- {
- this.varBindings = varBindings;
- }
-
- public String getHost()
- {
- return host;
- }
-
- public void setHost(String host)
- {
- this.host = host;
- }
-
- public int getPort()
- {
- return port;
- }
-
- public void setPort(int port)
- {
- this.port = port;
- }
-
- public int getTimeout()
- {
- return timeout;
- }
-
- public void setTimeout(int timeout)
- {
- this.timeout = timeout;
- }
-}
diff --git a/trunk/xbean-jmx/src/main/resources/META-INF/LICENSE b/trunk/xbean-jmx/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-jmx/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-jmx/src/main/resources/META-INF/NOTICE b/trunk/xbean-jmx/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-jmx/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-jmx/src/main/resources/META-INF/org.apache.xbean.jmx.StrategyFinder/javabean b/trunk/xbean-jmx/src/main/resources/META-INF/org.apache.xbean.jmx.StrategyFinder/javabean
deleted file mode 100644
index b1f5c28..0000000
--- a/trunk/xbean-jmx/src/main/resources/META-INF/org.apache.xbean.jmx.StrategyFinder/javabean
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.xbean.jmx.WrapperStrategyClass=org.apache.xbean.jmx.strategies.JavaBeanWrappingStrategy
\ No newline at end of file
diff --git a/trunk/xbean-jmx/src/main/resources/META-INF/org.apache.xbean.jmx.StrategyFinder/xbean.default b/trunk/xbean-jmx/src/main/resources/META-INF/org.apache.xbean.jmx.StrategyFinder/xbean.default
deleted file mode 100644
index 80be9ac..0000000
--- a/trunk/xbean-jmx/src/main/resources/META-INF/org.apache.xbean.jmx.StrategyFinder/xbean.default
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.xbean.jmx.WrapperStrategyClass=org.apache.xbean.jmx.strategies.DefaultWrappingStrategy
\ No newline at end of file
diff --git a/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/DummyMBeanInfoGenerator.java b/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/DummyMBeanInfoGenerator.java
deleted file mode 100644
index 164521a..0000000
--- a/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/DummyMBeanInfoGenerator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import javax.management.MBeanInfo;
-import javax.management.ObjectName;
-
-
-/**
- * @version $Revision: $ $Date: $
- */
-public class DummyMBeanInfoGenerator implements MBeanInfoGenerator {
- public MBeanInfo createMBeanInfo(Object bean, ObjectName objectName) {
- return new MBeanInfo(bean.getClass().getName(), "dummy", null, null, null, null);
- }
-}
diff --git a/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/JMXService.java b/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/JMXService.java
deleted file mode 100644
index 6f79a70..0000000
--- a/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/JMXService.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * @version $Revision: $ $Date: $
- */
-public class JMXService {
- private List listeners = new ArrayList();
- private int intAttr;
- private Integer integerAttr;
- private boolean booleanAttr;
-
- public JMXService() {
- }
-
- public JMXService(int intAttr, Integer integerAttr, boolean booleanAttr) {
- this.intAttr = intAttr;
- this.integerAttr = integerAttr;
- this.booleanAttr = booleanAttr;
- }
-
- public int getIntAttr() {
- return intAttr;
- }
-
- public void setIntAttr(int intAttr) {
- this.intAttr = intAttr;
- }
-
- public Integer getIntegerAttr() {
- return integerAttr;
- }
-
- public void setIntegerAttr(Integer integerAttr) {
- this.integerAttr = integerAttr;
- }
-
- public boolean isBooleanAttr() {
- return booleanAttr;
- }
-
- public void setBooleanAttr(boolean booleanAttr) {
- this.booleanAttr = booleanAttr;
- }
-
- public String getReadOnly() {
- return "BAR";
- }
-
- public void setWriteOnly(String value) {
- if (!"FOO".equals(value)) throw new IllegalArgumentException("Only FOO is accepted");
- }
-
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- listeners.add(listener);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- listeners.remove(listener);
- }
-
- public void firePropertyChange() {
- Long oldValue = new Long(System.currentTimeMillis());
- Long newValue = new Long(oldValue.longValue() - 1L);
- PropertyChangeEvent event = new PropertyChangeEvent(this, "property", oldValue, newValue);
- for (int i = 0; i < listeners.size(); i++) {
- PropertyChangeListener listener = (PropertyChangeListener) listeners.get(i);
- listener.propertyChange(event);
- }
- }
-
- public List getPropertyChangeListeners() {
- return listeners;
- }
-}
diff --git a/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/JMXStrategyFinderTest.java b/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/JMXStrategyFinderTest.java
deleted file mode 100644
index 08af21e..0000000
--- a/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/JMXStrategyFinderTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import junit.framework.TestCase;
-
-
-/**
- * @version $Revision: $ $Date: $
- */
-public class JMXStrategyFinderTest extends TestCase {
-
- public void testJavaBean() throws Exception {
- JMXWrappingStrategy strategy = JMXStrategyFinder.newInstance("javabean");
- assertNotNull(strategy);
- }
-}
diff --git a/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/JMXTest.java b/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/JMXTest.java
deleted file mode 100644
index e3b58c5..0000000
--- a/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/JMXTest.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx;
-
-import javax.management.Attribute;
-import javax.management.AttributeNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
-import junit.framework.TestCase;
-import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
-import org.springframework.beans.factory.BeanCreationException;
-
-
-/**
- * @version $Revision: $ $Date: $
- */
-public class JMXTest extends TestCase {
-
- public void testSimple() throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/apache/xbean/jmx/jmx-simple.xml");
- try {
- Object jmxService = context.getBean("jmxService");
- assertNotNull(jmxService);
-
- Object server = context.getBean("mbeanServer");
- assertNotNull(server);
-
- MBeanExporter jmxExporter = (MBeanExporter) context.getBean("jmxExporter");
- assertNotNull(jmxExporter);
-
- MBeanServer mbeanServer = jmxExporter.getMbeanServer();
- assertNotNull(mbeanServer);
- assertSame(server, mbeanServer);
- assertEquals("org.apache.xbean", mbeanServer.getDefaultDomain());
-
- ObjectName objectName = ObjectName.getInstance(":type=JMXService");
- assertTrue(mbeanServer.isRegistered(objectName));
-
- assertEquals("BAR", mbeanServer.getAttribute(objectName, "readOnly"));
- try {
- mbeanServer.setAttribute(objectName, new Attribute("readOnly", "CDR"));
- fail("Should have thrown an AttributeNotFoundException");
- } catch (AttributeNotFoundException doNothing) {
- }
-
- // iniital value should have been set by spring
- assertEquals(new Integer(32), mbeanServer.getAttribute(objectName, "intAttr"));
- mbeanServer.setAttribute(objectName, new Attribute("intAttr", new Integer(5)));
- assertEquals(new Integer(5), mbeanServer.getAttribute(objectName, "intAttr"));
-
- // iniital value should have been set by spring
- assertEquals(new Integer(64), mbeanServer.getAttribute(objectName, "integerAttr"));
- mbeanServer.setAttribute(objectName, new Attribute("integerAttr", new Integer(7)));
- assertEquals(new Integer(7), mbeanServer.getAttribute(objectName, "integerAttr"));
-
- mbeanServer.setAttribute(objectName, new Attribute("booleanAttr", Boolean.FALSE));
- assertEquals(Boolean.FALSE, mbeanServer.getAttribute(objectName, "booleanAttr"));
- mbeanServer.setAttribute(objectName, new Attribute("booleanAttr", Boolean.TRUE));
- assertEquals(Boolean.TRUE, mbeanServer.getAttribute(objectName, "booleanAttr"));
-
- mbeanServer.setAttribute(objectName, new Attribute("writeOnly", "FOO"));
- try {
- mbeanServer.getAttribute(objectName, "writeOnly");
- fail("Should have thrown an AttributeNotFoundException");
- } catch (AttributeNotFoundException doNothing) {
- }
-
- } finally {
- context.destroy();
- }
- }
-
- public void testSimpleMultiple() throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/apache/xbean/jmx/jmx-simple-multiple.xml");
- try {
- Object jmxService1 = context.getBean("jmxService1");
- assertNotNull(jmxService1);
-
- Object jmxService2 = context.getBean("jmxService2");
- assertNotNull(jmxService2);
-
- MBeanExporter jmxExporter = (MBeanExporter) context.getBean("jmxExporter");
- assertNotNull(jmxExporter);
-
- MBeanServer mbeanServer = jmxExporter.getMbeanServer();
- assertNotNull(mbeanServer);
-
- ObjectName objectName11 = ObjectName.getInstance(":type=JMXService1,id=1");
- ObjectName objectName12 = ObjectName.getInstance(":type=JMXService1,id=2");
- ObjectName objectName21 = ObjectName.getInstance(":type=JMXService2,id=1");
- assertTrue(mbeanServer.isRegistered(objectName11));
- assertTrue(mbeanServer.isRegistered(objectName12));
- assertTrue(mbeanServer.isRegistered(objectName21));
- }
- finally {
- context.destroy();
- }
- }
-
- public void testDuplicate() {
- try {
- new ClassPathXmlApplicationContext("org/apache/xbean/jmx/jmx-duplicate.xml");
- fail("Should have thrown an IllegalStateException");
- } catch (BeanCreationException bce) {
- assertTrue(bce.getCause().getClass().equals(IllegalStateException.class));
- }
- }
-
- public void testCustomDuplicate() {
- try {
- new ClassPathXmlApplicationContext("org/apache/xbean/jmx/jmx-custom-duplicate.xml");
- fail("Should have thrown an IllegalStateException");
- } catch (BeanCreationException bce) {
- assertTrue(bce.getCause().getClass().equals(IllegalStateException.class));
- }
- }
-
- public void testDuplicateWrapper() {
- try {
- new ClassPathXmlApplicationContext("org/apache/xbean/jmx/jmx-duplicate-wrapper.xml");
- fail("Should have thrown an IllegalStateException");
- } catch (BeanCreationException bce) {
- assertTrue(bce.getCause().getClass().equals(IllegalStateException.class));
- }
- }
-
- public void testCustomWrapper() throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/apache/xbean/jmx/jmx-custom-wrapper.xml");
- try {
- Object jmxService = context.getBean("jmxService");
- assertNotNull(jmxService);
-
- MBeanExporter jmxExporter = (MBeanExporter) context.getBean("jmxExporter");
- assertNotNull(jmxExporter);
-
- MBeanServer mbeanServer = jmxExporter.getMbeanServer();
- assertNotNull(mbeanServer);
-
- ObjectName objectName = ObjectName.getInstance(":type=JMXService");
- assertTrue(mbeanServer.isRegistered(objectName));
- javax.management.MBeanInfo mbeanInfo = mbeanServer.getMBeanInfo(objectName);
- assertEquals("Dummy Description", mbeanInfo.getDescription());
- }
- finally {
- context.destroy();
- }
- }
-
- public void testListener() throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/apache/xbean/jmx/jmx-listener.xml");
- try {
- JMXService jmxService = (JMXService) context.getBean("jmxService");
- assertNotNull(jmxService);
-
- assertEquals(1, jmxService.getPropertyChangeListeners().size());
- MBeanExporter jmxExporter = (MBeanExporter) context.getBean("jmxExporter");
- assertNotNull(jmxExporter);
-
- MBeanServer mbeanServer = jmxExporter.getMbeanServer();
- assertNotNull(mbeanServer);
-
- ObjectName objectName = ObjectName.getInstance(":type=JMXService");
- assertTrue(mbeanServer.isRegistered(objectName));
-
- final Reference notified = new Reference(Boolean.FALSE);
- mbeanServer.addNotificationListener(objectName, new NotificationListener() {
- public void handleNotification(Notification notification, Object handback) {
- notified.set(Boolean.TRUE);
- }
- }, null, null);
-
- jmxService.firePropertyChange();
-
- assertEquals(Boolean.TRUE, notified.get());
- }
- finally {
- context.destroy();
- }
- }
-
- public void testListenerMultiple() throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/apache/xbean/jmx/jmx-listener-multiple.xml");
- try {
- JMXService jmxService = (JMXService) context.getBean("jmxService");
- assertNotNull(jmxService);
-
- assertEquals(2, jmxService.getPropertyChangeListeners().size());
- MBeanExporter jmxExporter = (MBeanExporter) context.getBean("jmxExporter");
- assertNotNull(jmxExporter);
-
- MBeanServer mbeanServer = jmxExporter.getMbeanServer();
- assertNotNull(mbeanServer);
-
- ObjectName objectName = ObjectName.getInstance(":type=JMXService");
- assertTrue(mbeanServer.isRegistered(objectName));
-
- final Reference notified = new Reference(new Integer(0));
- mbeanServer.addNotificationListener(objectName, new NotificationListener() {
- public void handleNotification(Notification notification, Object handback) {
- Integer oldValue = (Integer) notified.get();
- notified.set(new Integer(oldValue.intValue() + 1));
- }
- }, null, null);
-
- jmxService.firePropertyChange();
-
- assertEquals(2, ((Integer) notified.get()).intValue());
- }
- finally {
- context.destroy();
- }
- }
-
- private static class Reference {
- private Object reference;
-
- public Reference(Object reference) {
- this.reference = reference;
- }
-
- public Object get() {
- return reference;
- }
-
- public void set(Object reference) {
- this.reference = reference;
- }
- }
-}
diff --git a/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/strategies/DummyWrappingStrategy.java b/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/strategies/DummyWrappingStrategy.java
deleted file mode 100644
index c724676..0000000
--- a/trunk/xbean-jmx/src/test/java/org/apache/xbean/jmx/strategies/DummyWrappingStrategy.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- *
- * Copyright 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.jmx.strategies;
-
-/**
- * @version $Revision: $ $Date: $
- */
-public class DummyWrappingStrategy extends JavaBeanWrappingStrategy {
-}
diff --git a/trunk/xbean-jmx/src/test/java/org/apache/xbean/snmp/AbstractJMXSNMPTest.java b/trunk/xbean-jmx/src/test/java/org/apache/xbean/snmp/AbstractJMXSNMPTest.java
deleted file mode 100644
index 1f9e046..0000000
--- a/trunk/xbean-jmx/src/test/java/org/apache/xbean/snmp/AbstractJMXSNMPTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.snmp;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import junit.framework.TestCase;
-import org.snmp4j.CommandResponder;
-import org.snmp4j.CommandResponderEvent;
-import org.snmp4j.PDU;
-import org.snmp4j.Snmp;
-import org.snmp4j.TransportMapping;
-import org.snmp4j.smi.Address;
-import org.snmp4j.smi.GenericAddress;
-import org.snmp4j.smi.UdpAddress;
-import org.snmp4j.transport.DefaultUdpTransportMapping;
-
-
-/**
- * @version $Rev$ $Date$
- */
-public class AbstractJMXSNMPTest extends TestCase
-{
- protected final int SNMP_TEST_PORT = 1620;
- protected static int count = 0;
- private Snmp snmp;
-
- public void setUp() throws Exception
- {
- createServer();
- createSNMPServer();
- }
-
- protected void createServer() throws Exception
- {
- MBeanServer server = MBeanServerFactory.createMBeanServer();
-
- ObjectName timerName = new ObjectName("DefaultDomain", "service", "timer");
- ObjectInstance lTimer = server.createMBean("javax.management.timer.Timer", timerName);
-
- server.invoke(lTimer.getObjectName(), "start", new Object[]{}, new String[]{});
- }
-
- public void createSNMPServer() throws Exception
- {
- Address targetAddress = GenericAddress.parse("udp:0.0.0.0/" + SNMP_TEST_PORT);
- TransportMapping transport = new DefaultUdpTransportMapping((UdpAddress) targetAddress);
- snmp = new Snmp(transport);
-
- snmp.listen();
-
- CommandResponder trapPrinter = new CommandResponder()
- {
- public synchronized void processPdu(CommandResponderEvent e)
- {
- PDU command = e.getPDU();
- if (command != null)
- {
- count++;
- System.out.println(command.toString());
- }
- }
- };
- snmp.addCommandResponder(trapPrinter);
- }
-
- public void tearDown() throws Exception
- {
- super.tearDown();
-
- snmp.close();
- }
-}
diff --git a/trunk/xbean-jmx/src/test/java/org/apache/xbean/snmp/HeartbeatTest.java b/trunk/xbean-jmx/src/test/java/org/apache/xbean/snmp/HeartbeatTest.java
deleted file mode 100644
index 339ba99..0000000
--- a/trunk/xbean-jmx/src/test/java/org/apache/xbean/snmp/HeartbeatTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.snmp;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.NotificationEmitter;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-import java.lang.management.MemoryPoolMXBean;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.xbean.jmx.Heartbeat;
-
-
-/**
- * @version $Rev$ $Date$
- */
-public class HeartbeatTest extends AbstractJMXSNMPTest
-{
- public void testHB() throws Exception
- {
- // Create SNMP stuff
- SnmpEmitter em = new SnmpEmitter();
-
- SnmpServer ss = new SnmpServer();
- ss.setHost("127.0.0.1");
- ss.setPort(SNMP_TEST_PORT);
-
- ss.setVarBindings(new ArrayList());
-
- SnmpBinding binding = new SnmpBinding();
- binding.setOid("1.3.6.1.2.1.1.1");
- binding.setPayload(SnmpEmitter.PAYLOAD_NOTIFICATION_MESSAGE);
- ss.getVarBindings().add(binding);
-
- binding = new SnmpBinding();
- binding.setOid("1.3.6.1.2.1.1.2");
- binding.setPayload(SnmpEmitter.PAYLOAD_NOTIFICATION_TYPE);
- ss.getVarBindings().add(binding);
-
- binding = new SnmpBinding();
- binding.setOid("1.3.6.1.2.1.1.3");
- binding.setPayload("foo");
- binding.setType("asdf");
- ss.getVarBindings().add(binding);
-
-
- Set servers = new HashSet();
- servers.add(ss);
- em.setServers(servers);
-
- em.start();
-
- MBeanServer lServer = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
- Set lBeans = lServer.queryMBeans(new ObjectName("DefaultDomain", "service", "timer"), null);
- ObjectInstance lTimer = (ObjectInstance) lBeans.iterator().next();
-
- lServer.addNotificationListener(lTimer.getObjectName(), em,
- // No filter
- null,
- // No object handback necessary
- null);
-
- MemoryPoolMXBean pool = (MemoryPoolMXBean) ManagementFactory.getMemoryPoolMXBeans().iterator().next();
-
- MemoryMXBean memBean = ManagementFactory.getMemoryMXBean();
-
- NotificationEmitter memEm = (NotificationEmitter) memBean;
- memEm.addNotificationListener(em, null, null);
-
- pool.setUsageThreshold(1000);
- Heartbeat hb = new Heartbeat(lServer, new ObjectName("DefaultDomain", "service", "timer"), 1000);
- hb.start();
-
- Thread.sleep(1000);
-
- if (count == 0) fail("Didn't receive any SNMP traps!");
-
- hb.stop();
- }
-
-}
\ No newline at end of file
diff --git a/trunk/xbean-jmx/src/test/java/org/apache/xbean/snmp/MemoryUsageExampleTest.java b/trunk/xbean-jmx/src/test/java/org/apache/xbean/snmp/MemoryUsageExampleTest.java
deleted file mode 100644
index 17a87e1..0000000
--- a/trunk/xbean-jmx/src/test/java/org/apache/xbean/snmp/MemoryUsageExampleTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.snmp;
-
-import javax.management.NotificationEmitter;
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-import java.lang.management.MemoryPoolMXBean;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-
-
-/**
- * @version $Rev$ $Date$
- */
-public class MemoryUsageExampleTest extends AbstractJMXSNMPTest
-{
- public void testHB() throws Exception
- {
- // Create SNMP stuff
- SnmpEmitter em = new SnmpEmitter();
-
- SnmpServer ss = new SnmpServer();
- ss.setHost("127.0.0.1");
- ss.setPort(SNMP_TEST_PORT);
-
- ss.setVarBindings(new ArrayList());
-
- /**
- * Bind the JMX notification type "java.management.memory.threshold.exceeded"
- * to the specified OID. The payload of the snmp message will be the usage
- * attribute.
- */
- SnmpBinding binding = new SnmpBinding();
- binding.setOid("1.3.6.1.2.1.1.3");
- binding.setPayload("usage");
- binding.setType("java.management.memory.threshold.exceeded");
- ss.getVarBindings().add(binding);
-
- Set servers = new HashSet();
- servers.add(ss);
- em.setServers(servers);
-
- em.start();
-
- MemoryPoolMXBean pool = (MemoryPoolMXBean) ManagementFactory.getMemoryPoolMXBeans().iterator().next();
-
- MemoryMXBean memBean = ManagementFactory.getMemoryMXBean();
-
- // Add our SNMP emitter as a notification listener
- NotificationEmitter memEm = (NotificationEmitter) memBean;
- memEm.addNotificationListener(em, null, null);
-
- // Set the memory usage threshold real low to trigger an event
- pool.setUsageThreshold(1000);
-
- Thread.sleep(1000);
-
- if (count == 0) fail("Didn't receive any SNMP traps!");
- }
-}
diff --git a/trunk/xbean-jmx/src/test/resources/META-INF/org.apache.xbean.jmx.StrategyFinder/dummy b/trunk/xbean-jmx/src/test/resources/META-INF/org.apache.xbean.jmx.StrategyFinder/dummy
deleted file mode 100644
index df6f7d5..0000000
--- a/trunk/xbean-jmx/src/test/resources/META-INF/org.apache.xbean.jmx.StrategyFinder/dummy
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.xbean.jmx.WrapperStrategyClass=org.apache.xbean.jmx.strategies.DummyWrappingStrategy
\ No newline at end of file
diff --git a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-custom-duplicate.xml b/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-custom-duplicate.xml
deleted file mode 100644
index bf37ac0..0000000
--- a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-custom-duplicate.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:jmx="http://xbean.apache.org/schemas/jmx">
-
- <bean id="jmxService_one" class="org.apache.xbean.jmx.JMXService"/>
- <bean id="jmxService_two" class="org.apache.xbean.jmx.JMXService"/>
-
- <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
- <property name="defaultDomain" value="org.apache.xbean"/>
- </bean>
-
- <jmx:export id="jmxExporter" mbeanserver="#mbeanServer">
- <jmx:wrapStrategies>
- <jmx:wrap beanClass="org.apache.xbean.jmx.JMXService" strategy="dummy"/>
- </jmx:wrapStrategies>
- <jmx:mbeans>
- <jmx:mbean bean="#jmxService_one" objectname=":type=JMXService"/>
- <jmx:mbean bean="#jmxService_two" objectname=":type=JMXService" wrapStrategy="javabean"/>
- </jmx:mbeans>
- </jmx:export>
-
-</beans>
diff --git a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-custom-wrapper.xml b/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-custom-wrapper.xml
deleted file mode 100644
index d6d6ed2..0000000
--- a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-custom-wrapper.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:jmx="http://xbean.apache.org/schemas/jmx">
-
- <bean id="jmxService" class="org.apache.xbean.jmx.JMXService"/>
-
- <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
- <property name="defaultDomain" value="org.apache.xbean"/>
- </bean>
-
- <jmx:export id="jmxExporter" mbeanserver="#mbeanServer">
- <jmx:wrapStrategies>
- <jmx:wrap beanClass="org.apache.xbean.jmx.JMXService" strategy="dummy">
- <property name="config">
- <value>
- description=Dummy Description
- </value >
- </property>
- </jmx:wrap>
- </jmx:wrapStrategies>
-
- <jmx:mbeans>
- <jmx:mbean bean="#jmxService" objectname=":type=JMXService"/>
- </jmx:mbeans>
- </jmx:export>
-
-</beans>
diff --git a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-duplicate-wrapper.xml b/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-duplicate-wrapper.xml
deleted file mode 100644
index f2f628e..0000000
--- a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-duplicate-wrapper.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:jmx="http://xbean.apache.org/schemas/jmx">
-
- <bean id="jmxService" class="org.apache.xbean.jmx.JMXService"/>
-
- <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
- <property name="defaultDomain" value="org.apache.xbean"/>
- </bean>
-
- <jmx:export id="jmxExporter" mbeanserver="#mbeanServer">
- <jmx:wrapStrategies>
- <jmx:wrap beanClass="org.apache.xbean.jmx.JMXService" strategy="dummy"/>
- <jmx:wrap beanClass="org.apache.xbean.jmx.JMXService" strategy="javabean"/>
- </jmx:wrapStrategies>
- <jmx:mbeans>
- <jmx:mbean bean="#jmxService" objectname=":type=JMXService"/>
- </jmx:mbeans>
- </jmx:export>
-
-</beans>
diff --git a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-duplicate.xml b/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-duplicate.xml
deleted file mode 100644
index 9b133c8..0000000
--- a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-duplicate.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:jmx="http://xbean.apache.org/schemas/jmx">
-
- <bean id="jmxService_one" class="org.apache.xbean.jmx.JMXService">
- <property name="intAttr" value="1"/>
- <property name="integerAttr" value="1"/>
- </bean>
-
- <bean id="jmxService_two" class="org.apache.xbean.jmx.JMXService">
- <property name="intAttr" value="2"/>
- <property name="integerAttr" value="2"/>
- </bean>
-
- <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
- <property name="defaultDomain" value="org.apache.xbean"/>
- </bean>
-
- <jmx:export id="jmxExporter" mbeanserver="#mbeanServer">
- <jmx:mbeans>
- <jmx:mbean bean="#jmxService_one" objectname=":type=JMXService,object=one" wrapStrategy="javabean"/>
- <jmx:mbean bean="#jmxService_two" objectname=":type=JMXService,object=two" wrapStrategy="dummy"/>
- </jmx:mbeans>
- </jmx:export>
-
-</beans>
diff --git a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-listener-multiple.xml b/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-listener-multiple.xml
deleted file mode 100644
index f4f36e1..0000000
--- a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-listener-multiple.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:jmx="http://xbean.apache.org/schemas/jmx">
-
- <bean id="jmxService" class="org.apache.xbean.jmx.JMXService"/>
-
- <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
- <property name="defaultDomain" value="org.apache.xbean"/>
- </bean>
-
- <jmx:export id="jmxExporter" mbeanserver="#mbeanServer">
- <jmx:mbeans>
- <jmx:mbean bean="#jmxService" objectname=":type=JMXService" wrapStrategy="javabean">
- <jmx:listeners>
- <jmx:listen bean="#jmxService" listener="java.beans.PropertyChangeListener"/>
- <jmx:listen bean="#jmxService" listener="java.beans.PropertyChangeListener"/>
- </jmx:listeners>
- </jmx:mbean>
- </jmx:mbeans>
- </jmx:export>
-
-</beans>
diff --git a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-listener.xml b/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-listener.xml
deleted file mode 100644
index 46ffd80..0000000
--- a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-listener.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:jmx="http://xbean.apache.org/schemas/jmx">
-
- <bean id="jmxService" class="org.apache.xbean.jmx.JMXService"/>
-
- <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
- <property name="defaultDomain" value="org.apache.xbean"/>
- </bean>
-
- <jmx:export id="jmxExporter" mbeanserver="#mbeanServer">
- <jmx:mbeans>
- <jmx:mbean bean="#jmxService" objectname=":type=JMXService" wrapStrategy="javabean">
- <jmx:listeners>
- <jmx:listen bean="#jmxService" listener="java.beans.PropertyChangeListener"/>
- </jmx:listeners>
- </jmx:mbean>
- </jmx:mbeans>
- </jmx:export>
-
-</beans>
diff --git a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-simple-multiple.xml b/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-simple-multiple.xml
deleted file mode 100644
index 418db30..0000000
--- a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-simple-multiple.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:jmx="http://xbean.apache.org/schemas/jmx">
-
- <bean id="jmxService1" class="org.apache.xbean.jmx.JMXService"/>
- <bean id="jmxService2" class="org.apache.xbean.jmx.JMXService"/>
-
- <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
- <property name="defaultDomain" value="org.apache.xbean"/>
- </bean>
-
- <jmx:export id="jmxExporter" mbeanserver="#mbeanServer">
- <jmx:mbeans>
- <jmx:mbean bean="#jmxService1" objectname=":type=JMXService1,id=1" wrapStrategy="javabean"/>
- <jmx:mbean bean="#jmxService1" objectname=":type=JMXService1,id=2" wrapStrategy="javabean"/>
- <jmx:mbean bean="#jmxService2" objectname=":type=JMXService2,id=1" wrapStrategy="javabean"/>
- </jmx:mbeans>
- </jmx:export>
-
-</beans>
diff --git a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-simple.xml b/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-simple.xml
deleted file mode 100644
index 19f081c..0000000
--- a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx-simple.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:jmx="http://xbean.apache.org/schemas/jmx">
-
- <bean id="jmxService" class="org.apache.xbean.jmx.JMXService">
- <property name="intAttr" value="32"/>
- <property name="integerAttr" value="64"/>
- </bean>
-
- <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
- <property name="defaultDomain" value="org.apache.xbean"/>
- </bean>
-
- <jmx:export id="jmxExporter" mbeanserver="#mbeanServer">
- <jmx:mbeans>
- <jmx:mbean bean="#jmxService" objectname=":type=JMXService" wrapStrategy="javabean"/>
- </jmx:mbeans>
- </jmx:export>
-
-</beans>
diff --git a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx.xml b/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx.xml
deleted file mode 100644
index c5e93c5..0000000
--- a/trunk/xbean-jmx/src/test/resources/org/apache/xbean/jmx/jmx.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:jmx="http://xbean.apache.org/schemas/jmx">
-
- <bean id="jmxService" class="org.apache.xbean.jmx.JMXService"/>
-
- <jmx:export><!-- mbeanserver=""> -->
- <jmx:mbean bean="#jmxService" wrapStrategy="javabean"><!-- objectname="" mbean=""> -->
- <jmx:listen source="#jmxService"
- add-method="addPropertyChangeListener"
- remove-method="removePropertyChangeListener"
- listener="FooPCL"/>
- </jmx:mbean>
- <jmx:mbean bean-ref="jmxService"/>
- <!--<jmx:connector url="service:jmx:rmi:///" />-->
- </jmx:export>
-
-</beans>
diff --git a/trunk/xbean-kernel/LICENSE.txt b/trunk/xbean-kernel/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-kernel/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-kernel/NOTICE.txt b/trunk/xbean-kernel/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-kernel/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-kernel/pom.xml b/trunk/xbean-kernel/pom.xml
deleted file mode 100644
index 0da735b..0000000
--- a/trunk/xbean-kernel/pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-kernel</artifactId>
- <name>XBean :: Kernel</name>
- <version>2.4-SNAPSHOT</version>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/ServiceManagerRegistryTest.*</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/AbstractServiceFactory.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/AbstractServiceFactory.java
deleted file mode 100644
index 8be5541..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/AbstractServiceFactory.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.Set;
-import java.util.Collections;
-import java.util.HashSet;
-
-/**
- * AbstractServiceFactory is an implementation of ServiceFactory that handles all of the mundane issues.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public abstract class AbstractServiceFactory implements ServiceFactory {
- private boolean enabled = true;
- private final Set startConditions = new HashSet();
- private final Set stopConditions = new HashSet();
-
- /**
- * {@inheritDoc}
- */
- public synchronized boolean isEnabled() {
- return enabled;
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized Set getStartConditions() {
- return Collections.unmodifiableSet(new HashSet(startConditions));
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized void addStartCondition(ServiceCondition startCondition) throws NullPointerException {
- if (startCondition == null) throw new NullPointerException("startCondition is null");
- startConditions.add(startCondition);
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized void removeStartCondition(ServiceCondition startCondition) throws NullPointerException {
- if (startCondition == null) throw new NullPointerException("startCondition is null");
- startConditions.remove(startCondition);
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized Set getStopConditions() {
- return Collections.unmodifiableSet(new HashSet(stopConditions));
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized void addStopCondition(ServiceCondition stopCondition) throws NullPointerException {
- if (stopCondition == null) throw new NullPointerException("stopCondition is null");
- stopConditions.add(stopCondition);
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized void removeStopCondition(ServiceCondition stopCondition) throws NullPointerException {
- if (stopCondition == null) throw new NullPointerException("stopCondition is null");
- stopConditions.remove(stopCondition);
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ForcedStopException.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ForcedStopException.java
deleted file mode 100644
index 10b799b..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ForcedStopException.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * Signafies that a StopStrategies would like the kernel to ignore any unsatified stop conditions and continue to
- * destroy the service.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ForcedStopException extends Exception {
- private final ServiceName serviceName;
- private final Set unsatisfiedConditions;
-
- /**
- * Creates a ForcedStopException for the specified service name.
- *
- * @param serviceName the name of the service that is to be forceably stopped
- * @param unsatisfiedConditions the unsatisfied conditions that will be ignored
- */
- public ForcedStopException(ServiceName serviceName, Set unsatisfiedConditions) {
- super("Forced stop and ignored unsatisfied conditons:" +
- " serviceName=" + serviceName +
- ", unsatisfiedConditions=" + unsatisfiedConditions);
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (unsatisfiedConditions == null) throw new NullPointerException("unsatisfiedConditions is null");
- this.serviceName = serviceName;
- this.unsatisfiedConditions = Collections.unmodifiableSet(unsatisfiedConditions);
- }
-
- /**
- * Gets the name of the service that is to be forceably stopped.
- *
- * @return the service name
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-
- /**
- * Gets the conditions that were unsatified when the exception was thrown.
- *
- * @return the unsatified conditions that were ignored
- */
- public Set getUnsatisfiedConditions() {
- return unsatisfiedConditions;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/IllegalServiceStateException.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/IllegalServiceStateException.java
deleted file mode 100644
index 8df90aa..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/IllegalServiceStateException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * Indicates an operation was called on a service in a state that does not allow that operation to be called.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class IllegalServiceStateException extends Exception {
- private final ServiceName serviceName;
-
- /**
- * Creates an IllegalServiceStateException.
- *
- * @param message information about why the service is in an illegal state
- * @param serviceName the name of the service
- */
- public IllegalServiceStateException(String message, ServiceName serviceName) {
- super(message + ": " + serviceName);
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- this.serviceName = serviceName;
- }
-
- /**
- * Gets the name of the service that caused this exception.
- *
- * @return the service name
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/InvalidServiceTypeException.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/InvalidServiceTypeException.java
deleted file mode 100644
index ca97a45..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/InvalidServiceTypeException.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * Indicates that the service factory returned an object from the createService method that is not an instance of every
- * declared type.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class InvalidServiceTypeException extends Exception {
- private final ServiceName serviceName;
- private final Class expectedType;
- private final Class serviceType;
-
- /**
- * Creates an InvalidServiceType caused by the service with the specified name, which returned an object from the
- * createService method of the specified type that is not an instance of the expected type.
- * @param serviceName the name of the service that returned an object of the wrong type
- * @param expectedType the type that was expected
- * @param serviceType the actual type of the service returned from the factory
- */
- // todo add servicefacotory to the parameters
- public InvalidServiceTypeException(ServiceName serviceName, Class expectedType, Class serviceType) {
- super("Expected service type " + expectedType.getName() + ", but service factory created a " +
- serviceType.getName() + " for service " + serviceName);
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (expectedType == null) throw new NullPointerException("expectedType is null");
- if (serviceType == null) throw new NullPointerException("serviceType is null");
- this.serviceName = serviceName;
- this.expectedType = expectedType;
- this.serviceType = serviceType;
- }
-
- /**
- * Gets the name of the service that returned an object of the wrong type.
- * @return the name of the service that returned an object of the wrong type
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-
- /**
- * Gets the type that was expected.
- * @return the type that was expected
- */
- public Class getExpectedType() {
- return expectedType;
- }
-
- /**
- * Gets the actual type of the service returned from the factory.
- * @return the actual type of the service returned from the factory
- */
- public Class getServiceType() {
- return serviceType;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/Kernel.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/Kernel.java
deleted file mode 100644
index 0050d14..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/Kernel.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.List;
-
-/**
- * This iterface defines the API for managing and monitoring service life-cycle. A kernel can be constructed with the
- * following code:
- * <p><blockquote><pre>
- * Kernel kernel = KernelFactory.newInstance().createKernel(name);
- * </pre></blockquote>
- * Services can be registered, unregistered, started and
- * stopped. The lifecycle model is loosly based on the J2ee Management Specification (JSR 77). All lifecycle
- * transitions are broadcasted via a ServiceMonitor.
- * <p/>
- * Each kernel must have a name that is unique with in the KernelFactory (there should only be one KernelFactory per
- * VM but class loader tricks can result in several KernelFactory)
- * <p/>
- * This class is loosely based on the J2ee management MEJB and JMX MBeanServer interfaces.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface Kernel {
- /**
- * Destroys this kernel. This method causes all services to be stopped and unregistered.
- */
- void destroy();
-
- /**
- * Waits for the kernel to be destroyed.
- */
- void waitForDestruction();
-
- /**
- * Gets the running status of the kernel. Services can not be registered or started on a stopped kernel.
- *
- * @return true if the kernel is running; false otherwise
- */
- boolean isRunning();
-
- /**
- * Gets the unique name of this kernel within the KernelFactory.
- *
- * @return the unique name of this kernel
- */
- String getKernelName();
-
- /**
- * Registers a service with this kernel. If the service is restartable, it will enter the server in the
- * STOPPED state. If a service is not restartable, the kernel will assure that all
- * dependencies are satisfied and service will enter the kernel in the RUNNING state. If a
- * dependency for a non-restartable service is not immediately satisfiable, this method will throw a
- * ServiceRegistrationException.
- *
- * @param serviceName the unique name of the service in the kernel
- * @param serviceFactory the factory used to create the service
- * @param classLoader the class loader to use for this service
- * @throws ServiceAlreadyExistsException if service is already registered with the specified name
- * @throws ServiceRegistrationException if the service is not restartable and an error occured while starting the service
- */
- void registerService(ServiceName serviceName, ServiceFactory serviceFactory, ClassLoader classLoader) throws ServiceAlreadyExistsException, ServiceRegistrationException;
-
- /**
- * Unregisters a service from this kernel. The kernel will attempt to stop the service using the
- * SYNCHRONOUS stop strategy, but if it can not stop the service a
- * ServiceRegistrationException will be thrown containing an UnsatisfiedConditionsException.
- *
- * @param serviceName the unique name of the service in the kernel
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- * @throws ServiceRegistrationException if the service could not be stopped
- */
- void unregisterService(ServiceName serviceName) throws ServiceNotFoundException, ServiceRegistrationException;
-
- /**
- * Unregisters a service from this kernel. The kernel will attempt to stop the service using the specified stop
- * strategy, but if it can not stop the service a ServiceRegistrationException will be thrown containing
- * either an UnsatisfiedConditionsException or a IllegalServiceStateException.
- *
- * @param serviceName the unique name of the service in the kernel
- * @param stopStrategy the strategy that determines how unsatisfied conditions are handled
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- * @throws ServiceRegistrationException if the service could not be stopped
- */
- void unregisterService(ServiceName serviceName, StopStrategy stopStrategy) throws ServiceNotFoundException, ServiceRegistrationException;
-
- /**
- * Determines if there is a service registered under the specified name.
- *
- * @param serviceName the unique name of the service
- * @return true if there is a service registered with the specified name; false otherwise
- */
- boolean isRegistered(ServiceName serviceName);
-
- /**
- * Gets the ServiceState of the specified service. If the service is not restartable, this method will
- * always return RUNNING.
- *
- * @param serviceName the unique name of the service in the kernel
- * @return the curren ServiceState of the service
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- */
- ServiceState getServiceState(ServiceName serviceName) throws ServiceNotFoundException;
-
- /**
- * Gets the time the specified service entered the RUNNING state since the epoch
- * (January 1, 1970, 00:00:00) in milliseconds. If the service is in the STOPPED or
- * STARTING states, this method will return 0.
- *
- * @param serviceName the unique name of the service in the kernel
- * @return the time the service started in milliseconds since January 1, 1970, 00:00:00
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- */
- long getServiceStartTime(ServiceName serviceName) throws ServiceNotFoundException;
-
- /**
- * Immediately starts the service using the SYNCHRONOUS start strategy. Any exception throw
- * from service constuction is throw directly from this method. If a start condition can not be immediately
- * satisfied, a UnsatisfiedConditionsException will be thrown. If a service already in the
- * RUNNING state, or is not restartable, this method is a noop. If the service
- * is in the STOPPING state an IllegalServiceStateException will be thrown. If the
- * service is disabled, this method will throw an IllegalServiceStateException.
- * <p/>
- * This method has no effect on as service that is not restartable.
- *
- * @param serviceName the unique name of the service to start
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- * @throws IllegalServiceStateException if the service is restartable and is in the STOPPING state or if the
- * service is disabled
- * @throws UnsatisfiedConditionsException if some of the start conditions can not be immediately satisfied
- * @throws Exception if service construction threw an Exception
- */
- void startService(ServiceName serviceName) throws ServiceNotFoundException, IllegalServiceStateException, UnsatisfiedConditionsException, Exception;
-
- /**
- * Immediately starts the service using the specified start strategy.
- * <p/>
- * The start strategy determines how any exception thrown from service constuction is handled including throwing
- * the exception directly from this method.
- * <p/>
- * The start strategy determines what to do if a start condition can not be immediately satisfied. Possibilities
- * include throwing an UnsatisfiedConditionsException, blocking, leaving the service in the
- * RUNNING state, or unregistering the service.
- * <p/>
- * If a service already in the RUNNING state, or is not restartable, this method is a noop.
- * If the service is in the STOPPING state an IllegalServiceStateException will be
- * thrown. If the service is disabled, this method will throw an IllegalServiceStateException.
- * <p/>
- * This method has no effect on as service that is not restartable.
- *
- * @param serviceName the unique name of the service to start
- * @param startStrategy the strategy that determines how unsatisfied conditions and construction exceptions are handled
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- * @throws IllegalServiceStateException if the service is restartable and is in the STOPPING state or if the
- * service is disabled
- * @throws UnsatisfiedConditionsException if some of the start conditions can not be immediately satisfied
- * @throws Exception if service construction threw an Exception
- */
- void startService(ServiceName serviceName, StartStrategy startStrategy) throws ServiceNotFoundException, IllegalServiceStateException, UnsatisfiedConditionsException, Exception;
-
- /**
- * Immediately starts the service, and if the start ultimately completes successfully, all services owned by the
- * specified service, all services that are owned by those services, and so on, will be started using the
- * startServiceRecursive(ServiceName) method.
- *
- * @param serviceName the unique name of the service to start recursively
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- * @throws IllegalServiceStateException if the service is restartable and is in the STOPPING state or if the
- * service is disabled
- * @throws UnsatisfiedConditionsException if some of the start conditions can not be immediately satisfied
- * @throws Exception if service construction threw an Exception
- */
- void startServiceRecursive(ServiceName serviceName) throws ServiceNotFoundException, IllegalServiceStateException, UnsatisfiedConditionsException, Exception;
-
- /**
- * Immediately starts the service, and if the start ultimately completes successfully, all services owned by the
- * specified service, all services that are owned by those services, and so on, will be started using the
- * startServiceRecursive(ServiceName, StartStrategy) method.
- *
- * @param serviceName the unique name of the service to start recursively
- * @param startStrategy the strategy that determines how unsatisfied conditions and construction exceptions are handled
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- * @throws IllegalServiceStateException if the service is restartable and is in the STOPPING state or if the
- * service is disabled
- * @throws UnsatisfiedConditionsException if some of the start conditions can not be immediately satisfied
- * @throws Exception if service construction threw an Exception
- */
- void startServiceRecursive(ServiceName serviceName, StartStrategy startStrategy) throws ServiceNotFoundException, IllegalServiceStateException, UnsatisfiedConditionsException, Exception;
-
- /**
- * Immediately stops the service using the SYNCHRONOUS stop strategy. If a stop condition can
- * not be immediately satisfied, an UnsatisfiedConditionsException will be thrown. If a service already in
- * the STOPPED state, this method is a noop.
- * <p/>
- * If the service is not restartable, this method only attempts to satify the stop conditions. This is useful for
- * stopping all dependent services of a non-restartable service before unregistering the service.
- *
- * @param serviceName the unique name of the service to stop
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- */
- void stopService(ServiceName serviceName) throws ServiceNotFoundException, UnsatisfiedConditionsException;
-
- /**
- * Immediately stops the service using the specified stop strategy. If a stop condition can not be immediately
- * satisfied, an UnsatisfiedConditionsException will be thrown. If a service already in the
- * STOPPED state, this method is a noop.
- * <p/>
- * If the service is not restartable, this method only attempts to satify the stop conditions. This is useful for
- * stopping all dependent services of a non-restartable service before unregistering the service.
- *
- * @param serviceName the unique name of the service to stop
- * @param stopStrategy the strategy that determines how unsatisfied conditions are handled
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- */
- void stopService(ServiceName serviceName, StopStrategy stopStrategy) throws ServiceNotFoundException, UnsatisfiedConditionsException;
-
- /**
- * Determines if the service can be instantiated in a kernel. A disabled restartable service can not be
- * started. This method is equivalent to:
- * <p><blockquote><pre>
- * kernel.getServiceFactory(serviceName).isEnabled();
- * </pre></blockquote>
- * <p/>
- *
- * @param serviceName the unique name of the service
- * @return true if the service factory is enabled; false otherwise
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- */
- boolean isServiceEnabled(ServiceName serviceName) throws ServiceNotFoundException;
-
- /**
- * Sets the enabled status of a service. A disabled restartable service can not be started. This state has
- * no effect on a service that is already started, but if a running service is disabled, it can not be restarted.
- * This method is equivalent to:
- * <p><blockquote><pre>
- * kernel.getServiceFactory(serviceName).setEnabled(enabled);
- * </pre></blockquote>
- * <p/>
- *
- * @param serviceName the unique name of the service
- * @param enabled the new enabled state of this factory
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- */
- void setServiceEnabled(ServiceName serviceName, boolean enabled) throws ServiceNotFoundException;
-
- /**
- * Gets the service registered under the specified name. If the service is not in the RUNNING,
- * or STARTING state this method will throw an IllegalArgumentException.
- *
- * @param serviceName the unique name of the service
- * @return the service associated with the specified name
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- * @throws IllegalArgumentException if the service is not in the RUNNING, or STARTING state
- */
- Object getService(ServiceName serviceName) throws ServiceNotFoundException, IllegalArgumentException;
-
- /**
- * Gets the first running service registered with the kernel that is an instance of the specified type. If no
- * running services are instances of the specified type, null is returned.
- *
- * @param type the of the desired service
- * @return the first registered service that is an instance of the specified type and is running
- */
- Object getService(Class type);
-
- /**
- * Gets the all of running service registered with the kernel that are an instances of the specified type. If no
- * running services are instances of the specified type, an empty list is returned
- *
- * @param type the of the desired service
- * @return the registered services that are instances of the specified type and are running
- */
- List getServices(Class type);
-
- /**
- * Gets the service factory registered under the specified name.
- *
- * @param serviceName the unique name of the service
- * @return the service factory associated with the specified name
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- */
- ServiceFactory getServiceFactory(ServiceName serviceName) throws ServiceNotFoundException;
-
- /**
- * Gets the first service factory registered with the kernel that creates an instance of the specified type.
- * If no service factories create an instance of the specified type, null is returned.
- *
- * @param type the of the desired service
- * @return the first service factory registered with the kernel that creates an instance of the specified type
- */
- ServiceFactory getServiceFactory(Class type);
-
- /**
- * Gets the all of the service factories registered with the kernel that create an instances of the specified type.
- * If no service factories create an instance of the specified type, an empty list is returned.
- *
- * @param type the of the desired service
- * @return the registered services that are instances of the specified type and are running
- */
- List getServiceFactories(Class type);
-
- /**
- * Gets the class loader associated with the specifed service.
- *
- * @param serviceName the unique name of the service
- * @return the class loader associated with the specified name
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- */
- ClassLoader getClassLoaderFor(ServiceName serviceName) throws ServiceNotFoundException;
-
- /**
- * Adds a kernel monitor.
- *
- * @param kernelMonitor the kernel monitor to add
- */
- void addKernelMonitor(KernelMonitor kernelMonitor);
-
- /**
- * Removes a kernel monitor.
- *
- * @param kernelMonitor the kernel monitor to remove
- */
- void removeKernelMonitor(KernelMonitor kernelMonitor);
-
- /**
- * Adds a service monitor for all services registered with the kernel. This method is equivalent to:
- * <p><blockquote><pre>
- * addServiceMonitor(serviceMonitor, null);
- * </pre></blockquote>
- * <p/>
- * Note: the order in which service monitors are notified is not specified.
- *
- * @param serviceMonitor the service monitor to add
- */
- void addServiceMonitor(ServiceMonitor serviceMonitor);
-
- /**
- * Adds a service monitor for a specific service.
- * <p/>
- * Note: the order in which service monitors are notified is not specified.
- *
- * @param serviceMonitor the service monitor to add
- * @param serviceName the unique name of the service to monitor or null to monitor all services
- */
- void addServiceMonitor(ServiceMonitor serviceMonitor, ServiceName serviceName);
-
- /**
- * Removes a service monitor.
- *
- * @param serviceMonitor the service monitor to remove
- */
- void removeServiceMonitor(ServiceMonitor serviceMonitor);
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelAlreadyExistsException.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelAlreadyExistsException.java
deleted file mode 100644
index aa108b2..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelAlreadyExistsException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * Indicates that a kernel is already registerd with the KernelFactory under the specified name.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class KernelAlreadyExistsException extends RuntimeException {
- private final String name;
-
- /**
- * Creates a KernelAlreadyExistsException using the specified name.
- *
- * @param name the name of the kernel that was alredy registered
- */
- public KernelAlreadyExistsException(String name) {
- super("A kernel is already registered with the name " + name);
- if (name == null) throw new NullPointerException("name is null");
- this.name = name;
- }
-
- /**
- * Gets the name of the kernel that already existed.
- *
- * @return the name of the kernel that already existed.
- */
- public String getName() {
- return name;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelErrorsError.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelErrorsError.java
deleted file mode 100644
index 243721d..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelErrorsError.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-/**
- * Groups a collection of errors from a set of work so they maybe be thrown together from the kernel. This is used
- * when the kernel does aggregate work on somthing that shouldn't fail such as when notifying kernel monitors or
- * destroying the kernel. This allows the kernel to preform all required work and then throw any errors as a single
- * exception object.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class KernelErrorsError extends Error {
- private final List errors;
-
- /**
- * Creates an Errors error containing the list of errors.
- *
- * @param errors the errors
- */
- public KernelErrorsError(List errors) {
- if (errors == null) throw new NullPointerException("errors is null");
- if (errors.isEmpty()) throw new IllegalArgumentException("errors is empty");
- for (ListIterator iterator = errors.listIterator(); iterator.hasNext();) {
- Object error = iterator.next();
- if (error == null) {
- throw new IllegalArgumentException("Errors element " + iterator.previousIndex() + " is null");
- }
- if (!(error instanceof Error)) {
- throw new IllegalArgumentException("Errors element " + iterator.previousIndex() +
- " is not an instance of java.lang.Error " + error.getClass() + ": " + error);
- }
- }
-
- this.errors = Collections.unmodifiableList(errors);
- }
-
- /**
- * Gets the errors that casued this error.
- *
- * @return the errors that casued this error
- */
- public List getErrors() {
- return errors;
- }
-
- public String getMessage() {
- StringBuffer message = new StringBuffer();
- message.append(errors.size() + " Error(s) occured [");
- for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
- Error error = (Error) iterator.next();
- message.append('\"').append(error.getMessage()).append('\"');
- if (iterator.hasNext()) {
- message.append(", ");
- }
- }
- return message.append("]").toString();
- }
-
- public String getLocalizedMessage() {
- StringBuffer message = new StringBuffer();
- message.append(errors.size() + " Error(s) occured [");
- for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
- Error error = (Error) iterator.next();
- message.append('\"').append(error.getLocalizedMessage()).append('\"');
- if (iterator.hasNext()) {
- message.append(", ");
- }
- }
- return message.append("]").toString();
- }
-
- public void printStackTrace(PrintStream stream) {
- synchronized (stream) {
- stream.println(this);
- for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
- Error error = (Error) iterator.next();
- error.printStackTrace(stream);
- }
- }
- }
-
- public void printStackTrace(PrintWriter writer) {
- synchronized (writer) {
- writer.println(this);
- for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
- Error error = (Error) iterator.next();
- error.printStackTrace(writer);
- }
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelFactory.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelFactory.java
deleted file mode 100644
index 0218708..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelFactory.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
-import org.apache.xbean.kernel.standard.StandardKernelFactory;
-
-/**
- * The Kernel factory is used to construct and locate Kernels. This class is loosly based on the SAXParserFactory and
- * the JMX MBeanServerFactory. To constuct a kernel use the following:
- * <p><blockquote><pre>
- * Kernel kernel = KernelFactory.newInstance().createKernel(name);
- * </pre></blockquote>
- *
- * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/kernel" element="load-all-main"
- * description="Creates kernels"
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public abstract class KernelFactory {
- /**
- * The name of the system property and META-INF/services used to locate the kernel factory class.
- */
- public static final String KERNEL_FACTORY_KEY = KernelFactory.class.getName();
-
- private static final ConcurrentHashMap kernels = new ConcurrentHashMap(1);
-
- /**
- * Gets the kernel registered under the specified name. If no kernel is registered with the specified name, null
- * is returned.
- *
- * @param name the name of the kernel to return
- * @return the kernel or null if no kernel is registered under the specified name
- */
- public static Kernel getKernel(String name) {
- if (name == null) throw new NullPointerException("name is null");
- return (Kernel) kernels.get(name);
- }
-
- /**
- * Gets a map of the existing kernels by kernel name.
- *
- * @return the existing kernels by kernel name.
- */
- public static Map getKernels() {
- return new HashMap(kernels);
- }
-
- /**
- * Creates a kernel with the specified name. This method will attempt to locate a KernelFactory implementation
- * using the following procedure
- * <ul> <li>
- * The org.apache.xbean.kernel.KernelFactory system property.
- * </li> <li>
- * Use the <a href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html">Jar Service Specification</a>
- * This method will attempt to get the factory name from the file
- * META-INF/services/org.apache.xbean.kernel.KernelFactory loaded using the thread context class loader.
- * </li>
- * <li>
- * The StandardKernel implementation.
- * </li>
- * </ul>
- * The factory class is loaded and constucted using the thread context class loader, if present, or the class
- * loader of this class.
- *
- * @return the kernel factory implementation
- * @throws KernelFactoryError if the specified kernel factory can not be created
- */
- public static KernelFactory newInstance() throws KernelFactoryError {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- if (classLoader == null) {
- classLoader = KernelFactory.class.getClassLoader();
- }
-
- // System property
- try {
- String kernelFactoryName = System.getProperty(KERNEL_FACTORY_KEY);
- if (kernelFactoryName != null) {
- return createKernelFactory(kernelFactoryName, classLoader);
- }
- } catch (SecurityException se) {
- }
-
- // Jar Service Specification - http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html
- String serviceId = "META-INF/services/" + KERNEL_FACTORY_KEY;
- InputStream inputStream = null;
- try {
- inputStream = classLoader.getResourceAsStream(serviceId);
- if (inputStream != null) {
- BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
- String kernelFactoryName = reader.readLine();
- reader.close();
-
- if (kernelFactoryName != null && kernelFactoryName.length() > 0) {
- return createKernelFactory(kernelFactoryName, classLoader);
- }
- }
- } catch (Exception ignored) {
- } finally {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (IOException ignored) {
- }
- inputStream = null;
- }
- }
-
- // Default is the standard kernel
- return new StandardKernelFactory();
- }
-
- /**
- * Removes the kernel instance from the internal kernel registry. This method should only be called by the kernel
- * instance itself during destruction.
- * @param kernel the kernel to destroy
- * @throws KernelFactoryError if the kernel is still running
- */
- public static void destroyInstance(Kernel kernel) throws KernelFactoryError {
- if (kernel.isRunning()) {
- throw new KernelFactoryError("Kernel is running: name" + kernel.getKernelName());
- }
-
- kernels.remove(kernel.getKernelName(), kernel);
- }
-
- private static KernelFactory createKernelFactory(String className, ClassLoader classLoader) throws KernelFactoryError {
- try {
- return (KernelFactory) classLoader.loadClass(className).newInstance();
- } catch (ClassCastException e) {
- throw new KernelFactoryError("Kernel factory class does not implement KernelFactory: " + className);
- } catch (ClassNotFoundException e) {
- throw new KernelFactoryError("Kernel factory class not found: " + className);
- } catch (Exception e) {
- throw new KernelFactoryError("Unable to instantiate kernel factory class: " + className, e);
- }
- }
-
- /**
- * Creates a new kernel instance and registers it with the static KernelFactory registry. This allows the kernel
- * to be retrieved from the {@link KernelFactory#getKernel(String)} method.
- *
- * @param name the name of the kernel to create
- * @return the new kernel
- * @throws KernelAlreadyExistsException is a kernel already exists with the specified name
- */
- public final Kernel createKernel(String name) throws KernelAlreadyExistsException {
- if (name == null) throw new NullPointerException("name is null");
-
- // quick check to see if a kernel already registerd wit the name
- if (kernels.containsKey(name)) {
- throw new KernelAlreadyExistsException(name);
- }
-
- // create the kernel -- this may be an unnecessary construction, but it shouldn't be a big deal
- Kernel kernel = createKernelInternal(name);
-
- // register the kernel, checking if someone snuck in an registered a kernel while we were creating ours
- if (kernels.putIfAbsent(name, kernel) != null) {
- throw new KernelAlreadyExistsException(name);
- }
-
- return kernel;
- }
-
- /**
- * Creates the actual kernel instance which will be registerd in the KernelFactory.
- *
- * @param name the kernel name
- * @return a new kernel instance
- */
- protected abstract Kernel createKernelInternal(String name);
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelFactoryError.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelFactoryError.java
deleted file mode 100644
index b846baf..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelFactoryError.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * A problem occured while creating or using the kernel factory. This error indicates that the kernel factory is
- * misconfigured or there is a programming error in the use of the kernel factory.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class KernelFactoryError extends Error {
- /**
- * Creates a KernelFactoryError using the specified message.
- *
- * @param message information about the cause of this error
- */
- public KernelFactoryError(String message) {
- super(message);
- }
-
- /**
- * Creates a KernelFactoryError using the specified message and cause.
- *
- * @param message information about the cause of this error
- * @param cause the cause of this error
- */
- public KernelFactoryError(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelMonitor.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelMonitor.java
deleted file mode 100644
index 9300a36..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelMonitor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * This interface defines the interface used to monitor kernel events. A KernelMonitor can be registered with the
- * kernel using the {@link Kernel#addKernelMonitor(KernelMonitor)} method.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface KernelMonitor {
- /**
- * An error occured with notifiying a service monitor.
- *
- * @param serviceMonitor the monitor that threw the exception
- * @param serviceEvent the event that was being processed
- * @param throwable the exception that was thrown
- */
- void serviceNotificationError(ServiceMonitor serviceMonitor, ServiceEvent serviceEvent, Throwable throwable);
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelOperationInterruptedException.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelOperationInterruptedException.java
deleted file mode 100644
index 8c0b766..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelOperationInterruptedException.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * Signifies that a thread carrying out a kernel operation was interrupted. The kernel will always leave the
- * system in a stable state before returning to the caller.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class KernelOperationInterruptedException extends RuntimeException {
- private final ServiceName serviceName;
- private final String operationName;
-
- /**
- * Created a KernelOperationInterruptedException for the specified operation on the specified service.
- *
- * @param cause the {@link InterruptedException} that casused the kernel operation to be interrupted
- * @param serviceName the name of the service for which the operation was interrupted
- * @param operationName the name of the operation that was interrupted
- */
- public KernelOperationInterruptedException(InterruptedException cause, ServiceName serviceName, String operationName) {
- super(cause);
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (operationName == null) throw new NullPointerException("operationName is null");
- this.serviceName = serviceName;
- this.operationName = operationName;
- }
-
- /**
- * Created a KernelOperationInterruptedException with a custom message.
- *
- * @param message a custom message for this exception
- * @param cause the {@link InterruptedException} that casused the kernel operation to be interrupted
- * @param serviceName the name of the service for which the operation was interrupted
- * @param operationName the name of the operation that was interrupted
- */
- public KernelOperationInterruptedException(String message, InterruptedException cause, ServiceName serviceName, String operationName) {
- super(message, cause);
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (operationName == null) throw new NullPointerException("operationName is null");
- this.serviceName = serviceName;
- this.operationName = operationName;
- }
-
- /**
- * Gets the name of the service for which the operation was interrupted.
- *
- * @return the name of the service for which the operation was interrupted
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-
- /**
- * Gets the name of the operation that was interrupted.
- *
- * @return the name of the operation that was interrupted
- */
- public String getOperationName() {
- return operationName;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelOperationTimoutException.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelOperationTimoutException.java
deleted file mode 100644
index 7bdb238..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/KernelOperationTimoutException.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * Signifies that a kernel operation timed out before it could be completed. The kernel will always leave the
- * system in a stable state before returning to the caller.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class KernelOperationTimoutException extends RuntimeException {
- private final ServiceName serviceName;
- private final String operationName;
-
- /**
- * Created a KernelOperationTimoutException for the specified operation on the specified service.
- *
- * @param serviceName the name of the service for which the operation timed out
- * @param operationName the name of the operation that timed out
- */
- public KernelOperationTimoutException(ServiceName serviceName, String operationName) {
- super("Kernel operation timed out: serviceName=" + serviceName + ", operationName=" + operationName);
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (operationName == null) throw new NullPointerException("operationName is null");
- this.serviceName = serviceName;
- this.operationName = operationName;
- }
-
- /**
- * Created a KernelOperationTimoutException using the specified custom message.
- *
- * @param message a custom message for this exception
- * @param serviceName the name of the service for which the operation timed out
- * @param operationName the name of the operation that timed out
- */
- public KernelOperationTimoutException(String message, ServiceName serviceName, String operationName) {
- super(message);
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (operationName == null) throw new NullPointerException("operationName is null");
- this.serviceName = serviceName;
- this.operationName = operationName;
- }
-
- /**
- * Gets the name of the service for which the operation timed out.
- *
- * @return the name of the service for which the operation timed out
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-
- /**
- * Gets the name of the operation that timed out.
- *
- * @return the name of the operation that timed out
- */
- public String getOperationName() {
- return operationName;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/NullServiceMonitor.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/NullServiceMonitor.java
deleted file mode 100644
index 6516adb..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/NullServiceMonitor.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * The NullServiceMonitor is a simple implementation of ServiceMonitor containing a noop implementaion of
- * each callback.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class NullServiceMonitor implements ServiceMonitor {
- /**
- * {@inheritDoc}
- */
- public void serviceRegistered(ServiceEvent serviceEvent) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStarting(ServiceEvent serviceEvent) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceWaitingToStart(ServiceEvent serviceEvent) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStartError(ServiceEvent serviceEvent) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceRunning(ServiceEvent serviceEvent) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStopping(ServiceEvent serviceEvent) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceWaitingToStop(ServiceEvent serviceEvent) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStopError(ServiceEvent serviceEvent) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStopped(ServiceEvent serviceEvent) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceUnregistered(ServiceEvent serviceEvent) {
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/RunningServiceCondition.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/RunningServiceCondition.java
deleted file mode 100644
index 30d327e..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/RunningServiceCondition.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * This condition that requires another service be in the RUNNING state to be satisfied.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class RunningServiceCondition implements ServiceCondition {
- private final ServiceName dependency;
- private final boolean ownedRelationship;
- private final boolean stopOnServiceShutdown;
- private final DependencyServiceMonitor serviceMonitor = new DependencyServiceMonitor();
-
- private ServiceConditionContext context;
- private boolean satisfied = true;
- private StoppedServiceCondition stoppedServiceCondition;
-
- /**
- * Creates a condition that requires the specified service be in the RUNNING state to be satisfied.
- *
- * @param dependency the service that must be running
- * @param ownedRelationship if true the condition will register the relationship
- * @param stopOnServiceShutdown if the our service should be stopped when the specified service shutsdown
- */
- public RunningServiceCondition(ServiceName dependency, boolean ownedRelationship, boolean stopOnServiceShutdown) {
- if (dependency == null) throw new NullPointerException("dependency is null");
- this.dependency = dependency;
- this.ownedRelationship = ownedRelationship;
- this.stopOnServiceShutdown = stopOnServiceShutdown;
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized void initialize(ServiceConditionContext context) {
- if (context == null) throw new NullPointerException("context is null");
-
- // if we have no been destroyed, destroy not
- if (this.context != null) {
- destroy();
- }
-
- this.context = context;
-
- satisfied = false;
- context.getKernel().addServiceMonitor(serviceMonitor, dependency);
- if (ownedRelationship) {
- // todo register owned relationship
- }
-
- if (stopOnServiceShutdown) {
- stoppedServiceCondition = new StoppedServiceCondition(context.getServiceName());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized boolean isSatisfied() {
- if (context == null) {
- // we are not initialized so default to true
- return true;
- }
-
- if (!satisfied) {
- try {
- // grab a synchronized lock on the service factory to assure that the state doesn't change while
- // adding the dependency.... the kernel will grab the same lock when getting the stop dependencies
- ServiceFactory serviceFactory = context.getKernel().getServiceFactory(dependency);
- synchronized (serviceFactory) {
- if (context.getKernel().getService(dependency) == ServiceState.RUNNING) {
- if (stopOnServiceShutdown) {
- serviceFactory.addStopCondition(stoppedServiceCondition);
- }
- satisfied = true;
- context.getKernel().removeServiceMonitor(serviceMonitor);
- }
- }
- } catch (ServiceNotFoundException ignored) {
- // service hasn't registered yet
- }
- }
- return satisfied;
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized void destroy() {
- if (context == null) {
- // we are already destroyed
- return;
- }
-
- context.getKernel().removeServiceMonitor(serviceMonitor);
- context = null;
- satisfied = true;
- if (ownedRelationship) {
- // todo unregister owned relationship
- }
- if (stopOnServiceShutdown) {
- stoppedServiceCondition.destroy();
- stoppedServiceCondition = null;
- }
- }
-
- private class DependencyServiceMonitor extends NullServiceMonitor {
- public void serviceRunning(ServiceEvent serviceEvent) {
- synchronized (RunningServiceCondition.this) {
- if (context != null) {
- // we aren't running anymore
- return;
- }
-
- if (!satisfied) {
- return;
- }
-
- if (isSatisfied()) {
- context.setSatisfied();
- }
- }
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceAlreadyExistsException.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceAlreadyExistsException.java
deleted file mode 100644
index 9c1d7fe..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceAlreadyExistsException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * Signifies that an attempt was made to register a service using a name that already has a service registered.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceAlreadyExistsException extends Exception {
- private final ServiceName serviceName;
-
- /**
- * Creates a ServiceAlreadyExistsException for the specified service name.
- *
- * @param serviceName the name of the service that already exists
- */
- public ServiceAlreadyExistsException(ServiceName serviceName) {
- if (serviceName == null) throw new NullPointerException("name is null");
- this.serviceName = serviceName;
- }
-
- /**
- * Gets the name of the service that caused this exception.
- *
- * @return the service name
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceCondition.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceCondition.java
deleted file mode 100644
index 749135b..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceCondition.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * A ServiceContion represents a prerequsite for a service to start or stop. A condition can be added to a service with
- * the {@link ServiceFactory#addStartCondition(ServiceCondition)} or
- * {@link ServiceFactory#addStopCondition(ServiceCondition)} methods.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface ServiceCondition {
- /**
- * Initializes the condition. The conition is now allowed reserve unique resources and start threads.
- * mehtod should never block the thread nor should it throw any exceptions.
- * </p>
- * Note: this method is called from within a critical lock within the kernel, so do not block the thread or
- * call back into the kernel. This method should never throw an exception.
- *
- * @param context context information for this condition
- */
- void initialize(ServiceConditionContext context);
-
- /**
- * Gets statisfied state of this conditon. Once a condition returns true from this method it is assumed to be satisfied until
- * destroyed and reinitialized.
- * </p>
- * Note: this method is called from within a critical lock within the kernel, so do not block the thread or
- * call back into the kernel. This method should never throw an exception.
- *
- * @return true if this condition is satisfied; false otherwise
- */
- boolean isSatisfied();
-
- /**
- * Destroys the condition. The condition must release all resources and stop any started threads.
- * </p>
- * Note: this method is called from within a critical lock within the kernel, so do not block the thread or
- * call back into the kernel. This method should never throw an exception.
- */
- void destroy();
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceConditionContext.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceConditionContext.java
deleted file mode 100644
index 1d5f53c..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceConditionContext.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * The ServiceConditionContext contains context information available to a service condition and a method to notify
- * the kernel if a service condition is satisified asynchronously.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface ServiceConditionContext {
- /**
- * Gets the kernel in which the service is registered.
- *
- * @return the kernel in which the service is registered
- */
- Kernel getKernel();
-
- /**
- * Gets the unique name of the service.
- *
- * @return the unique name of the service
- */
- ServiceName getServiceName();
-
- /**
- * Gets the class loader for the service.
- *
- * @return the class loader for the service
- */
- ClassLoader getClassLoader();
-
- /**
- * Used to notify the container that the condition has been satisfied asychronously.
- */
- void setSatisfied();
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceContext.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceContext.java
deleted file mode 100644
index bf70af1..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceContext.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * This class contains context information available to a service factory during service construction and destruction.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface ServiceContext {
- /**
- * Gets the kernel in which this service is registered.
- *
- * @return the kernel in which this service is registered
- */
- Kernel getKernel();
-
- /**
- * Gets the unique name of the service in the kernel.
- *
- * @return the unique name of this service in the kernel
- */
- ServiceName getServiceName();
-
- /**
- * Gets the class loader for this service.
- *
- * @return the class loader for this service
- */
- ClassLoader getClassLoader();
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceContextThreadLocal.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceContextThreadLocal.java
deleted file mode 100644
index afe1332..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceContextThreadLocal.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * ServiceContextThreadLocal carries the ServiceContext on the Thread during service construction and destruction.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public final class ServiceContextThreadLocal {
- private ServiceContextThreadLocal() {
- }
-
- private static final ThreadLocal THREAD_LOCAL = new ThreadLocal();
-
- /**
- * Gets the ServiceContext associated with the current thread.
- * @return the ServiceContext associated with the current thread
- */
- public static ServiceContext get() {
- return (ServiceContext) THREAD_LOCAL.get();
- }
-
- /**
- * Assocates the specified ServiceContext with the current thread.
- * @param serviceContext the service context to associate with the current thread
- */
- public static void set(ServiceContext serviceContext) {
- THREAD_LOCAL.set(serviceContext);
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceEvent.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceEvent.java
deleted file mode 100644
index f154329..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceEvent.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.Set;
-
-/**
- * This class holds information about a service event.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceEvent {
- private final long eventId;
- private final Kernel kernel;
- private final ServiceName serviceName;
- private final ServiceFactory serviceFactory;
- private final ClassLoader classLoader;
- private final Object service;
- private final Throwable cause;
- private final Set unsatisfiedConditions;
-
- /**
- * Creates a service event.
- *
- * @param eventId the sequence number for this event
- * @param kernel the kernel in which the service is registered
- * @param serviceName the name of the service
- * @param serviceFactory the factory for the service
- * @param classLoader the class loader for the service
- * @param service the service instance if it exists
- * @param cause the exception that caused the event if this is an exception event
- * @param unsatisfiedConditions the unsatified conditions that caused the event if this is a waiting event
- */
- public ServiceEvent(long eventId, Kernel kernel, ServiceName serviceName, ServiceFactory serviceFactory, ClassLoader classLoader, Object service, Throwable cause, Set unsatisfiedConditions) {
- if (kernel == null) throw new NullPointerException("kernel is null");
- if (serviceName == null) throw new NullPointerException("name is null");
- if (serviceFactory == null) throw new NullPointerException("serviceFactory is null");
- if (classLoader == null) throw new NullPointerException("classLoader is null");
- if (unsatisfiedConditions != null && cause != null) throw new IllegalArgumentException("Either unsatisfiedConditions or cause must be null");
- if (cause != null && service != null) throw new IllegalArgumentException("A ServiceEvent can not carry both a cause and a service");
- this.eventId = eventId;
- this.kernel = kernel;
- this.serviceName = serviceName;
- this.serviceFactory = serviceFactory;
- this.classLoader = classLoader;
- this.service = service;
- this.cause = cause;
- this.unsatisfiedConditions = unsatisfiedConditions;
- }
-
- /**
- * Gets the sequence number for this event. A service gaurentees that events will occur in increasing order with out
- * skipping any numbers.
- *
- * @return the sequence number for this event
- */
- public long getEventId() {
- return eventId;
- }
-
- /**
- * Gets the kernel in which the service is registered.
- *
- * @return the kernel in which the servce is registerd
- */
- public Kernel getKernel() {
- return kernel;
- }
-
- /**
- * Gets the name of the service.
- *
- * @return the name of the service
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-
- /**
- * Gets the service factory for the service.
- *
- * @return the service factory for the service
- */
- public ServiceFactory getServiceFactory() {
- return serviceFactory;
- }
-
- /**
- * Gets the class loader for the service.
- *
- * @return the class loader for the service
- */
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-
- /**
- * Gets the service instance or null if the service doesn't exist.
- *
- * @return the service instance
- */
- public Object getService() {
- return service;
- }
-
- /**
- * Gets the error that was thrown during startup or shutdown. This is available only in error events.
- *
- * @return the error
- */
- public Throwable getCause() {
- return cause;
- }
-
- /**
- * Gets the unsatified dependencies that cause the service to wait. This is available only in waiting events.
- *
- * @return the unsatified dependencies that cause the service to wait
- */
- public Set getUnsatisfiedConditions() {
- return unsatisfiedConditions;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceFactory.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceFactory.java
deleted file mode 100644
index d1e1fbf..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceFactory.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.Set;
-
-/**
- * A service factory is responsible for construction and destruction of a single service. A service factory provides
- * the kernel the start conditions, stopped conditions, owned services and enabled status of the service.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface ServiceFactory {
- /**
- * Gets the types of the service this service factory will create. These types is used to index the service within
- * the kernel. It is a start error to return an object from create service that is not an instance of every type.
- * This is the only type used to index the service, so if the service factory returns a subclass of this type from
- * createService, the subtypes will now be reflected in the index.
- *
- * @return the type of the service this service factory will create
- */
- Class[] getTypes();
-
- /**
- * A restartable service can be started and stopped repeatedly in the kernel. A service that is not restartable
- * immediately enters the RUNNING state when registered with the kernel, and can not be started or stopped.
- *
- * @return true if this service can be started and stopped; false otherwise
- */
- boolean isRestartable();
-
- /**
- * Determines if the service can be instantiated in a kernel. A disabled restartable service can not be
- * started and a disabled non-restartable service can not be loaded into a kernel.
- *
- * @return true if the service factory is enabled; false otherwise
- */
- boolean isEnabled();
-
- /**
- * Sets the enabled status of this service factory. A disabled restartable service can not be
- * started and a disabled non-restartable service can not be loaded into a kernel.
- *
- * @param enabled the new enabled state of this factory
- */
- void setEnabled(boolean enabled);
-
- /**
- * Get an unmodifable snapshot of the conditions that must be satisfied before this service can be started.
- *
- * @return the start conditions of this service
- */
- Set getStartConditions();
-
- /**
- * Adds start condition to this service.
- *
- * @param startCondition the new start condition
- * @throws NullPointerException if startCondition is null
- */
- void addStartCondition(ServiceCondition startCondition) throws NullPointerException;
-
- /**
- * Removes a start condition from this service.
- *
- * @param startCondition the start condition to remove
- * @throws NullPointerException if startCondition is null
- */
- void removeStartCondition(ServiceCondition startCondition) throws NullPointerException;
-
- /**
- * Get an unmodifable snapshot of the conditions that must be satisfied before this service can be stopped.
- *
- * @return the stop conditions of this service
- */
- Set getStopConditions();
-
- /**
- * Adds stop condition to this service.
- *
- * @param stopCondition the new stop condition
- * @throws NullPointerException if stopCondition is null
- */
- void addStopCondition(ServiceCondition stopCondition) throws NullPointerException;
-
- /**
- * Removes a stop condition from this service.
- *
- * @param stopCondition the stop condition to remove
- * @throws NullPointerException if stopCondition is null
- */
- void removeStopCondition(ServiceCondition stopCondition) throws NullPointerException;
-
- /**
- * Gets the names of services owned by this service. This information is used for the startRecursive method on the
- * kernel. When a servcie is started with startRecursive all owned services will be started with startRecursive.
- *
- * @return the names of the services owned by this service
- */
- Set getOwnedServices();
-
- /**
- * Creates the service instance.
- *
- * @param serviceContext context information for the new service
- * @return the service instance
- * @throws Exception if a problem occurs during construction
- */
- Object createService(ServiceContext serviceContext) throws Exception;
-
- /**
- * Destroys the service instance.
- *
- * @param serviceContext the context information for the service
- */
- void destroyService(ServiceContext serviceContext);
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceMonitor.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceMonitor.java
deleted file mode 100644
index ebb4c22..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceMonitor.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * This interface is used to monitor service lifecycle events. A ServiceMonitor can be registered with a kernel using
- * {@link Kernel#addServiceMonitor(ServiceMonitor)} or {@link Kernel#addServiceMonitor(ServiceMonitor, ServiceName)}.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface ServiceMonitor {
- /**
- * A new service has been registered with the kernel.
- *
- * @param serviceEvent the event information
- */
- void serviceRegistered(ServiceEvent serviceEvent);
-
- /**
- * A service has entered the STARTING state.
- *
- * @param serviceEvent the event information
- */
- void serviceStarting(ServiceEvent serviceEvent);
-
- /**
- * A service is waiting to start because some start conditions are unsatified.
- *
- * @param serviceEvent the event information
- * @see ServiceEvent#getUnsatisfiedConditions()
- */
- void serviceWaitingToStart(ServiceEvent serviceEvent);
-
- /**
- * An error occured while calling creating the service.
- *
- * @param serviceEvent the event information
- * @see ServiceEvent#getCause()
- */
- void serviceStartError(ServiceEvent serviceEvent);
-
- /**
- * A service has entered the RUNNING state.
- *
- * @param serviceEvent the event information
- */
- void serviceRunning(ServiceEvent serviceEvent);
-
- /**
- * A service has entered the RUNNING state.
- *
- * @param serviceEvent the event information
- */
- void serviceStopping(ServiceEvent serviceEvent);
-
- /**
- * A service is waiting to stop because some stop condition is unsatified.
- *
- * @param serviceEvent the event information
- * @see ServiceEvent#getUnsatisfiedConditions()
- */
- void serviceWaitingToStop(ServiceEvent serviceEvent);
-
- /**
- * An error occured while calling destroying the service.
- *
- * @param serviceEvent the event information
- * @see ServiceEvent#getCause()
- */
- void serviceStopError(ServiceEvent serviceEvent);
-
- /**
- * A service has entered the STOPPED state.
- *
- * @param serviceEvent the event information
- */
- void serviceStopped(ServiceEvent serviceEvent);
-
- /**
- * A service has been unregistered from the kernel.
- *
- * @param serviceEvent the event information
- */
- void serviceUnregistered(ServiceEvent serviceEvent);
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceName.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceName.java
deleted file mode 100644
index f2f3b19..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceName.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * The immutable unique name of a service. A proper implementation of ServiceName must have a correct implementation of
- * equals and hashCode. A ServiceName should have one constructor that takes a single String and the toString method
- * should return a String that can be used in the String constructor. This means the following code should work:
- * <p><blockquote><pre>
- * Constructor constructor = serviceName.getClass().getConstructor(new Class[] {String.class});
- * ServiceName name = constructor.newInstance(new Object[] {serviceName.toString()});
- * </pre></blockquote>
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface ServiceName {
- /**
- * A service name must properly implement hashCode. For example,
- * <p><blockquote><pre>
- * public int hashCode() {
- * int result = 17;
- * result = 37 * result + integer;
- * result = 37 * result + (object == null ? 0 : object.hashCode());
- * return result;
- * }
- * </pre></blockquote>
- *
- * @return the hash code
- */
- int hashCode();
-
- /**
- * A service name must property implement equals. For example,
- * <p><blockquote><pre>
- * public boolean equals(Object obj) {
- * if (!(obj instanceof MyServiceName)) {
- * return false;
- * }
- * MyServiceName name = (MyServiceName) obj;
- * return integer == name.integer &&
- * (object == null ? name.object == null : object.equals(name.object));
- * }
- * </pre></blockquote>
- *
- * @param object some object
- * @return true if the object is equivalent to this service name; false otherwise
- */
- boolean equals(Object object);
-
- /**
- * A service name should return a string from toString that can be used in a String constructor.
- *
- * @return the connonical form of this name
- */
- String toString();
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceNotFoundException.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceNotFoundException.java
deleted file mode 100644
index 34b8e10..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceNotFoundException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * A service with the specified name was not found.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceNotFoundException extends Exception {
- private final ServiceName serviceName;
-
- /**
- * Creates a ServiceNotFoundException for the specified service name.
- *
- * @param serviceName the name of the service that was not found.
- */
- public ServiceNotFoundException(ServiceName serviceName) {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- this.serviceName = serviceName;
- }
-
- /**
- * Gets the name of the service that was not found.
- *
- * @return the the name of the service that was not found
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceRegistrationException.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceRegistrationException.java
deleted file mode 100644
index caf0445..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceRegistrationException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * A problem occured while attempting to register or unregister an exception.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceRegistrationException extends Exception {
- private final ServiceName serviceName;
-
- /**
- * Creates a ServiceRegistrationException for the specified service caused by the specified Throwable.
- *
- * @param serviceName the name of the service that was being registered or unregistered.
- * @param cause the reason the registeration problem occured
- */
- public ServiceRegistrationException(ServiceName serviceName, Throwable cause) {
- super(cause);
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- this.serviceName = serviceName;
- }
-
- /**
- * Gets the name of the service that had a registration problem.
- *
- * @return the the name of the service that had a registration problem
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceState.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceState.java
deleted file mode 100644
index 72d9974..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/ServiceState.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.io.Serializable;
-
-/**
- * The state of services within the Kernel. The state model is directly adapted from the J2EE Management Specification
- * (JSR 77) with the removal of the FAILED state.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public final class ServiceState implements Serializable {
- private static final long serialVersionUID = -2629672602273580572L;
-
- /**
- * This state indicates that the service is attempting to start but has not fully started yet. Normally, a service
- * in this state is waiting for a required service to enter the RUNNING state.
- */
- public static final ServiceState STARTING = new ServiceState((byte) 0, "STARTING");
-
- /**
- * This state indicates that the service is in the normal operational state.
- */
- public static final ServiceState RUNNING = new ServiceState((byte) 1, "RUNNING");
-
- /**
- * This state indicates that the service is attempting to stop but has not fully stopped yet. Normally, a service
- * in this state because another service is still usind this service.
- */
- public static final ServiceState STOPPING = new ServiceState((byte) 2, "STOPPING");
-
- /**
- * This state indicates that the service is stopped and not operational.
- */
- public static final ServiceState STOPPED = new ServiceState((byte) 3, "STOPPED");
-
- /**
- * A quick index for looking up service states.
- */
- private static final ServiceState[] serviceStateIndex = new ServiceState[]{STARTING, RUNNING, STOPPING, STOPPED};
-
- static {
- for (int i = 0; i < serviceStateIndex.length; i++) {
- ServiceState serviceState = serviceStateIndex[i];
- if (serviceState.getIndex() != i) {
- throw new AssertionError(serviceState + " state index is " + serviceState.getIndex() +
- ", but is located at index " + i + " in the serviceStateIndex");
- }
- }
- }
-
- /**
- * Converts the state index into corresponding state name.
- *
- * @param state the state index
- * @return the name of the state
- * @throws IllegalArgumentException if the state index is not 0, 1, 2 or 3
- */
- public static ServiceState getServiceState(int state) throws IllegalArgumentException {
- if (state < 0 || state >= serviceStateIndex.length) {
- throw new IllegalArgumentException("Unknown state " + state);
- }
- return serviceStateIndex[state];
- }
-
- /**
- * Converts the state name in the corresponding state index. This method performs a case insensitive comparison.
- *
- * @param state the state name
- * @return the state index
- * @throws IllegalArgumentException if the state index is not STARTING, RUNNING, STOPPING or FAILED
- */
- public static ServiceState parseServiceState(String state) {
- if (state == null) throw new NullPointerException("state is null");
- if (STARTING.toString().equalsIgnoreCase(state)) {
- return STARTING;
- } else if (RUNNING.toString().equalsIgnoreCase(state)) {
- return RUNNING;
- } else if (STOPPING.toString().equalsIgnoreCase(state)) {
- return STOPPING;
- } else if (STOPPED.toString().equalsIgnoreCase(state)) {
- return STOPPED;
- } else {
- throw new IllegalArgumentException("Unknown state " + state);
- }
- }
-
- private final byte index;
- private final transient String name;
-
- private ServiceState(byte index, String name) {
- this.index = index;
- this.name = name;
- }
-
- /**
- * Gets the unique index of this state. This index can be be used to retrieve this state instance using the
- * getServiceState(int) method.
- *
- * @return the unique index of this state
- */
- public int getIndex() {
- return index;
- }
-
- /**
- * The unique name of this state. This uppercase name can be used to retrieve this state instance using the
- * parseServiceState(String).
- *
- * @return the unique name of this state
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns the name of this state.
- *
- * @return the unique name of this state
- */
- public String toString() {
- return name;
- }
-
- private Object readResolve() {
- return serviceStateIndex[index];
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StartStrategies.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StartStrategies.java
deleted file mode 100644
index 1d9c963..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StartStrategies.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.Set;
-
-/**
- * This class contains the built-in common start startegies.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public final class StartStrategies {
- private StartStrategies() {
- }
-
- /**
- * This strategy attempts to immedately start the service. When there are unsatisfied conditions, this strategy
- * will leave the service in the STARTING state, and throw an UnsatisfiedConditionsException
- * to the caller. When there is a start error, the service will be destroyed and the exception will be rethrown to
- * the caller.
- */
- public static final StartStrategy SYNCHRONOUS = new Synchronous();
-
- private static class Synchronous implements StartStrategy {
- public boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions) throws UnsatisfiedConditionsException {
- throw new UnsatisfiedConditionsException("Unsatisfied start conditions", serviceName, conditions);
- }
-
- public void startError(ServiceName serviceName, Throwable startError) throws Exception {
- if (startError instanceof Exception) {
- throw (Exception) startError;
- } else if (startError instanceof Error) {
- throw (Error) startError;
- } else {
- throw new AssertionError(startError);
- }
- }
- }
-
- /**
- * This strategy attempts to start the service asynchronously. When there are unsatisfied conditions, this strategy
- * will leave the service in the STARTING state, and caller will not recieve any exceptions.
- * When there is a start error the service will be destroyed adn the exception will be sent to the service montior.
- * The caller will not recieve any start exception.
- */
- public static final StartStrategy ASYNCHRONOUS = new Asynchronous();
-
- private static class Asynchronous implements StartStrategy {
- public boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions) {
- return false;
- }
-
- public void startError(ServiceName serviceName, Throwable startError) {
- }
- }
-
- /**
- * This strategy wait until the service start. This strategy blocks until all unsatisfied conditons
- * are satisfied. When there is a start error, the service will be destroyed and the exception will be rethrown to
- * the caller.
- */
- public static final StartStrategy BLOCK = new Block();
-
- private static class Block implements StartStrategy {
- public boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions) {
- return true;
- }
-
- public void startError(ServiceName serviceName, Throwable startError) throws Exception {
- if (startError instanceof Exception) {
- throw (Exception) startError;
- } else if (startError instanceof Error) {
- throw (Error) startError;
- } else {
- throw new AssertionError(startError);
- }
- }
- }
-
- /**
- * This strategy attempts to start the service immedately. When there are unsatisfied conditions or a start error
- * the dervice will be destroyed and unregistered. In this case an UnsatisfiedConditionsException or
- * the start error will be thrown to the caller.
- */
- public static final StartStrategy UNREGISTER = new Unregister();
-
- private static class Unregister implements StartStrategy {
- public boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions) throws UnregisterServiceException {
- UnsatisfiedConditionsException userException = new UnsatisfiedConditionsException("Unsatisfied start conditions", serviceName, conditions);
- throw new UnregisterServiceException(serviceName, userException);
- }
-
- public void startError(ServiceName serviceName, Throwable startError) throws UnregisterServiceException {
- throw new UnregisterServiceException(serviceName, startError);
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StartStrategy.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StartStrategy.java
deleted file mode 100644
index 381f8a6..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StartStrategy.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.Set;
-
-/**
- * The StartStrategy interface is used to assist the kernel in determining how to handle problems that occur while
- * starting a service.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface StartStrategy {
- /**
- * Determines if the kernel should wait for the unsatified conditions to be satisfied.
- *
- * @param serviceName the name of the service that has the unsatisfied condtions
- * @param conditions the unsatisfied condtions
- * @return true if the kernel should wait for the conditions to be satisfied; false if the strategy would like
- * silently leave the service in the starting state
- * @throws UnsatisfiedConditionsException the the strategy would like to leave the service in the starting state
- * and throw an exception the caller
- * @throws UnregisterServiceException if the strategy would like to ignore the unsatisfied conditions and continue to
- * destry the service
- */
- boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions) throws UnsatisfiedConditionsException, UnregisterServiceException;
-
- /**
- * Handle the start error. The strategy can rethrow the exception, throw an {@link UnregisterServiceException}, or
- * return. If this method rethrows the exception, the service will be destroyed and the exception will be thrown to
- * the caller. If an UnregisterServiceException is thrown, the kernel will unregister the service and rethrow
- * {@link UnregisterServiceException#getCause()}. If this method returns without throwing an exception, the kernel
- * will pass the exception to the service monitor for processing and leave the service in the starting state.
- *
- * @param serviceName the name of the service that has the error
- * @param startError the Exception or Error
- * @throws UnregisterServiceException if the strategy would like the service to be destroyed and unregistered
- * @throws Exception if the strategy would like to destroy the service and throw the exception to the caller
- */
- void startError(ServiceName serviceName, Throwable startError) throws UnregisterServiceException, Exception;
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StaticServiceFactory.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StaticServiceFactory.java
deleted file mode 100644
index d5c2874..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StaticServiceFactory.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * A basic service factory that always creates the supplied object.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class StaticServiceFactory extends AbstractServiceFactory {
- private final Object service;
-
- /**
- * Creates a non-restartable service factory which will simply returns the specified service from the createService
- * method.
- *
- * @param service the static to which this factory "creates"
- * @throws NullPointerException if service is null
- */
- public StaticServiceFactory(Object service) throws NullPointerException {
- if (service == null) throw new NullPointerException("service is null");
- this.service = service;
- }
-
- public Class[] getTypes() {
- return new Class[]{service.getClass()};
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isRestartable() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public Set getOwnedServices() {
- return Collections.EMPTY_SET;
- }
-
- /**
- * Returns the static service instance.
- *
- * @param serviceContext ignored
- * @return the static service instance
- */
- public Object createService(ServiceContext serviceContext) {
- return service;
- }
-
- /**
- * This method is a noop.
- *
- * @param serviceContext ignored
- */
- public void destroyService(ServiceContext serviceContext) {
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StopStrategies.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StopStrategies.java
deleted file mode 100644
index b16465c..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StopStrategies.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.Set;
-
-/**
- * This class contains the built-in common stop startegies.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public final class StopStrategies {
- private StopStrategies() {
- }
-
- /**
- * This strategy attempts to immedately stop the service. When there are unsatisfied conditions, this strategy
- * will leave the service in the STOPPING state, and throw an UnsatisfiedConditionsException
- * to the caller.
- */
- public static final StopStrategy SYNCHRONOUS = new Synchronous();
-
- private static class Synchronous implements StopStrategy {
- public boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions) throws UnsatisfiedConditionsException {
- throw new UnsatisfiedConditionsException("Unsatisfied stop conditions", serviceName, conditions);
- }
-
- }
-
- /**
- * This strategy attempts to stop the service asynchronously. When there are unsatisfied conditions, this strategy
- * will leave the service in the STOPPING state, and caller will not recieve any exceptions.
- */
- public static final StopStrategy ASYNCHRONOUS = new Asynchronous();
-
- private static class Asynchronous implements StopStrategy {
- public boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions) {
- return false;
- }
-
- }
-
- /**
- * This strategy wait until the service stops. This strategy blocks until all unsatisfied conditons
- * are satisfied.
- */
- public static final StopStrategy BLOCK = new Block();
-
- private static class Block implements StopStrategy {
- public boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions) {
- return true;
- }
-
- }
-
- /**
- * This strategy forceable stops the service. This strategy ignores all unsatisfied conditons.
- */
- public static final StopStrategy FORCE = new Force();
-
- private static class Force implements StopStrategy {
- public boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions) throws ForcedStopException {
- throw new ForcedStopException(serviceName, conditions);
- }
-
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StopStrategy.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StopStrategy.java
deleted file mode 100644
index bed595b..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StopStrategy.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.Set;
-
-/**
- * The StopStrategy interface is used to assist the kernel in determining how to handle problems that occur while
- * stoping a service.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface StopStrategy {
- /**
- * Determines if the kernel should wait for the unsatified conditions to be satisfied.
- *
- * @param serviceName the name of the service that has the unsatisfied condtions
- * @param conditions the unsatisfied condtions
- * @return true if the kernel should wait for the conditions to be satisfied; false if the strategy would like
- * silently leave the service in the stopping state
- * @throws UnsatisfiedConditionsException the the strategy would like to leave the service in the stopping state
- * and throw an exception the caller
- * @throws ForcedStopException if the strategy would like to ignore the unsatisfied conditions and continue to
- * destroy the service
- */
- boolean waitForUnsatisfiedConditions(ServiceName serviceName, Set conditions) throws UnsatisfiedConditionsException, ForcedStopException;
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StoppedServiceCondition.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StoppedServiceCondition.java
deleted file mode 100644
index f2283e8..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StoppedServiceCondition.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * This condition that requires another service be in the STOPPED state to be satisfied.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class StoppedServiceCondition implements ServiceCondition {
- private final ServiceName dependency;
- private final DependencyServiceMonitor serviceMonitor = new DependencyServiceMonitor();
-
- private ServiceConditionContext context;
- private boolean satisfied = true;
-
- /**
- * Creates a condition that requires the specified service be in the STOPPED state to be satisfied.
- *
- * @param dependency the service that must be stopped
- */
- public StoppedServiceCondition(ServiceName dependency) {
- if (dependency == null) throw new NullPointerException("dependency is null");
- this.dependency = dependency;
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized void initialize(ServiceConditionContext context) {
- if (context == null) throw new NullPointerException("context is null");
-
- // if we have no been destroyed, destroy not
- if (this.context != null) {
- destroy();
- }
-
- this.context = context;
-
- satisfied = false;
- context.getKernel().addServiceMonitor(serviceMonitor, dependency);
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized boolean isSatisfied() {
- if (context == null) {
- // we are not initialized so default to true
- return true;
- }
-
- if (!satisfied) {
- try {
- if (context.getKernel().getService(dependency) == ServiceState.RUNNING) {
- satisfied = true;
- context.getKernel().removeServiceMonitor(serviceMonitor);
- }
- } catch (ServiceNotFoundException ignored) {
- // service hasn't registered yet
- }
- }
- return satisfied;
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized void destroy() {
- if (context == null) {
- // we are already destroyed
- return;
- }
-
- context.getKernel().removeServiceMonitor(serviceMonitor);
- context = null;
- satisfied = true;
- }
-
- private class DependencyServiceMonitor extends NullServiceMonitor {
- public void serviceStopped(ServiceEvent serviceEvent) {
- synchronized (StoppedServiceCondition.this) {
- if (context != null) {
- // we aren't running anymore
- return;
- }
-
- if (!satisfied) {
- return;
- }
-
- if (isSatisfied()) {
- context.setSatisfied();
- }
- }
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StringServiceName.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StringServiceName.java
deleted file mode 100644
index 5c0e8b8..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/StringServiceName.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * A simple service name containing a single String.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class StringServiceName implements ServiceName {
- /**
- * The strang name of the service.
- */
- private final String name;
-
- /**
- * Create a StringServiceName wrapping specified name.
- *
- * @param name the name of the service
- */
- public StringServiceName(String name) {
- if (name == null) throw new NullPointerException("name is null");
- if (name.length() == 0) throw new IllegalArgumentException("name must be atleast one character long");
- this.name = name;
- }
-
- public int hashCode() {
- return name.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof StringServiceName) {
- StringServiceName stringServiceName = (StringServiceName) obj;
- return name.equals(stringServiceName.name);
- }
- return false;
- }
-
- public String toString() {
- return name;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/UnregisterServiceException.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/UnregisterServiceException.java
deleted file mode 100644
index 39324cf..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/UnregisterServiceException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-/**
- * Signafies that there was a problem starting a service and the StartStrategies would like the kernel to
- * unregister the service.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class UnregisterServiceException extends Exception {
- private final ServiceName serviceName;
-
- /**
- * Creates a UnregisterServiceException for the specified service name.
- *
- * @param serviceName the name of the service that is to be unregistered
- * @param cause the reason we are unregistering the service
- */
- public UnregisterServiceException(ServiceName serviceName, Throwable cause) {
- super(cause);
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- this.serviceName = serviceName;
- }
-
- /**
- * Gets the name of the service that is to be unregistered.
- *
- * @return the service name
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/UnsatisfiedConditionsException.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/UnsatisfiedConditionsException.java
deleted file mode 100644
index c697b25..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/UnsatisfiedConditionsException.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * Signifies that there were unsatified conditions during a start or stop operation. The service is left in the
- * STARTING state or STOPPING state.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class UnsatisfiedConditionsException extends Exception {
- private final ServiceName serviceName;
- private final Set unsatisfiedConditions;
-
- /**
- * Creates an UnsatisfiedConditionsException for the specified service and unsatisfied conditions.
- *
- * @param message information about the unsatisfied conditions
- * @param serviceName the name of the service that has unsatisfied conditions
- * @param unsatisfiedConditions the unsatisfied conditions
- */
- public UnsatisfiedConditionsException(String message, ServiceName serviceName, Set unsatisfiedConditions) {
- super(message + ": serviceName=" + serviceName + ": unsatisfiedConditions=" + unsatisfiedConditions);
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (unsatisfiedConditions == null) throw new NullPointerException("unsatisfiedConditions is null");
- this.serviceName = serviceName;
- this.unsatisfiedConditions = Collections.unmodifiableSet(unsatisfiedConditions);
- }
-
- /**
- * Gets the name of the service that has unsatisfied conditions.
- *
- * @return the service name
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-
- /**
- * Gets the conditions that were unsatified when the exception was thrown.
- *
- * @return the unsatified conditions that were ignored
- */
- public Set getUnsatisfiedConditions() {
- return unsatisfiedConditions;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/package.html b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/package.html
deleted file mode 100644
index 67d6b6c..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body>
-Defines the kernel interface for managing services and interfaces the kernel uses to interact with the services.
-</body>
-<html>
\ No newline at end of file
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/AggregateCondition.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/AggregateCondition.java
deleted file mode 100644
index a697890..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/AggregateCondition.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import edu.emory.mathcs.backport.java.util.concurrent.locks.Condition;
-import edu.emory.mathcs.backport.java.util.concurrent.locks.Lock;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.ServiceCondition;
-import org.apache.xbean.kernel.ServiceName;
-
-/**
- * Aggregates a set of ServiceConditions together so the ServiceManager can treat them as a single unit.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class AggregateCondition {
- private final Kernel kernel;
- private final ServiceName serviceName;
- private final ClassLoader classLoader;
- private final Lock lock;
- private final Map conditions = new HashMap();
- private final Condition satisfiedSignal;
- private boolean destroyed = false;
-
- /**
- * Creates an aggregate condition.
- *
- * @param kernel the kernel in which the service is registered
- * @param serviceName the name of the service
- * @param classLoader the class loader for the service
- * @param lock the lock for the service manager
- * @param conditions the conditions
- */
- public AggregateCondition(Kernel kernel, ServiceName serviceName, ClassLoader classLoader, Lock lock, Set conditions) {
- this.kernel = kernel;
- this.serviceName = serviceName;
- this.classLoader = classLoader;
- this.lock = lock;
- satisfiedSignal = lock.newCondition();
-
- // add the conditions to the registry
- if (conditions == null) throw new NullPointerException("conditions is null");
- for (Iterator iterator = conditions.iterator(); iterator.hasNext();) {
- ServiceCondition serviceCondition = (ServiceCondition) iterator.next();
- addCondition(serviceCondition);
- }
- }
-
- /**
- * Gets a snapshot of the current conditions.
- *
- * @return a snapshot of the current conditions
- */
- protected Set getConditions() {
- return new HashSet(conditions.keySet());
- }
-
- /**
- * Adds a new condition if not already registered.
- *
- * @param condition the new condition
- */
- protected final void addCondition(ServiceCondition condition) {
- if (!conditions.containsKey(condition)) {
- StandardServiceConditionContext context = new StandardServiceConditionContext(kernel, serviceName, classLoader, lock, satisfiedSignal);
- condition.initialize(context);
- conditions.put(condition, context);
- }
- }
-
- /**
- * Removes a condition from the registry if present.
- *
- * @param condition the condition to remove
- */
- protected final void removeCondition(ServiceCondition condition) {
- if (conditions.remove(condition) != null) {
- condition.destroy();
- }
- }
-
- /**
- * Initializes the conditions.
- */
- public void initialize() {
- if (destroyed) throw new IllegalStateException("destroyed");
-
- for (Iterator iterator = conditions.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- ServiceCondition condition = (ServiceCondition) entry.getKey();
- StandardServiceConditionContext context = (StandardServiceConditionContext) entry.getValue();
- condition.initialize(context);
- }
- }
-
- /**
- * Gets the unsatisfied conditions.
- *
- * @return the unstatisfied conditions
- */
- public Set getUnsatisfied() {
- if (destroyed) throw new IllegalStateException("destroyed");
-
- Set unsatisfied = new HashSet();
- for (Iterator iterator = conditions.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- ServiceCondition condition = (ServiceCondition) entry.getKey();
- StandardServiceConditionContext context = (StandardServiceConditionContext) entry.getValue();
- if (!context.isSatisfied()) {
- if (condition.isSatisfied()) {
- // the condition is satisfied
- // record this fact in the context
- context.setSatisfied();
- } else {
- unsatisfied.add(condition);
- }
- }
- }
-
- // notify anyone awaiting satisfaction
- if (unsatisfied.isEmpty()) {
- satisfiedSignal.signalAll();
- }
- return unsatisfied;
- }
-
- /**
- * Gets the destroyed status.
- *
- * @return true if this AggregateCondition been destroyed; false otherwise
- */
- public boolean isDestroyed() {
- return destroyed;
- }
-
- /**
- * Destroys all condtions.
- *
- * @return a list of the Exceptions or Errors that occured while destroying the conditon objects.
- */
- public List destroy() {
- List stopErrors = new ArrayList();
- if (!destroyed) {
- destroyed = true;
- for (Iterator iterator = conditions.keySet().iterator(); iterator.hasNext();) {
- ServiceCondition condition = (ServiceCondition) iterator.next();
- try {
- condition.destroy();
- } catch (RuntimeException stopError) {
- stopErrors.add(stopError);
- } catch (Error stopError) {
- stopErrors.add(stopError);
- }
- }
- // notify anyone awaiting satisfaction
- satisfiedSignal.signalAll();
- }
- return stopErrors;
- }
-
- /**
- * Causes the current thread to wait until the conditons is satisfied.
- *
- * @throws InterruptedException if the thread is interrupted
- */
- public void awaitSatisfaction() throws InterruptedException {
- while (!destroyed) {
- if (getUnsatisfied().isEmpty()) {
- return;
- }
- satisfiedSignal.await();
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/AsyncServiceMonitor.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/AsyncServiceMonitor.java
deleted file mode 100644
index 6727536..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/AsyncServiceMonitor.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import edu.emory.mathcs.backport.java.util.concurrent.Executor;
-import org.apache.xbean.kernel.ServiceEvent;
-import org.apache.xbean.kernel.ServiceMonitor;
-
-/**
- * The AsyncServiceMonitor delivers service events to a delegate ServiceMonitor asynchronously using an executor.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class AsyncServiceMonitor implements ServiceMonitor {
- private final ServiceMonitor delegate;
- private final Executor executor;
-
- /**
- * Creates a AsyncServiceMonitor which asynchronously delivers service events to specified delegate
- * ServiceMonitor using the specified executor.
- *
- * @param delegate the service monitor that should recieve the asynchronous events
- * @param executor the executor used to asynchronously deliver the events
- */
- public AsyncServiceMonitor(ServiceMonitor delegate, Executor executor) {
- this.delegate = delegate;
- this.executor = executor;
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceRegistered(final ServiceEvent serviceEvent) {
- executor.execute(new Runnable() {
- public void run() {
- delegate.serviceRegistered(serviceEvent);
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStarting(final ServiceEvent serviceEvent) {
- executor.execute(new Runnable() {
- public void run() {
- delegate.serviceStarting(serviceEvent);
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceWaitingToStart(final ServiceEvent serviceEvent) {
- executor.execute(new Runnable() {
- public void run() {
- delegate.serviceWaitingToStart(serviceEvent);
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStartError(final ServiceEvent serviceEvent) {
- executor.execute(new Runnable() {
- public void run() {
- delegate.serviceStartError(serviceEvent);
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceRunning(final ServiceEvent serviceEvent) {
- executor.execute(new Runnable() {
- public void run() {
- delegate.serviceRunning(serviceEvent);
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStopping(final ServiceEvent serviceEvent) {
- executor.execute(new Runnable() {
- public void run() {
- delegate.serviceStopping(serviceEvent);
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceWaitingToStop(final ServiceEvent serviceEvent) {
- executor.execute(new Runnable() {
- public void run() {
- delegate.serviceWaitingToStop(serviceEvent);
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStopError(final ServiceEvent serviceEvent) {
- executor.execute(new Runnable() {
- public void run() {
- delegate.serviceStopError(serviceEvent);
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStopped(final ServiceEvent serviceEvent) {
- executor.execute(new Runnable() {
- public void run() {
- delegate.serviceStopped(serviceEvent);
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceUnregistered(final ServiceEvent serviceEvent) {
- executor.execute(new Runnable() {
- public void run() {
- delegate.serviceUnregistered(serviceEvent);
- }
- });
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/KernelMonitorBroadcaster.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/KernelMonitorBroadcaster.java
deleted file mode 100644
index b6157bb..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/KernelMonitorBroadcaster.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList;
-import org.apache.xbean.kernel.KernelMonitor;
-import org.apache.xbean.kernel.ServiceMonitor;
-import org.apache.xbean.kernel.ServiceEvent;
-import org.apache.xbean.kernel.KernelErrorsError;
-
-/**
- * The KernelMonitorBroadcaster broadcasts kernel events to registered kernel monitors.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class KernelMonitorBroadcaster implements KernelMonitor {
- /**
- * The monitors of kernel events.
- */
- private final CopyOnWriteArrayList kernelMonitors = new CopyOnWriteArrayList();
-
- /**
- * Adds a kernel monitor.
- *
- * @param kernelMonitor the kernel monitor to add
- */
- public void addKernelMonitor(KernelMonitor kernelMonitor) {
- kernelMonitors.addIfAbsent(kernelMonitor);
- }
-
- /**
- * Removes a kernel monitor.
- *
- * @param kernelMonitor the kernel monitor to remove
- */
- public void removeKernelMonitor(KernelMonitor kernelMonitor) {
- kernelMonitors.remove(kernelMonitor);
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceNotificationError(ServiceMonitor serviceMonitor, ServiceEvent serviceEvent, Throwable throwable) {
- List errors = new ArrayList();
- for (Iterator iterator = kernelMonitors.iterator(); iterator.hasNext();) {
- KernelMonitor kernelMonitor = (KernelMonitor) iterator.next();
- try {
- kernelMonitor.serviceNotificationError(serviceMonitor, serviceEvent, throwable);
- } catch (RuntimeException ignored) {
- // ignore - we did our best to notify the world
- } catch (Error e) {
- errors.add(e);
- }
- }
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/NonRestartableStopCondition.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/NonRestartableStopCondition.java
deleted file mode 100644
index 1175e98..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/NonRestartableStopCondition.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Set;
-
-import edu.emory.mathcs.backport.java.util.concurrent.locks.Lock;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.ServiceCondition;
-import org.apache.xbean.kernel.ServiceFactory;
-import org.apache.xbean.kernel.ServiceName;
-
-/**
- * A special sub-class of AggregateCondition used to manage the stop conditions of a non-restartable service. This class
- * will update stop conditions to reflect the stop conditions currently registered with the service factory, when the
- * initialized or getUnsatisfied methods are called.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class NonRestartableStopCondition extends AggregateCondition {
- private final ServiceFactory serviceFactory;
-
- /**
- * Creates a NonRestartableStopCondition.
- *
- * @param kernel the kernel in which the service is registered
- * @param serviceName the name of the service
- * @param classLoader the class loader for the service
- * @param lock the lock for the service manager
- * @param serviceFactory the service factory for the service
- */
- public NonRestartableStopCondition(Kernel kernel, ServiceName serviceName, ClassLoader classLoader, Lock lock, ServiceFactory serviceFactory) {
- super(kernel, serviceName, classLoader, lock, Collections.EMPTY_SET);
- this.serviceFactory = serviceFactory;
- }
-
- /**
- * Throws UnsupportedOperationException. Initialize is not a valid operation for a NonRestartableStopCondition
- *
- * @throws UnsupportedOperationException always
- */
- public synchronized void initialize() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("initialize should never be called on a NonRestartableStopCondition");
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized Set getUnsatisfied() {
- updateConditions();
- return super.getUnsatisfied();
- }
-
- private void updateConditions() {
- if (isDestroyed()) throw new IllegalStateException("destroyed");
-
- Set conditions = getConditions();
-
- // add the new conditions
- Set stopConditions = serviceFactory.getStopConditions();
- for (Iterator iterator = stopConditions.iterator(); iterator.hasNext();) {
- ServiceCondition condition = (ServiceCondition) iterator.next();
- if (!conditions.contains(condition)) {
- addCondition(condition);
- }
- }
-
- // remove the conditions that were dropped
- for (Iterator iterator = conditions.iterator(); iterator.hasNext();) {
- ServiceCondition serviceCondition = (ServiceCondition) iterator.next();
- if (!stopConditions.contains(serviceCondition)) {
- removeCondition(serviceCondition);
- }
- }
- }
-
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/RegistryFutureTask.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/RegistryFutureTask.java
deleted file mode 100644
index 7f1cc1f..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/RegistryFutureTask.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import edu.emory.mathcs.backport.java.util.concurrent.Callable;
-import edu.emory.mathcs.backport.java.util.concurrent.FutureTask;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.StopStrategy;
-
-/**
- * RegistryFutureTask preforms service registration and unregistration in a FutureTask.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-class RegistryFutureTask extends FutureTask implements Comparable {
- private final long serviceId;
- private final ServiceName serviceName;
- private final String taskType;
- private Throwable throwable;
-
- static RegistryFutureTask createRegisterTask(ServiceManager serviceManager) {
- RegisterCallable registerCallable = new RegisterCallable(serviceManager);
- RegistryFutureTask registryFutureTask = new RegistryFutureTask(serviceManager.getServiceId(),
- serviceManager.getServiceName(),
- "RegisterServiceManager",
- registerCallable);
- return registryFutureTask;
- }
-
- static RegistryFutureTask createUnregisterTask(ServiceManager serviceManager, StopStrategy stopStrategy) {
- UnregisterCallable unregisterCallable = new UnregisterCallable(serviceManager, stopStrategy);
- RegistryFutureTask registryFutureTask = new RegistryFutureTask(serviceManager.getServiceId(),
- serviceManager.getServiceName(),
- "UnregisterServiceManager",
- unregisterCallable);
- unregisterCallable.setRegistryFutureTask(registryFutureTask);
- return registryFutureTask;
- }
-
- private RegistryFutureTask(long serviceId, ServiceName serviceName, String taskType, Callable callable) {
- super(callable);
- this.serviceId = serviceId;
- this.serviceName = serviceName;
- this.taskType = taskType;
- }
-
- public ServiceName getServiceName() {
- return serviceName;
- }
-
- public synchronized Throwable getThrowable() {
- return throwable;
- }
-
- private synchronized void setThrowable(Throwable throwable) {
- this.throwable = throwable;
- }
-
- public int hashCode() {
- return (int) (serviceId ^ (serviceId >>> 32));
- }
-
- public boolean equals(Object o) {
- if (o instanceof RegistryFutureTask) {
- return serviceId == ((RegistryFutureTask) o).serviceId;
- }
- return false;
- }
-
- public int compareTo(Object o) {
- RegistryFutureTask registryFutureTask = (RegistryFutureTask) o;
-
- if (serviceId < registryFutureTask.serviceId) {
- return -1;
- } else if (serviceId > registryFutureTask.serviceId) {
- return 1;
- } else {
- return 0;
- }
- }
-
- public String toString() {
- return "[RegistryFutureTask: task=" + taskType + ", serviceName=" + serviceName + "]";
- }
-
-
- private static class RegisterCallable implements Callable {
- private final ServiceManager serviceManager;
-
- private RegisterCallable(ServiceManager serviceManager) {
- this.serviceManager = serviceManager;
- }
-
- public Object call() throws Exception {
- serviceManager.initialize();
- return serviceManager;
- }
- }
-
- private static class UnregisterCallable implements Callable {
- private final ServiceManager serviceManager;
- private final StopStrategy stopStrategy;
- private RegistryFutureTask registryFutureTask;
-
- private UnregisterCallable(ServiceManager serviceManager, StopStrategy stopStrategy) {
- this.serviceManager = serviceManager;
- this.stopStrategy = stopStrategy;
- }
-
- public void setRegistryFutureTask(RegistryFutureTask registryFutureTask) {
- this.registryFutureTask = registryFutureTask;
- }
-
- public Object call() {
- try {
- serviceManager.destroy(stopStrategy);
- return null;
- } catch (Throwable e) {
- // Destroy failed, save the exception so it can be rethrown from the unregister method
- registryFutureTask.setThrowable(e);
-
- // return the service manager so the service remains registered
- return serviceManager;
- }
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceManager.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceManager.java
deleted file mode 100644
index 875d2e5..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceManager.java
+++ /dev/null
@@ -1,734 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.Collections;
-
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
-import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong;
-import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock;
-import org.apache.xbean.kernel.ForcedStopException;
-import org.apache.xbean.kernel.IllegalServiceStateException;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.KernelOperationInterruptedException;
-import org.apache.xbean.kernel.KernelOperationTimoutException;
-import org.apache.xbean.kernel.ServiceCondition;
-import org.apache.xbean.kernel.ServiceEvent;
-import org.apache.xbean.kernel.ServiceFactory;
-import org.apache.xbean.kernel.ServiceMonitor;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.ServiceNotFoundException;
-import org.apache.xbean.kernel.ServiceState;
-import org.apache.xbean.kernel.StartStrategies;
-import org.apache.xbean.kernel.StartStrategy;
-import org.apache.xbean.kernel.StopStrategy;
-import org.apache.xbean.kernel.UnregisterServiceException;
-import org.apache.xbean.kernel.UnsatisfiedConditionsException;
-import org.apache.xbean.kernel.InvalidServiceTypeException;
-
-/**
- * The ServiceManager handles the life cycle of a single service. The manager is responsible for gaurenteeing that
- * all start conditions have been satisfied before the service is constructed, and that all stop conditions have been
- * satisfied before the service is destroyed. The ServiceManager can be started and stopped several times, but once
- * destroyed no methods may be called.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceManager implements Comparable {
- /**
- * The kernel in which this service is registered.
- */
- private final Kernel kernel;
-
- /**
- * The unique id of this service in the kernel.
- */
- private final long serviceId;
-
- /**
- * The unique name of this service in the kernel.
- */
- private final ServiceName serviceName;
-
- /**
- * The factory used to create and destroy the service instance.
- */
- private final ServiceFactory serviceFactory;
-
- /**
- * The type of service this service manager will create. This value is cached from the serviceFactory.getT
- */
- private final Set serviceTypes;
-
- /**
- * The class loader for this service.
- */
- private final ClassLoader classLoader;
-
- /**
- * The monitor to which we fire service events. The ServiceManager requires an asynchronous monitor becuse events are
- * fired from within the lock. This helps to reduce complexity but will cause more services to sit in the
- * {@link ServiceState#STARTING} and {@link ServiceState#STOPPING} states since events are propagated in a separate
- * thread.
- */
- private final ServiceMonitor serviceMonitor;
-
- /**
- * The service context given to the service factory. This contans a reference to the kernel, serviceName and
- * classloader.
- */
- private final StandardServiceContext standardServiceContext;
-
- /**
- * Current state of this service.
- */
- private volatile ServiceState state = ServiceState.STOPPED;
-
- /**
- * The time the service was started or 0 if not started.
- */
- private volatile long startTime;
-
- /**
- * The {@link ServiceCondition) objects required to be ready before this service can be completely started.
- */
- private AggregateCondition startCondition;
-
- /**
- * The {@link ServiceCondition) objects required to be ready before this service can be completely stopped.
- */
- private AggregateCondition stopCondition;
-
- /**
- * The service instance.
- */
- private volatile Object service;
-
- /**
- * The single lock we use.
- */
- private final ReentrantLock lock = new ReentrantLock();
-
- /**
- * The maximum duration to wait for the lock.
- */
- private final long timeoutDuration;
-
- /**
- * The unit of measure for the {@link #timeoutDuration}.
- */
- private final TimeUnit timeoutUnits;
-
- /**
- * The name of the operation for which the lock is held; this is used in the reentrant exception message.
- */
- private String currentLockHolderOperation = "NOT-HELD";
-
- /**
- * Sequence number for service event objects.
- */
- private final AtomicLong eventId = new AtomicLong(0);
-
- /**
- * If true, when start is successful we will startRecusrive all of the services owned by this service.
- */
- private boolean recursive = false;
-
- /**
- * Creates a service manager for a single service.
- *
- * @param kernel the kernel in which this wraper will be registered
- * @param serviceId the unique id of this service in the kernel
- * @param serviceName the unique name of this service in the kernel
- * @param serviceFactory the factory used to create and destroy the service instance
- * @param classLoader the class loader for this service
- * @param serviceMonitor the monitor of service events
- * @param timeoutDuration the maximum duration to wait for a lock
- * @param timeoutUnits the unit of measure for the timeoutDuration
- */
- public ServiceManager(Kernel kernel,
- long serviceId,
- ServiceName serviceName,
- ServiceFactory serviceFactory,
- ClassLoader classLoader,
- ServiceMonitor serviceMonitor,
- long timeoutDuration,
- TimeUnit timeoutUnits) {
-
- this.kernel = kernel;
- this.serviceId = serviceId;
- this.serviceName = serviceName;
- this.serviceFactory = serviceFactory;
- this.classLoader = classLoader;
- this.serviceMonitor = serviceMonitor;
- this.timeoutDuration = timeoutDuration;
- this.timeoutUnits = timeoutUnits;
- standardServiceContext = new StandardServiceContext(kernel, serviceName, classLoader);
- serviceTypes = Collections.unmodifiableSet(new LinkedHashSet(Arrays.asList(serviceFactory.getTypes())));
- }
-
- /**
- * Initializes the service.
- *
- * @throws IllegalServiceStateException if the service is not restartable and is disabled
- * @throws UnsatisfiedConditionsException if the service is not restartable and there were unsatisfied start conditions
- * @throws Exception if the service is not restartable and service construction threw an exception
- * @see Kernel#registerService(ServiceName, ServiceFactory, ClassLoader)
- */
- public void initialize() throws IllegalServiceStateException, UnsatisfiedConditionsException, Exception {
- if (!serviceFactory.isRestartable() && !serviceFactory.isEnabled()) {
- throw new IllegalServiceStateException("A disabled non-restartable service factory can not be initalized", serviceName);
- }
-
- serviceMonitor.serviceRegistered(createServiceEvent());
-
- // if we are not restartable, we need to start immediately, otherwise we are not going to register this service
- if (!serviceFactory.isRestartable()) {
- try {
- start(false, StartStrategies.UNREGISTER);
- } catch (UnregisterServiceException e) {
- serviceMonitor.serviceUnregistered(createServiceEvent());
- Throwable cause = e.getCause();
- if (cause instanceof Exception) {
- throw (Exception) cause;
- } else if (cause instanceof Error) {
- throw (Error) cause;
- } else {
- throw new AssertionError(cause);
- }
- }
-
- // a non restartable service uses a special stop conditions object that picks up stop conditions as they
- // are added. When the stop() method is called on a non-restartable service all of the stop conditions
- // registered with the service factory are initialized (if not already initialized), and the isSatisfied
- // method is called. This should cause the stop logic of a stop condition to fire.
- lock("initialize");
- try {
- stopCondition = new NonRestartableStopCondition(kernel, serviceName, classLoader, lock, serviceFactory);
- } finally {
- unlock();
- }
- }
- }
-
- /**
- * Attempts to stop and destroy the service.
- *
- * @param stopStrategy the strategy used to determine how to handle unsatisfied stop conditions
- * @throws IllegalServiceStateException is the service did not stop
- * @throws UnsatisfiedConditionsException if there were unsatisfied stop conditions
- * @see Kernel#unregisterService(ServiceName, StopStrategy)
- */
- public void destroy(StopStrategy stopStrategy) throws IllegalServiceStateException, UnsatisfiedConditionsException {
- // if we are not restartable, we need to stop
- try {
- if (!stop(stopStrategy)) {
- throw new IllegalServiceStateException("Service did not stop", serviceName);
- }
- } catch (UnsatisfiedConditionsException e) {
- throw e;
- }
-
- if (!serviceFactory.isRestartable()) {
- lock("destroy");
- try {
- if (state != ServiceState.STOPPED) {
- state = ServiceState.STARTING;
- serviceMonitor.serviceStopping(createServiceEvent());
- if (service != null) {
- try {
- // destroy the service
- serviceFactory.destroyService(standardServiceContext);
- } catch (Throwable e) {
- serviceMonitor.serviceStopError(createErrorServiceEvent(e));
- }
- }
-
- destroyAllConditions(serviceMonitor);
-
- service = null;
- startTime = 0;
- state = ServiceState.STOPPED;
- serviceMonitor.serviceStopped(createServiceEvent());
- }
- } finally {
- unlock();
- }
- }
-
- // cool we can unregistered
- serviceMonitor.serviceUnregistered(createServiceEvent());
- }
-
- /**
- * Gets the unique id of this service in the kernel.
- *
- * @return the unique id of this service in the kernel
- */
- public long getServiceId() {
- return serviceId;
- }
-
- /**
- * Gets the unique name of this service in the kernel.
- *
- * @return the unique name of this servce in the kernel
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-
- /**
- * Gets the types of the service that will be managed by this service manager.
- * @return the types of the service
- */
- public Set getServiceTypes() {
- return serviceTypes;
- }
-
- /**
- * Gets the factory used to create and destroy the service instance.
- *
- * @return the factory for the service instance
- * @see Kernel#getServiceFactory(ServiceName)
- */
- public ServiceFactory getServiceFactory() {
- return serviceFactory;
- }
-
- /**
- * Gets the class loader for this service. This class loader is provided to the service factory in the
- * ServiceContext object.
- *
- * @return the classloader for this service
- * @see Kernel#getClassLoaderFor(ServiceName)
- */
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-
- /**
- * Gets the service instance.
- *
- * @return the service instance
- * @see Kernel#getService(ServiceName)
- */
- public Object getService() {
- return service;
- }
-
- /**
- * Gets the current state of this service.
- *
- * @return the current state of this service
- * @see Kernel#getServiceState(ServiceName)
- */
- public ServiceState getState() {
- return state;
- }
-
- /**
- * Gets the time at which this service entered the STARTING state or 0 if the service is STOPPED.
- *
- * @return the start time or 0 if the service is stopped
- * @see Kernel#getServiceStartTime(ServiceName)
- */
- public long getStartTime() {
- return startTime;
- }
-
- /**
- * Attempts to starts the service.
- *
- * @param recursive if start is successful should we start recursive the services owned by this servic
- * @param startStrategy the strategy used to determine how to handle unsatisfied start conditions and start errors
- * @throws IllegalServiceStateException if the service is in a state in which it can not be started
- * @throws UnregisterServiceException if the kernel should unregister this service
- * @throws UnsatisfiedConditionsException if there were unsatisfied start conditions
- * @throws Exception it service creation threw an exception
- * @see Kernel#startService(ServiceName)
- * @see Kernel#startServiceRecursive(ServiceName)
- */
- public void start(boolean recursive, StartStrategy startStrategy) throws IllegalServiceStateException, UnregisterServiceException, UnsatisfiedConditionsException, Exception {
- // verify that it is possible to start this service in the current state before obtaining the lock
- if (!verifyStartable(state)) {
- if (recursive) {
- startOwnedServices(startStrategy);
- }
- return;
- }
-
- boolean shouldStartRecursive = false;
- lock("start");
- try {
- // update the recursive flag
- this.recursive = this.recursive || recursive;
-
- Throwable startError = null;
- try {
- //
- // Loop until all start conditions have been satified. The start strategy can break this loop.
- //
- boolean satisfied = false;
- while (!satisfied) {
- // do we still want to start?
- if (!verifyStartable(state)) {
- // assume someone else called startOwnedServices
- return;
- }
-
- // if we are in the STOPPED state, we need to move to the STARTING state
- if (state == ServiceState.STOPPED) {
- // we are now officially starting
- state = ServiceState.STARTING;
- serviceMonitor.serviceStarting(createServiceEvent());
-
- // initialize the start conditions
- startCondition = new AggregateCondition(kernel, serviceName, classLoader, lock, serviceFactory.getStartConditions());
- startCondition.initialize();
- }
-
- // are we satisfied?
- Set unsatisfiedConditions = startCondition.getUnsatisfied();
- satisfied = unsatisfiedConditions.isEmpty();
- if (!satisfied) {
- // if the stragegy wants us to wait for conditions to be satisfied, it will return true
- if (startStrategy.waitForUnsatisfiedConditions(serviceName, unsatisfiedConditions)) {
- // wait for satisfaction and loop
- startCondition.awaitSatisfaction();
- } else {
- // no wait, notify the monitor and exit
- serviceMonitor.serviceWaitingToStart(createWaitingServiceEvent(unsatisfiedConditions));
- return;
- }
- }
- }
-
- // we are ready to create the service
- service = serviceFactory.createService(standardServiceContext);
-
- // verify that the service implements all of the types
- if (service == null) {
- throw new NullPointerException("Service factory return null from createService for service " + serviceName);
- }
- for (Iterator iterator = serviceTypes.iterator(); iterator.hasNext();) {
- Class type = (Class) iterator.next();
- if (!type.isInstance(service)) {
- throw new InvalidServiceTypeException(serviceName, type, service.getClass());
- }
- }
-
- // success transition to running
- startTime = System.currentTimeMillis();
- state = ServiceState.RUNNING;
- serviceMonitor.serviceRunning(createServiceEvent());
-
- // should we recursively start our children
- shouldStartRecursive = this.recursive || recursive;
- this.recursive = false;
- } catch (UnsatisfiedConditionsException e) {
- // thrown from waitForUnsatisfiedConditions
- throw e;
- } catch (IllegalServiceStateException e) {
- // this can be thrown while awaiting satisfaction
- throw e;
- } catch (Exception e) {
- startError = e;
- } catch (Error e) {
- startError = e;
- }
-
- if (startError != null) {
- try {
- if (startError instanceof UnregisterServiceException) {
- throw (UnregisterServiceException) startError;
- } else {
- // the strategy will normally rethrow the startError, but if it doesn't notify the service monitor
- startStrategy.startError(serviceName, startError);
- serviceMonitor.serviceStartError(createErrorServiceEvent(startError));
- }
- } finally {
- // we are now STOPPING
- state = ServiceState.STOPPING;
- serviceMonitor.serviceStopping(createServiceEvent());
-
- // clean up the conditons
- destroyAllConditions(serviceMonitor);
-
- // transition to the STOPPED state
- service = null;
- startTime = 0;
- state = ServiceState.STOPPED;
- serviceMonitor.serviceStopped(createServiceEvent());
- }
- }
- } finally {
- unlock();
- }
-
-
- // startRecursive all of the owned services
- if (shouldStartRecursive) {
- startOwnedServices(startStrategy);
- }
- }
-
- private void startOwnedServices(StartStrategy startStrategy) throws IllegalServiceStateException, UnsatisfiedConditionsException, Exception {
- Set ownedServices = serviceFactory.getOwnedServices();
- if (ownedServices == null) throw new NullPointerException("serviceFactory.getOwnedServices() returned null");
- for (Iterator iterator = ownedServices.iterator(); iterator.hasNext();) {
- ServiceName ownedService = (ServiceName) iterator.next();
- try {
- kernel.startServiceRecursive(ownedService, startStrategy);
- } catch (ServiceNotFoundException ignored) {
- // this is ok -- service unregistered
- } catch (IllegalServiceStateException ignored) {
- // ownedService is disabled or stopping -- anyway we don't care
- }
- }
- }
-
- /**
- * Verifies that the service is startable. This can be used out side a lock to avoid unecessary locking.
- *
- * @param state the state of the service
- * @return true if it is possible to start a service in the specifiec state
- * @throws IllegalServiceStateException if it is illegal to start a service in the specified state
- */
- private boolean verifyStartable(ServiceState state) throws IllegalServiceStateException {
- // if we are alredy in the running state, there is nothing to do
- if (state == ServiceState.RUNNING) {
- return false;
- }
-
- // if we are in the stopping states, that is an error
- if (state == ServiceState.STOPPING) {
- throw new IllegalServiceStateException("A stopping service can not be started", serviceName);
- }
-
- // is this service enabled?
- if (state == ServiceState.STOPPED && !serviceFactory.isEnabled()) {
- throw new IllegalServiceStateException("Service is disabled", serviceName);
- }
-
- return true;
- }
-
- /**
- * Attempts to stop the service.
- *
- * @param stopStrategy the strategy used to determine how to handle unsatisfied stop conditions
- * @return true if the service was sucessfully stopped; false otherwise
- * @throws UnsatisfiedConditionsException if there were unsatisfied stop conditions
- * @see Kernel#stopService(ServiceName)
- */
- public boolean stop(StopStrategy stopStrategy) throws UnsatisfiedConditionsException {
- // check that we aren't already stopped before attempting to acquire the lock
- ServiceState initialState = state;
- if (initialState == ServiceState.STOPPED) {
- return true;
- }
-
- lock("stop");
- try {
- try {
- //
- // Loop until all stop conditions have been satified. The stop strategy can break this loop.
- //
- boolean satisfied = false;
- while (!satisfied) {
- // do we still want to stop?
- if (state == ServiceState.STOPPED) {
- return true;
- }
-
- // if we are not the STOPPING state, transition to it
- // we check on the stopConditions variable because non-restartable services preset this in the
- // intialization method
- if (stopCondition == null) {
- // we are not officially stopping
- serviceMonitor.serviceStopping(createServiceEvent());
- state = ServiceState.STOPPING;
-
- // initialize all of the stop conditions
- stopCondition = new AggregateCondition(kernel, serviceName, classLoader, lock, serviceFactory.getStopConditions());
- stopCondition.initialize();
- }
-
- // are we satisfied?
- Set unsatisfiedConditions = stopCondition.getUnsatisfied();
- satisfied = unsatisfiedConditions.isEmpty();
- if (!satisfied) {
- // if the stragegy wants us to wait for conditions to be satisfied, it will return true
- if (stopStrategy.waitForUnsatisfiedConditions(serviceName, unsatisfiedConditions)) {
- // wait for satisfaction and loop
- stopCondition.awaitSatisfaction();
- } else {
- // no wait, notify the monitor and exit
- serviceMonitor.serviceWaitingToStop(createWaitingServiceEvent(unsatisfiedConditions));
- return false;
- }
- }
- }
- } catch (UnsatisfiedConditionsException e) {
- throw e;
- } catch (ForcedStopException e) {
- serviceMonitor.serviceStopError(createErrorServiceEvent(e));
- } catch (Exception e) {
- serviceMonitor.serviceStopError(createErrorServiceEvent(e));
- } catch (Error e) {
- serviceMonitor.serviceStopError(createErrorServiceEvent(e));
- }
-
- if (serviceFactory.isRestartable()) {
- if (service != null) {
- try {
- // destroy the service
- serviceFactory.destroyService(standardServiceContext);
- } catch (Throwable e) {
- serviceMonitor.serviceStopError(createErrorServiceEvent(e));
- }
- }
-
- destroyAllConditions(serviceMonitor);
-
- service = null;
- startTime = 0;
- state = ServiceState.STOPPED;
- serviceMonitor.serviceStopped(createServiceEvent());
- }
- return true;
- } finally {
- unlock();
- }
- }
-
- private void destroyAllConditions(ServiceMonitor monitor) {
- if (!lock.isHeldByCurrentThread()) {
- throw new IllegalStateException("Current thread must hold lock before calling destroyAllConditions");
- }
-
- if (startCondition != null) {
- List errors = startCondition.destroy();
- // errors from destroying the start conditions are stop errors because destroy is only called while
- // stopping the service
- for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
- Throwable stopError = (Throwable) iterator.next();
- monitor.serviceStopError(createErrorServiceEvent(stopError));
- }
- startCondition = null;
- }
- if (stopCondition != null) {
- List errors = stopCondition.destroy();
- for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
- Throwable stopError = (Throwable) iterator.next();
- monitor.serviceStopError(createErrorServiceEvent(stopError));
- }
- stopCondition = null;
- }
- }
-
- /**
- * Obtain the lock for the specified operation.
- *
- * @param operationName name of the operation that lock will be used for - this is only used for exception messages
- * @throws IllegalStateException if thread tries to reenter while holding the lock
- * @throws KernelOperationTimoutException if lock could not be obtained in {@link #timeoutDuration} {@link #timeoutUnits}
- * @throws KernelOperationInterruptedException if the thread was interrupted while waiting for the lock
- */
- private void lock(String operationName) throws IllegalStateException, KernelOperationTimoutException, KernelOperationInterruptedException {
- if (lock.isHeldByCurrentThread()) {
- throw new IllegalStateException("Current thread holds lock for " + currentLockHolderOperation +
- " and lock can not be reacquired for " + operationName + " on " + serviceName);
- }
-
- try {
- if (!lock.tryLock(timeoutDuration, timeoutUnits)) {
- throw new KernelOperationTimoutException("Could not obtain lock for " + operationName + " operation on " +
- serviceName + " within " + timeoutDuration + " " + timeoutUnits.toString().toLowerCase(),
- serviceName,
- operationName);
- }
- currentLockHolderOperation = operationName;
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException("Interrupted while attempting to obtain lock for " + operationName +
- " operation on " + serviceName,
- e,
- serviceName,
- operationName);
-
- }
- }
-
- /**
- * Unlock the lock and clear the currentLockHolderOperation name.
- */
- private void unlock() {
- if (!lock.isHeldByCurrentThread()) {
- throw new IllegalMonitorStateException("Not owner");
- }
-
- currentLockHolderOperation = "NOT-HELD";
- lock.unlock();
- }
-
- private ServiceEvent createServiceEvent() {
- return new ServiceEvent(eventId.getAndIncrement(), kernel, serviceName, serviceFactory, classLoader, service, null, null);
- }
-
- private ServiceEvent createWaitingServiceEvent(Set unsatisfiedConditions) {
- return new ServiceEvent(eventId.getAndIncrement(), kernel, serviceName, serviceFactory, classLoader, service, null, unsatisfiedConditions);
- }
-
- private ServiceEvent createErrorServiceEvent(Throwable cause) {
- return new ServiceEvent(eventId.getAndIncrement(), kernel, serviceName, serviceFactory, classLoader, null, cause, null);
- }
-
- public int hashCode() {
- return (int) (serviceId ^ (serviceId >>> 32));
- }
-
- public boolean equals(Object o) {
- if (o instanceof ServiceManager) {
- return serviceId == ((ServiceManager)o).serviceId;
- }
- return false;
- }
-
- public int compareTo(Object o) {
- ServiceManager serviceManager = (ServiceManager) o;
-
- if (serviceId < serviceManager.serviceId) {
- return -1;
- } else if (serviceId > serviceManager.serviceId) {
- return 1;
- } else {
- return 0;
- }
- }
-
- public String toString() {
- return "[ServiceManager: serviceId=" + serviceId + ", serviceName=" + serviceName + ", state=" + state + "]";
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceManagerFactory.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceManagerFactory.java
deleted file mode 100644
index 80e7e46..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceManagerFactory.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import edu.emory.mathcs.backport.java.util.concurrent.Executor;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.ServiceFactory;
-import org.apache.xbean.kernel.ServiceName;
-
-/**
- * The ServiceManagerFactory handles the construction ServiceManagers.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceManagerFactory {
- /**
- * The kernel in which the service will be bound.
- */
- private final Kernel kernel;
-
- /**
- * This monitor broadcasts events to the listeners registered for service.
- */
- private final ServiceMonitorBroadcaster serviceMonitor;
-
- /**
- * Events service events are sent asynchronously using this executor.
- */
- private final Executor serviceExecutor;
-
- /**
- * The maximum duration to wait for a service event to complete.
- */
- private final long timeoutDuration;
-
- /**
- * The unit of measure for the {@link #timeoutDuration}.
- */
- private final TimeUnit timeoutUnits;
-
- /**
- * Creates a ServiceManagerFactory.
- *
- * @param kernel the kernel in which the service will be registered
- * @param serviceMonitor the service monitor used for all services created by this factory
- * @param serviceExecutor the executor available to the service manager
- * @param timeoutDuration the maximum duration to wait for a service event to complete
- * @param timeoutUnits the unit of measure for the timeoutDuration
- */
- public ServiceManagerFactory(Kernel kernel, ServiceMonitorBroadcaster serviceMonitor, Executor serviceExecutor, long timeoutDuration, TimeUnit timeoutUnits) {
- this.kernel = kernel;
- this.serviceMonitor = serviceMonitor;
- this.serviceExecutor = serviceExecutor;
- this.timeoutDuration = timeoutDuration;
- this.timeoutUnits = timeoutUnits;
- }
-
- /**
- * Creates a ServiceManager.
- *
- * @param serviceId the id of the service
- * @param serviceName the name of the service
- * @param serviceFactory the factory for the service
- * @param classLoader the classloader for the service
- * @return a new service manager
- */
- public ServiceManager createServiceManager(long serviceId, ServiceName serviceName, ServiceFactory serviceFactory, ClassLoader classLoader) {
- return new ServiceManager(kernel,
- serviceId,
- serviceName,
- serviceFactory,
- classLoader,
- new AsyncServiceMonitor(serviceMonitor, serviceExecutor),
- timeoutDuration,
- timeoutUnits);
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceManagerRegistry.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceManagerRegistry.java
deleted file mode 100644
index 4c107aa..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceManagerRegistry.java
+++ /dev/null
@@ -1,592 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import edu.emory.mathcs.backport.java.util.concurrent.ExecutionException;
-import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong;
-import org.apache.xbean.kernel.IllegalServiceStateException;
-import org.apache.xbean.kernel.KernelErrorsError;
-import org.apache.xbean.kernel.KernelOperationInterruptedException;
-import org.apache.xbean.kernel.ServiceAlreadyExistsException;
-import org.apache.xbean.kernel.ServiceFactory;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.ServiceNotFoundException;
-import org.apache.xbean.kernel.ServiceRegistrationException;
-import org.apache.xbean.kernel.StopStrategies;
-import org.apache.xbean.kernel.StopStrategy;
-import org.apache.xbean.kernel.UnsatisfiedConditionsException;
-
-/**
- * The StandardServiceRegistry manages the registration of ServiceManagers for the kernel.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceManagerRegistry {
- /**
- * The sequence used for the serviceId assigned to service managers.
- */
- private final AtomicLong serviceId = new AtomicLong(1);
-
- /**
- * The factory used to create service managers.
- */
- private final ServiceManagerFactory serviceManagerFactory;
-
- /**
- * The registered service managers.
- */
- private final Map serviceManagers = new HashMap();
-
- /**
- * The service managers indexed by the service type. This map is populated when a service enters the running state.
- */
- private final Map serviceManagersByType = new HashMap();
-
- /**
- * Creates a ServiceManagerRegistry that uses the specified service manager factory to create new service managers.
- *
- * @param serviceManagerFactory the factory for new service managers
- */
- public ServiceManagerRegistry(ServiceManagerFactory serviceManagerFactory) {
- this.serviceManagerFactory = serviceManagerFactory;
- }
-
- /**
- * Stops and destroys all services service managers. This method will FORCE stop the services if necessary.
- *
- * @throws KernelErrorsError if any errors occur while stopping or destroying the service managers
- */
- public void destroy() throws KernelErrorsError {
- // we gather all errors that occur during shutdown and throw them as on huge exception
- List errors = new ArrayList();
-
- List managerFutures;
- synchronized (serviceManagers) {
- managerFutures = new ArrayList(serviceManagers.values());
- serviceManagers.clear();
-
- }
-
- List managers = new ArrayList(managerFutures.size());
- for (Iterator iterator = managerFutures.iterator(); iterator.hasNext();) {
- RegistryFutureTask registryFutureTask = (RegistryFutureTask) iterator.next();
- try {
- managers.add(registryFutureTask.get());
- } catch (InterruptedException e) {
- // ignore -- this should not happen
- errors.add(new AssertionError(e));
- } catch (ExecutionException e) {
- // good -- one less manager to deal with
- }
- }
-
- // Be nice and try to stop asynchronously
- errors.addAll(stopAll(managers, StopStrategies.ASYNCHRONOUS));
-
- // Be really nice and try to stop asynchronously again
- errors.addAll(stopAll(managers, StopStrategies.ASYNCHRONOUS));
-
- // We have been nice enough now nuke them
- errors.addAll(stopAll(managers, StopStrategies.FORCE));
-
- // All managers are gaurenteed to be destroyed now
- for (Iterator iterator = managers.iterator(); iterator.hasNext();) {
- ServiceManager serviceManager = (ServiceManager) iterator.next();
- try {
- serviceManager.destroy(StopStrategies.FORCE);
- } catch (UnsatisfiedConditionsException e) {
- // this should not happen, because we force stopped
- errors.add(new AssertionError(e));
- } catch (IllegalServiceStateException e) {
- // this should not happen, because we force stopped
- errors.add(new AssertionError(e));
- } catch (RuntimeException e) {
- errors.add(new AssertionError(e));
- } catch (Error e) {
- errors.add(new AssertionError(e));
- }
- }
-
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-
- private List stopAll(List managers, StopStrategy stopStrategy) {
- List errors = new ArrayList();
- for (Iterator iterator = managers.iterator(); iterator.hasNext();) {
- ServiceManager serviceManager = (ServiceManager) iterator.next();
- try {
- serviceManager.stop(stopStrategy);
- } catch (UnsatisfiedConditionsException e) {
- // this should not happen in with an asynchronous strategy
- errors.add(new AssertionError(e));
- } catch (RuntimeException e) {
- errors.add(new AssertionError(e));
- } catch (Error e) {
- errors.add(new AssertionError(e));
- }
- }
- return errors;
- }
-
- /**
- * Determines if there is a service registered under the specified name.
- *
- * @param serviceName the unique name of the service
- * @return true if there is a service registered with the specified name; false otherwise
- */
- public boolean isRegistered(ServiceName serviceName) {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
-
- RegistryFutureTask registryFutureTask;
- synchronized (serviceManagers) {
- registryFutureTask = (RegistryFutureTask) serviceManagers.get(serviceName);
- }
- try {
- // the service is registered if we have a non-null future value
- return registryFutureTask != null && registryFutureTask.get() != null;
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException(e, serviceName, "isRegistered");
- } catch (ExecutionException e) {
- return false;
- }
- }
-
- /**
- * Gets the service manager registered under the specified name.
- *
- * @param serviceName the unique name of the service
- * @return the ServiceManager
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- */
- public ServiceManager getServiceManager(ServiceName serviceName) throws ServiceNotFoundException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
-
- RegistryFutureTask registryFutureTask;
- synchronized (serviceManagers) {
- registryFutureTask = (RegistryFutureTask) serviceManagers.get(serviceName);
- }
-
- // this service has no future
- if (registryFutureTask == null) {
- throw new ServiceNotFoundException(serviceName);
- }
-
- try {
- ServiceManager serviceManager = (ServiceManager) registryFutureTask.get();
- if (serviceManager == null) {
- throw new ServiceNotFoundException(serviceName);
- }
- return serviceManager;
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException(e, serviceName, "getServiceManager");
- } catch (ExecutionException e) {
- // registration threw an exception which means it didn't register
- throw new ServiceNotFoundException(serviceName);
- }
- }
-
- /**
- * Gets the first registered service manager that creates an instance of the specified type, or null if no service
- * managers create an instance of the specified type.
- *
- * @param type the of the desired service
- * @return the first registered service manager that creates an instance of the specified type, or null if none found
- */
- public ServiceManager getServiceManager(Class type) {
- SortedSet serviceManagerFutures = getServiceManagerFutures(type);
- for (Iterator iterator = serviceManagerFutures.iterator(); iterator.hasNext();) {
- RegistryFutureTask registryFutureTask = (RegistryFutureTask) iterator.next();
- try {
- ServiceManager serviceManager = (ServiceManager) registryFutureTask.get();
- if (serviceManager != null) {
- return serviceManager;
- }
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException(e, registryFutureTask.getServiceName(), "getServiceManagers(java.lang.Class)");
- } catch (ExecutionException ignored) {
- // registration threw an exception which means it didn't register
- }
- }
- return null;
- }
-
- /**
- * Gets all service managers that create an instances of the specified type, or an empty list if no service
- * managers create an instance of the specified type.
- *
- * @param type the of the desired service managers
- * @return all service managers that create an instances of the specified type, or an empty list if none found
- */
- public List getServiceManagers(Class type) {
- SortedSet serviceManagerFutures = getServiceManagerFutures(type);
- List serviceManagers = new ArrayList(serviceManagerFutures.size());
- for (Iterator iterator = serviceManagerFutures.iterator(); iterator.hasNext();) {
- RegistryFutureTask registryFutureTask = (RegistryFutureTask) iterator.next();
- try {
- ServiceManager serviceManager = (ServiceManager) registryFutureTask.get();
- if (serviceManager != null) {
- serviceManagers.add(serviceManager);
- }
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException(e, registryFutureTask.getServiceName(), "getServiceManagers(java.lang.Class)");
- } catch (ExecutionException ignored) {
- // registration threw an exception which means it didn't register
- }
- }
- return serviceManagers;
- }
-
- /**
- * Gets the first registed and running service that is an instance of the specified type, or null if no instances
- * of the specified type are running.
- *
- * @param type the of the desired service
- * @return the first registed and running service that is an instance of the specified type or null if none found
- */
- public synchronized Object getService(Class type) {
- SortedSet serviceManagerFutures = getServiceManagerFutures(type);
- for (Iterator iterator = serviceManagerFutures.iterator(); iterator.hasNext();) {
- RegistryFutureTask registryFutureTask = (RegistryFutureTask) iterator.next();
- try {
- ServiceManager serviceManager = (ServiceManager) registryFutureTask.get();
- if (serviceManager != null) {
- Object service = serviceManager.getService();
- if (service != null) {
- return service;
- }
- }
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException(e, registryFutureTask.getServiceName(), "getService(java.lang.Class)");
- } catch (ExecutionException ignored) {
- // registration threw an exception which means it didn't register
- }
- }
- return null;
- }
-
- /**
- * Gets the all of running service that are an instances of the specified type, or an empty list if no instances
- * of the specified type are running.
- *
- * @param type the of the desired service
- * @return the all of running service that are an instances of the specified type, or an empty list if none found
- */
- public synchronized List getServices(Class type) {
- List serviceManagers = getServiceManagers(type);
- List services = new ArrayList(serviceManagers.size());
- for (Iterator iterator = serviceManagers.iterator(); iterator.hasNext();) {
- ServiceManager serviceManager = (ServiceManager) iterator.next();
- if (serviceManager != null) {
- Object service = serviceManager.getService();
- if (service != null) {
- services.add(service);
- }
- }
- }
- return services;
- }
-
- private SortedSet getServiceManagerFutures(Class type) {
- SortedSet serviceManagerFutures;
- synchronized (serviceManagers) {
- serviceManagerFutures = (SortedSet) serviceManagersByType.get(type);
- if (serviceManagerFutures != null) {
- serviceManagerFutures = new TreeSet(serviceManagerFutures);
- } else {
- serviceManagerFutures = new TreeSet();
- }
- }
- return serviceManagerFutures;
- }
-
- /**
- * Creates a ServiceManager and registers it under the specified name. If the service is restartable, it will
- * enter the server in the STOPPED state. If a service is not restartable, the service manager will assure that all
- * dependencies are satisfied and service will immediately enter in the RUNNING state. If a
- * dependency for a non-restartable service is not immediately satisfiable, this method will throw a
- * ServiceRegistrationException.
- *
- * @param serviceName the unique name of the service
- * @param serviceFactory the factory used to create the service
- * @param classLoader the class loader to use for this service
- * @throws ServiceAlreadyExistsException if service is already registered with the specified name
- * @throws ServiceRegistrationException if the service is not restartable and an error occured while starting the service
- */
- public void registerService(ServiceName serviceName, ServiceFactory serviceFactory, ClassLoader classLoader) throws ServiceAlreadyExistsException, ServiceRegistrationException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (serviceFactory == null) throw new NullPointerException("serviceFactory is null");
- if (classLoader == null) throw new NullPointerException("classLoader is null");
-
- if (!serviceFactory.isEnabled()) {
- throw new ServiceRegistrationException(serviceName,
- new IllegalServiceStateException("A disabled non-restartable service factory can not be registered", serviceName));
- }
-
- RegistryFutureTask registrationTask = null;
-
- //
- // This loop will continue until we put our registrationTask in the serviceManagers map. If at any point,
- // we discover that there is already a service registered under the specified service name, we will throw
- // a ServiceAlreadyExistsException exiting this method.
- //
- while (registrationTask == null) {
- RegistryFutureTask existingRegistration;
- synchronized (serviceManagers) {
- existingRegistration = (RegistryFutureTask) serviceManagers.get(serviceName);
-
- // if we do not have an existing registration or the existing registration task is complete
- // we can create the new registration task; otherwise we need to wait for the existing registration to
- // finish out side of the synchronized lock on serviceManagers.
- if (existingRegistration == null || existingRegistration.isDone()) {
- // if we have a valid existing registration, throw a ServiceAlreadyExistsException
- if (existingRegistration != null) {
- try {
- boolean alreadyRegistered = (existingRegistration.get() != null);
- if (alreadyRegistered) {
- throw new ServiceAlreadyExistsException(serviceName);
- }
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException(e, serviceName, "registerService");
- } catch (ExecutionException e) {
- // the previous registration threw an exception.. we can continure as normal
- }
- }
-
- // we are ready to register our serviceManager
- existingRegistration = null;
- ServiceManager serviceManager = serviceManagerFactory.createServiceManager(serviceId.getAndIncrement(),
- serviceName,
- serviceFactory,
- classLoader);
- registrationTask = RegistryFutureTask.createRegisterTask(serviceManager);
- serviceManagers.put(serviceName, registrationTask);
- addTypeIndex(serviceManager, registrationTask);
- }
- }
-
- // If there is an unfinished exiting registration task, wait until it is done executing
- if (existingRegistration != null) {
- try {
- existingRegistration.get();
- // we don't throw an error here because we want to check in the synchronized block that this
- // future is still registered in the serviceManagers map
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException(e, serviceName, "registerService");
- } catch (ExecutionException e) {
- // good
- }
- }
- }
-
- // run our registration task and check the results
- registrationTask.run();
- try {
- // if initialization completed successfully, this method will not throw an exception
- registrationTask.get();
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException(e, serviceName, "registerService");
- } catch (ExecutionException e) {
- // registration failed, remove our task
- synchronized (serviceManagers) {
- // make sure our task is still the registered one
- if (serviceManagers.get(serviceName) == registrationTask) {
- serviceManagers.remove(serviceName);
- removeTypeIndex(registrationTask);
- }
- }
- throw new ServiceRegistrationException(serviceName, e.getCause());
- }
- }
-
- /**
- * Stops and destorys the ServiceManager and then unregisters it. The ServiceManagerRegistry will attempt to stop
- * the service using the specified stop strategy, but if the service can not be stopped a
- * ServiceRegistrationException will be thrown containing either an UnsatisfiedConditionsException or an
- * IllegalServiceStateException.
- *
- * @param serviceName the unique name of the service
- * @param stopStrategy the strategy that determines how unsatisfied conditions are handled
- * @throws ServiceNotFoundException if there is no service registered under the specified name
- * @throws ServiceRegistrationException if the service could not be stopped
- */
- public void unregisterService(ServiceName serviceName, StopStrategy stopStrategy) throws ServiceNotFoundException, ServiceRegistrationException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (stopStrategy == null) throw new NullPointerException("stopStrategy is null");
-
- RegistryFutureTask unregistrationTask = null;
-
- //
- // This loop will continue until we put our unregistrationTask in the serviceManagers map. If at any point,
- // we discover that there actually is not a service registered under the specified service name, we will throw
- // a ServiceNotFoundException exiting this method.
- //
- while (unregistrationTask == null) {
- RegistryFutureTask existingRegistration;
- synchronized (serviceManagers) {
- existingRegistration = (RegistryFutureTask) serviceManagers.get(serviceName);
- if (existingRegistration == null) {
- throw new ServiceNotFoundException(serviceName);
- }
-
- // if existing registration is done running, we can destroy it
- if (existingRegistration.isDone()) {
- ServiceManager serviceManager = null;
- try {
- serviceManager = (ServiceManager) existingRegistration.get();
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException(e, serviceName, "unregisterService");
- } catch (ExecutionException e) {
- // good
- }
-
- // if there isn't a registered manager that is an exception
- if (serviceManager == null) {
- throw new ServiceNotFoundException(serviceName);
- }
-
- // we are ready to register our serviceManager
- existingRegistration = null;
- unregistrationTask = RegistryFutureTask.createUnregisterTask(serviceManager, stopStrategy);
- serviceManagers.put(serviceName, unregistrationTask);
- addTypeIndex(serviceManager, unregistrationTask);
- }
- }
-
-
- // If there is an unfinished exiting registration task, wait until it is done executing
- if (existingRegistration != null) {
- try {
- existingRegistration.get();
- // we don't throw an error here because we want to check in the synchronized block that this
- // future is still registered in the serviceManagers map
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException(e, serviceName, "unregisterService");
- } catch (ExecutionException e) {
- // good
- }
- }
- }
-
- unregistrationTask.run();
- try {
- // if get returns any value other then null, the unregistration failed
- if (unregistrationTask.get() == null) {
- // unregistration was successful, remove the furuture object
- synchronized (serviceManagers) {
- // make sure our task is still the registered one
- if (serviceManagers.get(serviceName) == unregistrationTask) {
- serviceManagers.remove(serviceName);
- removeTypeIndex(unregistrationTask);
- }
- }
- } else {
- synchronized (unregistrationTask) {
- // the root exception is contained in the exception handle
- throw new ServiceRegistrationException(serviceName, unregistrationTask.getThrowable());
- }
- }
- } catch (InterruptedException e) {
- throw new KernelOperationInterruptedException(e, serviceName, "unregisterService");
- } catch (ExecutionException e) {
- // this won't happen
- throw new AssertionError(e);
- }
- }
-
- private void addTypeIndex(ServiceManager serviceManager, RegistryFutureTask registryFutureTask) {
- if (serviceManager == null) throw new NullPointerException("serviceManager is null");
- if (registryFutureTask == null) throw new NullPointerException("serviceManagerFuture is null");
-
- Set allTypes = new LinkedHashSet();
- for (Iterator iterator = serviceManager.getServiceTypes().iterator(); iterator.hasNext();) {
- Class serviceType = (Class) iterator.next();
-
- if (serviceType.isArray()) {
- throw new IllegalArgumentException("Service is an array: serviceName=" + serviceManager.getServiceName() +
- ", serviceType=" + serviceManager.getServiceTypes());
- }
-
- allTypes.add(serviceType);
- allTypes.addAll(getAllSuperClasses(serviceType));
- allTypes.addAll(getAllInterfaces(serviceType));
- }
-
- synchronized (serviceManagers) {
- for (Iterator iterator = allTypes.iterator(); iterator.hasNext();) {
- Class type = (Class) iterator.next();
- Set futureServiceManagers = (Set) serviceManagersByType.get(type);
- if (futureServiceManagers == null) {
- futureServiceManagers = new TreeSet();
- serviceManagersByType.put(type, futureServiceManagers);
- }
- futureServiceManagers.add(registryFutureTask);
- }
- }
- }
-
- private void removeTypeIndex(RegistryFutureTask registryFutureTask) {
- if (registryFutureTask == null) throw new NullPointerException("serviceManagerFuture is null");
- synchronized (serviceManagers) {
- for (Iterator iterator = serviceManagersByType.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- Set serviceManagers = (Set) entry.getValue();
- serviceManagers.remove(registryFutureTask);
- if (serviceManagers.isEmpty()) {
- iterator.remove();
- }
- }
- }
- }
-
- private static Set getAllSuperClasses(Class clazz) {
- Set allSuperClasses = new LinkedHashSet();
- for (Class superClass = clazz.getSuperclass(); superClass != null; superClass = superClass.getSuperclass()) {
- allSuperClasses.add(superClass);
- }
- return allSuperClasses;
- }
-
- private static Set getAllInterfaces(Class clazz) {
- Set allInterfaces = new LinkedHashSet();
- LinkedList stack = new LinkedList();
- stack.addAll(Arrays.asList(clazz.getInterfaces()));
- while (!stack.isEmpty()) {
- Class intf = (Class) stack.removeFirst();
- if (!allInterfaces.contains(intf)) {
- allInterfaces.add(intf);
- stack.addAll(Arrays.asList(intf.getInterfaces()));
- }
- }
- return allInterfaces;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceMonitorBroadcaster.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceMonitorBroadcaster.java
deleted file mode 100644
index 91db06a..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/ServiceMonitorBroadcaster.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.xbean.kernel.ServiceMonitor;
-import org.apache.xbean.kernel.KernelMonitor;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.ServiceEvent;
-import org.apache.xbean.kernel.KernelErrorsError;
-
-/**
- * The ServiceMonitorBroadcaster broadcasts kernel events to registered service monitors.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceMonitorBroadcaster implements ServiceMonitor {
- /**
- * The monitors for service events.
- */
- private final Map serviceMonitors = new LinkedHashMap();
-
- /**
- * The monitor we notify when we get an exception from a service monitor.
- */
- private final KernelMonitor kernelMonitor;
-
- /**
- * Creates a ServiceMonitorBroadcaster that notifies the specified kernel monitor when an error occurs while
- * notifying the registered service monitors.
- *
- * @param kernelMonitor the monitor to notify when an error occurs while notifying the registered service monitors
- */
- public ServiceMonitorBroadcaster(KernelMonitor kernelMonitor) {
- if (kernelMonitor == null) throw new NullPointerException("kernelMonitor is null");
- this.kernelMonitor = kernelMonitor;
- }
-
- /**
- * Adds a service monitor for a specific service, or if the specified service name is null, a global monitor.
- * <p/>
- * Note: the order in which service monitors are notified is not specified.
- *
- * @param serviceMonitor the service monitor to add
- * @param serviceName the unique name of the service to monitor or null to monitor all services
- */
- public void addServiceMonitor(ServiceMonitor serviceMonitor, ServiceName serviceName) {
- if (serviceMonitor == null) throw new NullPointerException("serviceMonitor is null");
- synchronized (serviceMonitors) {
- Set monitors = (Set) serviceMonitors.get(serviceName);
- if (monitors == null) {
- monitors = new LinkedHashSet();
- serviceMonitors.put(serviceName, monitors);
- }
- monitors.add(serviceMonitor);
- }
- }
-
- /**
- * Removes a service monitor.
- *
- * @param serviceMonitor the service monitor to remove
- */
- public void removeServiceMonitor(ServiceMonitor serviceMonitor) {
- if (serviceMonitor == null) throw new NullPointerException("serviceMonitor is null");
- synchronized (serviceMonitors) {
- for (Iterator iterator = serviceMonitors.values().iterator(); iterator.hasNext();) {
- Set monitors = (Set) iterator.next();
- monitors.remove(serviceMonitor);
- if (monitors.isEmpty()) {
- iterator.remove();
- }
- }
- }
- }
-
- /**
- * Gets the service monitors registered to recieve events for the specified service. This will include all global
- * monitors and service specific monitors.
- *
- * @param serviceName the name of the service
- * @return the monitors registerd to recieve events for the specified service
- */
- private Set getServiceMonitors(ServiceName serviceName) {
- synchronized (serviceMonitors) {
- Set monitors = new LinkedHashSet();
- Set globalMonitors = (Set) serviceMonitors.get(null);
- if (globalMonitors != null) {
- monitors.addAll(globalMonitors);
- }
- Set specificMonitors = (Set) serviceMonitors.get(serviceName);
- if (specificMonitors != null) {
- monitors.addAll(specificMonitors);
- }
- return monitors;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceRegistered(ServiceEvent serviceEvent) {
- List errors = new ArrayList();
- Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName());
- for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) {
- ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next();
- try {
- serviceMonitor.serviceRegistered(serviceEvent);
- } catch (Throwable e) {
- errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e));
- }
- }
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStarting(ServiceEvent serviceEvent) {
- List errors = new ArrayList();
- Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName());
- for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) {
- ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next();
- try {
- serviceMonitor.serviceStarting(serviceEvent);
- } catch (Throwable e) {
- errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e));
- }
- }
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceWaitingToStart(ServiceEvent serviceEvent) {
- List errors = new ArrayList();
- Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName());
- for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) {
- ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next();
- try {
- serviceMonitor.serviceWaitingToStart(serviceEvent);
- } catch (Throwable e) {
- errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e));
- }
- }
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStartError(ServiceEvent serviceEvent) {
- List errors = new ArrayList();
- Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName());
- for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) {
- ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next();
- try {
- serviceMonitor.serviceStartError(serviceEvent);
- } catch (Throwable e) {
- errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e));
- }
- }
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceRunning(ServiceEvent serviceEvent) {
- List errors = new ArrayList();
- Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName());
- for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) {
- ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next();
- try {
- serviceMonitor.serviceRunning(serviceEvent);
- } catch (Throwable e) {
- errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e));
- }
- }
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStopping(ServiceEvent serviceEvent) {
- List errors = new ArrayList();
- Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName());
- for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) {
- ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next();
- try {
- serviceMonitor.serviceStopping(serviceEvent);
- } catch (Throwable e) {
- errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e));
- }
- }
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceWaitingToStop(ServiceEvent serviceEvent) {
- List errors = new ArrayList();
- Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName());
- for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) {
- ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next();
- try {
- serviceMonitor.serviceWaitingToStop(serviceEvent);
- } catch (Throwable e) {
- errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e));
- }
- }
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStopError(ServiceEvent serviceEvent) {
- List errors = new ArrayList();
- Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName());
- for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) {
- ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next();
- try {
- serviceMonitor.serviceStopError(serviceEvent);
- } catch (Throwable e) {
- errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e));
- }
- }
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceStopped(ServiceEvent serviceEvent) {
- List errors = new ArrayList();
- Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName());
- for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) {
- ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next();
- try {
- serviceMonitor.serviceStopped(serviceEvent);
- } catch (Throwable e) {
- errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e));
- }
- }
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void serviceUnregistered(ServiceEvent serviceEvent) {
- List errors = new ArrayList();
- Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName());
- for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) {
- ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next();
- try {
- serviceMonitor.serviceUnregistered(serviceEvent);
- } catch (Throwable e) {
- errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e));
- }
- }
- if (!errors.isEmpty()) {
- throw new KernelErrorsError(errors);
- }
- }
-
- private List fireServiceNotificationError(ServiceMonitor serviceMonitor, ServiceEvent serviceEvent, Throwable throwable) {
- try {
- kernelMonitor.serviceNotificationError(serviceMonitor, serviceEvent, throwable);
- } catch (RuntimeException ignored) {
- // ignore - we did our best to notify the world
- } catch (KernelErrorsError e) {
- return e.getErrors();
- } catch (Error e) {
- return Collections.singletonList(e);
- }
- return Collections.EMPTY_LIST;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardKernel.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardKernel.java
deleted file mode 100644
index 3a46799..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardKernel.java
+++ /dev/null
@@ -1,513 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import edu.emory.mathcs.backport.java.util.concurrent.Executors;
-import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
-import edu.emory.mathcs.backport.java.util.concurrent.locks.Lock;
-import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock;
-import edu.emory.mathcs.backport.java.util.concurrent.locks.Condition;
-import org.apache.xbean.kernel.IllegalServiceStateException;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.KernelErrorsError;
-import org.apache.xbean.kernel.KernelMonitor;
-import org.apache.xbean.kernel.ServiceAlreadyExistsException;
-import org.apache.xbean.kernel.ServiceFactory;
-import org.apache.xbean.kernel.ServiceMonitor;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.ServiceNotFoundException;
-import org.apache.xbean.kernel.ServiceRegistrationException;
-import org.apache.xbean.kernel.ServiceState;
-import org.apache.xbean.kernel.StartStrategies;
-import org.apache.xbean.kernel.StartStrategy;
-import org.apache.xbean.kernel.StopStrategies;
-import org.apache.xbean.kernel.StopStrategy;
-import org.apache.xbean.kernel.UnregisterServiceException;
-import org.apache.xbean.kernel.UnsatisfiedConditionsException;
-import org.apache.xbean.kernel.KernelFactory;
-
-/**
- * The standard kernel implementation.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class StandardKernel implements Kernel {
- /**
- * The unique name of this kernel.
- */
- private final String kernelName;
-
- /**
- * The registered service managers.
- */
- private final ServiceManagerRegistry serviceManagerRegistry;
-
- /**
- * Tracks and broadcasts kernel evnents to the registered listeners.
- */
- private final KernelMonitorBroadcaster kernelMonitor = new KernelMonitorBroadcaster();
-
- /**
- * This monitor broadcasts events to the listeners registered for service.
- */
- private final ServiceMonitorBroadcaster serviceMonitor = new ServiceMonitorBroadcaster(kernelMonitor);
-
- /**
- * If true, the kernel is still running.
- */
- private boolean running = true;
-
- /**
- * Lock that should be acquired before accessing the running boolean flag.
- */
- private final Lock destroyLock = new ReentrantLock();
-
- /**
- * The condition that is notified when the kernel has been destroyed.
- */
- private final Condition destroyCondition = destroyLock.newCondition();
-
- /**
- * Creates the service managers with handle service lifecycle.
- */
- private ServiceManagerFactory serviceManagerFactory;
-
- /**
- * The service executor for this kernel
- */
- private ExecutorService serviceExecutor;
-
- /**
- * True if the executor is owned by this kernel and should be shutdown
- * when the kernel is destroyed
- */
- private boolean ownsServiceExecutor;
-
- /**
- * Creates a kernel using the specified name.
- *
- * @param kernelName the unique name of this kernel
- */
- public StandardKernel(String kernelName) {
- this(kernelName, Executors.newCachedThreadPool(), 30, TimeUnit.SECONDS);
- ownsServiceExecutor = true;
- }
-
- /**
- * Creates a kernel using the specified name.
- *
- * @param kernelName the unique name of this kernel
- * @param serviceExecutor the executor to use for asynchronous service operations
- * @param timeoutDuration the maximum duration to wait for a service event to complete
- * @param timeoutUnits the unit of measure for the timeoutDuration
- */
- public StandardKernel(String kernelName, ExecutorService serviceExecutor, long timeoutDuration, TimeUnit timeoutUnits) {
- if (kernelName == null) throw new NullPointerException("kernelName is null");
- if (kernelName.length() ==0) throw new IllegalArgumentException("kernelName must be atleast one character long");
- if (serviceExecutor == null) throw new NullPointerException("serviceExecutor is null");
- if (timeoutUnits == null) throw new NullPointerException("timeoutUnits is null");
-
- this.kernelName = kernelName;
- this.serviceExecutor = serviceExecutor;
- serviceManagerFactory = new ServiceManagerFactory(this, serviceMonitor, serviceExecutor, timeoutDuration, timeoutUnits);
- serviceManagerRegistry = new ServiceManagerRegistry(serviceManagerFactory);
- }
-
- /**
- * {@inheritDoc}
- */
- public void destroy() throws KernelErrorsError {
- destroyLock.lock();
- try {
- // if we are already stopped simply return
- if (!running) {
- return;
- }
- running = false;
- } finally {
- destroyLock.unlock();
- }
-
- // destroy all services
- serviceManagerRegistry.destroy();
-
- // shutdown service executor
- if (ownsServiceExecutor) {
- serviceExecutor.shutdown();
- }
-
- // remove this kernel from the kernel factory registry
- KernelFactory.destroyInstance(this);
-
- // notify threads waiting for destroy to complete
- destroyLock.lock();
- try {
- destroyCondition.signalAll();
- } finally {
- destroyLock.unlock();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void waitForDestruction() {
- destroyLock.lock();
- try {
- // if we are already stopped simply return
- if (!running) {
- return;
- }
-
- // wait until destroy completes
- destroyCondition.awaitUninterruptibly();
- } finally {
- destroyLock.unlock();
- }
-
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isRunning() {
- destroyLock.lock();
- try {
- return running;
- } finally {
- destroyLock.unlock();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public String getKernelName() {
- return kernelName;
- }
-
- /**
- * {@inheritDoc}
- */
- public void registerService(ServiceName serviceName, ServiceFactory serviceFactory, ClassLoader classLoader) throws ServiceAlreadyExistsException, ServiceRegistrationException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (serviceFactory == null) throw new NullPointerException("serviceFactory is null");
- if (classLoader == null) throw new NullPointerException("classLoader is null");
- if (!isRunning()) {
- throw new ServiceRegistrationException(serviceName, new IllegalStateException("Kernel is destroyed"));
- }
-
- serviceManagerRegistry.registerService(serviceName, serviceFactory, classLoader);
- }
-
- /**
- * {@inheritDoc}
- */
- public void unregisterService(ServiceName serviceName) throws ServiceNotFoundException, ServiceRegistrationException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- unregisterService(serviceName, StopStrategies.SYNCHRONOUS);
- }
-
- /**
- * {@inheritDoc}
- */
- public void unregisterService(ServiceName serviceName, StopStrategy stopStrategy) throws ServiceNotFoundException, ServiceRegistrationException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (stopStrategy == null) throw new NullPointerException("stopStrategy is null");
- if (!isRunning()) {
- return;
- }
-
- serviceManagerRegistry.unregisterService(serviceName, stopStrategy);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isRegistered(ServiceName serviceName) {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (!isRunning()) {
- return false;
- }
-
- return serviceManagerRegistry.isRegistered(serviceName);
- }
-
- /**
- * {@inheritDoc}
- */
- public ServiceState getServiceState(ServiceName serviceName) throws ServiceNotFoundException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- ServiceManager serviceManager = getServiceManager(serviceName);
- return serviceManager.getState();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getServiceStartTime(ServiceName serviceName) throws ServiceNotFoundException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- ServiceManager serviceManager = getServiceManager(serviceName);
- return serviceManager.getStartTime();
- }
-
- /**
- * {@inheritDoc}
- */
- public void startService(ServiceName serviceName) throws ServiceNotFoundException, IllegalServiceStateException, UnsatisfiedConditionsException, Exception {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- startService(serviceName, false, StartStrategies.SYNCHRONOUS);
- }
-
- /**
- * {@inheritDoc}
- */
- public void startService(ServiceName serviceName, StartStrategy startStrategy) throws ServiceNotFoundException, IllegalServiceStateException, UnsatisfiedConditionsException, Exception {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (startStrategy == null) throw new NullPointerException("startStrategy is null");
- startService(serviceName, false, startStrategy);
- }
-
- /**
- * {@inheritDoc}
- */
- public void startServiceRecursive(ServiceName serviceName) throws ServiceNotFoundException, IllegalServiceStateException, UnsatisfiedConditionsException, Exception {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- startService(serviceName, true, StartStrategies.SYNCHRONOUS);
- }
-
- /**
- * {@inheritDoc}
- */
- public void startServiceRecursive(ServiceName serviceName, StartStrategy startStrategy) throws ServiceNotFoundException, IllegalServiceStateException, UnsatisfiedConditionsException, Exception {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (startStrategy == null) throw new NullPointerException("startStrategy is null");
- startService(serviceName, true, startStrategy);
- }
-
- private void startService(ServiceName serviceName, boolean recursive, StartStrategy startStrategy) throws Exception {
- if (startStrategy == null) throw new NullPointerException("startStrategy is null");
- ServiceManager serviceManager = getServiceManager(serviceName);
- try {
- serviceManager.start(recursive, startStrategy);
- } catch (UnregisterServiceException e) {
- try {
- unregisterService(serviceName, StopStrategies.FORCE);
- } catch (ServiceNotFoundException ignored) {
- // that is weird, but what ever
- } catch (ServiceRegistrationException ignored) {
- // we are alredy throwing an exception so ignore this one
- }
- Throwable cause = e.getCause();
- if (cause instanceof Exception) {
- throw (Exception) cause;
- } else if (cause instanceof Error) {
- throw (Error) cause;
- } else {
- throw new AssertionError(cause);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void stopService(ServiceName serviceName) throws ServiceNotFoundException, UnsatisfiedConditionsException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- stopService(serviceName, StopStrategies.SYNCHRONOUS);
- }
-
- /**
- * {@inheritDoc}
- */
- public void stopService(ServiceName serviceName, StopStrategy stopStrategy) throws ServiceNotFoundException, UnsatisfiedConditionsException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (stopStrategy == null) throw new NullPointerException("stopStrategy is null");
- ServiceManager serviceManager = getServiceManager(serviceName);
- serviceManager.stop(stopStrategy);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isServiceEnabled(ServiceName serviceName) throws ServiceNotFoundException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- ServiceManager serviceManager = getServiceManager(serviceName);
- ServiceFactory serviceFactory = serviceManager.getServiceFactory();
- return serviceFactory.isEnabled();
- }
-
- /**
- * {@inheritDoc}
- */
- public void setServiceEnabled(ServiceName serviceName, boolean enabled) throws ServiceNotFoundException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- ServiceManager serviceManager = getServiceManager(serviceName);
- ServiceFactory serviceFactory = serviceManager.getServiceFactory();
- serviceFactory.setEnabled(enabled);
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getService(ServiceName serviceName) throws ServiceNotFoundException, IllegalArgumentException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- ServiceManager serviceManager = getServiceManager(serviceName);
- return serviceManager.getService();
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getService(Class type) {
- if (type == null) throw new NullPointerException("type is null");
- if (!isRunning()) {
- return null;
- }
-
- Object service = serviceManagerRegistry.getService(type);
- return service;
- }
-
- /**
- * {@inheritDoc}
- */
- public List getServices(Class type) {
- if (type == null) throw new NullPointerException("type is null");
- if (!isRunning()) {
- return null;
- }
-
- List services = serviceManagerRegistry.getServices(type);
- return services;
- }
-
- /**
- * {@inheritDoc}
- */
- public ServiceFactory getServiceFactory(ServiceName serviceName) throws ServiceNotFoundException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- ServiceManager serviceManager = getServiceManager(serviceName);
- return serviceManager.getServiceFactory();
- }
-
- /**
- * {@inheritDoc}
- */
- public ServiceFactory getServiceFactory(Class type) {
- if (type == null) throw new NullPointerException("type is null");
- if (!isRunning()) {
- return null;
- }
-
- ServiceManager serviceManager = serviceManagerRegistry.getServiceManager(type);
- return serviceManager.getServiceFactory();
- }
-
- /**
- * {@inheritDoc}
- */
- public List getServiceFactories(Class type) {
- if (type == null) throw new NullPointerException("type is null");
- if (!isRunning()) {
- return null;
- }
-
- List serviceManagers = serviceManagerRegistry.getServiceManagers(type);
- List serviceFactories = new ArrayList(serviceManagers.size());
- for (Iterator iterator = serviceManagers.iterator(); iterator.hasNext();) {
- ServiceManager serviceManager = (ServiceManager) iterator.next();
- serviceFactories.add(serviceManager.getServiceFactory());
- }
- return serviceFactories;
- }
-
- /**
- * {@inheritDoc}
- */
- public ClassLoader getClassLoaderFor(ServiceName serviceName) throws ServiceNotFoundException {
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- ServiceManager serviceManager = getServiceManager(serviceName);
- return serviceManager.getClassLoader();
- }
-
- private ServiceManager getServiceManager(ServiceName serviceName) throws ServiceNotFoundException {
- if (!isRunning()) {
- throw new ServiceNotFoundException(serviceName);
- }
-
- ServiceManager serviceManager = serviceManagerRegistry.getServiceManager(serviceName);
- return serviceManager;
- }
-
- /**
- * {@inheritDoc}
- */
- public void addKernelMonitor(KernelMonitor kernelMonitor) {
- if (kernelMonitor == null) throw new NullPointerException("kernelMonitor is null");
- if (!isRunning()) {
- throw new IllegalStateException("Kernel is stopped");
- }
- this.kernelMonitor.addKernelMonitor(kernelMonitor);
- }
-
- /**
- * {@inheritDoc}
- */
- public void removeKernelMonitor(KernelMonitor kernelMonitor) {
- if (kernelMonitor == null) throw new NullPointerException("kernelMonitor is null");
- this.kernelMonitor.removeKernelMonitor(kernelMonitor);
- }
-
- /**
- * {@inheritDoc}
- */
- public void addServiceMonitor(ServiceMonitor serviceMonitor) {
- if (serviceMonitor == null) throw new NullPointerException("serviceMonitor is null");
- if (!isRunning()) {
- throw new IllegalStateException("Kernel is stopped");
- }
- addServiceMonitor(serviceMonitor, null);
- }
-
- /**
- * {@inheritDoc}
- */
- public void addServiceMonitor(ServiceMonitor serviceMonitor, ServiceName serviceName) {
- if (serviceMonitor == null) throw new NullPointerException("serviceMonitor is null");
- if (serviceName == null) throw new NullPointerException("serviceName is null");
- if (!isRunning()) {
- throw new IllegalStateException("Kernel is stopped");
- }
- this.serviceMonitor.addServiceMonitor(serviceMonitor, serviceName);
- }
-
- /**
- * {@inheritDoc}
- */
- public void removeServiceMonitor(ServiceMonitor serviceMonitor) {
- if (serviceMonitor == null) throw new NullPointerException("serviceMonitor is null");
- this.serviceMonitor.removeServiceMonitor(serviceMonitor);
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardKernelFactory.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardKernelFactory.java
deleted file mode 100644
index 584459f..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardKernelFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.KernelFactory;
-
-/**
- * The kernel factory for StandardKernel instances.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class StandardKernelFactory extends KernelFactory {
- /**
- * {@inheritDoc}
- */
- protected Kernel createKernelInternal(String name) {
- if (name == null) throw new NullPointerException("name is null");
- return new StandardKernel(name);
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardServiceConditionContext.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardServiceConditionContext.java
deleted file mode 100644
index 1385f31..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardServiceConditionContext.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import edu.emory.mathcs.backport.java.util.concurrent.locks.Condition;
-import edu.emory.mathcs.backport.java.util.concurrent.locks.Lock;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.ServiceConditionContext;
-import org.apache.xbean.kernel.ServiceName;
-
-/**
- * This is the service context used by the service manager.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class StandardServiceConditionContext implements ServiceConditionContext {
- /**
- * The kernel in which the service is registered.
- */
- private final Kernel kernel;
-
- /**
- * The unique name of the service in the kernel.
- */
- private final ServiceName serviceName;
-
- /**
- * The class loader for the service.
- */
- private final ClassLoader classLoader;
-
- /**
- * The lock that must be acquired before signaling the condition.
- */
- private final Lock lock;
-
- /**
- * The condition to signal when the {@link #setSatisfied()} method is called.
- */
- private final Condition condition;
-
- /**
- * Has this condition been satisfied? Once satisfied a condition is always considered satisfied.
- */
- private boolean satisfied = false;
-
- /**
- * Creates a service context for the specified service.
- *
- * @param kernel the kernel in which the service is registered
- * @param serviceName the name of the service
- * @param classLoader the class loader for the service
- * @param lock the lock for the service manager
- * @param condition the condition that should be notified when the {@link #setSatisfied()} method is called
- */
- public StandardServiceConditionContext(Kernel kernel, ServiceName serviceName, ClassLoader classLoader, Lock lock, Condition condition) {
- this.kernel = kernel;
- this.serviceName = serviceName;
- this.classLoader = classLoader;
- this.lock = lock;
- this.condition = condition;
- }
-
- /**
- * {@inheritDoc}
- */
- public Kernel getKernel() {
- return kernel;
- }
-
- /**
- * {@inheritDoc}
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-
- /**
- * {@inheritDoc}
- */
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-
- /**
- * Gets the satisfied status of this condition. Once satisfied a condition is considered satisfied until destroyed
- * and reinitialized. The ServiceManager uses the StandardServiceConditionContext to track the status of conditions
- * so it will call setSatisfied() when the condition returns true from isSatisfied().
- *
- * @return satisfied status of this condition
- */
- public boolean isSatisfied() {
- return satisfied;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setSatisfied() {
- lock.lock();
- try {
- if (!satisfied) {
- satisfied = true;
- condition.signalAll();
- }
- } finally {
- lock.unlock();
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardServiceContext.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardServiceContext.java
deleted file mode 100644
index 127aacb..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/StandardServiceContext.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.ServiceContext;
-import org.apache.xbean.kernel.ServiceFactory;
-import org.apache.xbean.kernel.ServiceName;
-
-/**
- * The standard service context implementation. This is passed to the service factory in the
- * {@link ServiceFactory#createService(ServiceContext)} and {@link ServiceFactory#destroyService(ServiceContext)}
- * methods.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class StandardServiceContext implements ServiceContext {
- private final Kernel kernel;
- private final ServiceName serviceName;
- private final ClassLoader classLoader;
-
- /**
- * Creates the standard service context implementation.
- *
- * @param kernel the kernel in which the service is registered
- * @param serviceName the name of the service
- * @param classLoader the class loader for the service
- */
- public StandardServiceContext(Kernel kernel, ServiceName serviceName, ClassLoader classLoader) {
- this.kernel = kernel;
- this.serviceName = serviceName;
- this.classLoader = classLoader;
- }
-
- /**
- * {@inheritDoc}
- */
- public Kernel getKernel() {
- return kernel;
- }
-
- /**
- * {@inheritDoc}
- */
- public ServiceName getServiceName() {
- return serviceName;
- }
-
- /**
- * {@inheritDoc}
- */
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-}
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/package.html b/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/package.html
deleted file mode 100644
index eac9184..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/kernel/standard/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<html>
-<body>
-Provides the standard kernel implementation. The classes contined in this package should be considered private
-implementation details of XBean, and should not be used directly.
-</body>
-<html>
\ No newline at end of file
diff --git a/trunk/xbean-kernel/src/main/java/org/apache/xbean/rmi/RMIClassLoaderSpiImpl.java b/trunk/xbean-kernel/src/main/java/org/apache/xbean/rmi/RMIClassLoaderSpiImpl.java
deleted file mode 100644
index f7bec1e..0000000
--- a/trunk/xbean-kernel/src/main/java/org/apache/xbean/rmi/RMIClassLoaderSpiImpl.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.rmi;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.rmi.server.RMIClassLoader;
-import java.rmi.server.RMIClassLoaderSpi;
-import java.util.StringTokenizer;
-
-
-/**
- * An implementation of {@link java.rmi.server.RMIClassLoaderSpi} which provides normilzation
- * of codebase URLs and delegates to the default {@link RMIClassLoaderSpi}.
- *
- * @version $Rev: 209990 $ $Date: 2005-07-09 21:24:52 -0700 (Sat, 09 Jul 2005) $
- */
-public class RMIClassLoaderSpiImpl extends RMIClassLoaderSpi {
-
- private static final RMIClassLoaderSpi delegate = RMIClassLoader.getDefaultProviderInstance();
-
- public Class loadClass(String codebase, String name, ClassLoader defaultLoader)
- throws MalformedURLException, ClassNotFoundException
- {
- if (codebase != null) {
- codebase = normalizeCodebase(codebase);
- }
-
- return delegate.loadClass(codebase, name, defaultLoader);
- }
-
- public Class loadProxyClass(String codebase, String[] interfaces, ClassLoader defaultLoader)
- throws MalformedURLException, ClassNotFoundException
- {
- if (codebase != null) {
- codebase = normalizeCodebase(codebase);
- }
-
- return delegate.loadProxyClass(codebase, interfaces, defaultLoader);
- }
-
- public ClassLoader getClassLoader(String codebase) throws MalformedURLException {
-
- if (codebase != null) {
- codebase = normalizeCodebase(codebase);
- }
-
- return delegate.getClassLoader(codebase);
- }
-
- public String getClassAnnotation(Class type) {
-
- Object obj = type.getClassLoader();
- if (obj instanceof ClassLoaderServerAware) {
- ClassLoaderServerAware classLoader = (ClassLoaderServerAware) obj;
- URL urls[] = classLoader.getClassLoaderServerURLs();
- if (null == urls) {
- return delegate.getClassAnnotation(type);
- }
- StringBuffer codebase = new StringBuffer();
- for (int i = 0; i < urls.length; i++) {
- URL url = normalizeURL(urls[i]);
- if (codebase.length() != 0) {
- codebase.append(' ');
- }
- codebase.append(url);
- }
- return codebase.toString();
- }
-
- return delegate.getClassAnnotation(type);
- }
-
- static String normalizeCodebase(String input) throws MalformedURLException {
-
- StringBuffer codebase = new StringBuffer();
- StringBuffer working = new StringBuffer();
- StringTokenizer stok = new StringTokenizer(input, " \t\n\r\f", true);
-
- while (stok.hasMoreTokens()) {
- String item = stok.nextToken();
- try {
- // If we got this far then item is a valid url, so commit the current
- // buffer and start collecting any trailing bits from where we are now
-
- updateCodebase(working, codebase);
- }
- catch (MalformedURLException ignore) {
- // just keep going & append to the working buffer
- }
-
- working.append(item);
- }
-
- // Handle trailing elements
- updateCodebase(working, codebase);
-
- return codebase.toString();
- }
-
- private static void updateCodebase(final StringBuffer working, final StringBuffer codebase) throws MalformedURLException {
-
- if (working.length() != 0) {
- // Normalize the URL
- URL url = normalizeURL(new URL(working.toString()));
-
- // Put spaces back in for URL delims
- if (codebase.length() != 0) {
- codebase.append(" ");
- }
- codebase.append(url);
-
- // Reset the working buffer
- working.setLength(0);
- }
- }
-
- static URL normalizeURL(URL url) {
-
- if (url.getProtocol().equals("file")) {
- String filename = url.getFile().replace('/', File.separatorChar);
- File file = new File(filename);
- try {
- url = file.toURI().toURL();
- }
- catch (MalformedURLException ignore) {
- }
- }
-
- return url;
- }
-
- public interface ClassLoaderServerAware {
- public URL[] getClassLoaderServerURLs();
- }
-}
-
diff --git a/trunk/xbean-kernel/src/main/resources/META-INF/LICENSE b/trunk/xbean-kernel/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-kernel/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-kernel/src/main/resources/META-INF/NOTICE b/trunk/xbean-kernel/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-kernel/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/KernelMonitorBroadcasterTest.java b/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/KernelMonitorBroadcasterTest.java
deleted file mode 100644
index bb4b480..0000000
--- a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/KernelMonitorBroadcasterTest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import junit.framework.TestCase;
-import org.apache.xbean.kernel.standard.StandardKernel;
-import org.apache.xbean.kernel.standard.KernelMonitorBroadcaster;
-
-/**
- * Tests the KernelMonitorBroadcaster.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class KernelMonitorBroadcasterTest extends TestCase {
- private static final ServiceMonitor SERVICE_MONITOR = new NullServiceMonitor();
- private static final ServiceEvent SERVICE_EVENT = new ServiceEvent(0,
- new StandardKernel("test"),
- new StringServiceName("service-name"),
- new StaticServiceFactory(new Object()),
- ClassLoader.getSystemClassLoader(),
- null,
- null,
- null);
- private static final Throwable THROWABLE = new Throwable("test throwable");
-
- private static final int MONITOR_COUNT = 4;
- private MockKernelMonitor[] kernelMonitors = new MockKernelMonitor[MONITOR_COUNT];
- private KernelMonitorBroadcaster kernelMonitorBroadcaster = new KernelMonitorBroadcaster();
-
- protected void setUp() throws Exception {
- super.setUp();
- for (int i = 0; i < kernelMonitors.length; i++) {
- kernelMonitors[i] = new MockKernelMonitor("monitor-" + i);
- kernelMonitorBroadcaster.addKernelMonitor(kernelMonitors[i]);
- }
- }
-
- /**
- * Test that events are fired to all registered monitors.
- * Strategy:
- * <ul><li>
- * Add the monitors
- * </li><li>
- * Fire an event
- * </li><li>
- * Verify that the event was called on each monitor
- * </li></ul>
- */
- public void testFireEvent() {
- kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE);
- assertNotificationCorrect();
- }
-
- private void assertNotificationCorrect() {
- for (int i = 0; i < kernelMonitors.length; i++) {
- MockKernelMonitor kernelMonitor = kernelMonitors[i];
- assertTrue(kernelMonitor.wasNotificationCalled());
- }
- }
-
- /**
- * Test that if a monitor is added more then once it only recieves the event once.
- * Strategy:
- * <ul><li>
- * Add a monitor several times
- * </li><li>
- * Fire an event
- * </li><li>
- * Verify that the monitor was only notified once
- * </li></ul>
- */
- public void testDoubleAdd() {
- kernelMonitorBroadcaster.addKernelMonitor(kernelMonitors[1]);
- kernelMonitorBroadcaster.addKernelMonitor(kernelMonitors[1]);
- kernelMonitorBroadcaster.addKernelMonitor(kernelMonitors[1]);
-
- kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE);
-
- // note the mock monitor asserts that it is only called once before requreing a reset
- assertNotificationCorrect();
- }
-
- /**
- * Test that events are not fired to a monitor that has been removed.
- * Strategy:
- * <ul><li>
- * Add the monitors
- * </li><li>
- * Fire an event
- * </li><li>
- * Verify that the event was called on each monitor
- * </li><li>
- * Removes a monitors
- * </li><li>
- * Fire an event
- * </li><li>
- * Verify that the event was called on each monitor except the removed monitor
- * </li></ul>
- */
- public void testRemove() {
- kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE);
-
- assertNotificationCorrect();
-
- for (int i = 0; i < kernelMonitors.length; i++) {
- MockKernelMonitor kernelMonitor = kernelMonitors[i];
- kernelMonitor.rest();
- }
-
- kernelMonitorBroadcaster.removeKernelMonitor(kernelMonitors[1]);
-
- kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE);
-
- for (int i = 0; i < kernelMonitors.length; i++) {
- MockKernelMonitor kernelMonitor = kernelMonitors[i];
- if (i == 1) {
- assertFalse(kernelMonitor.wasNotificationCalled());
- } else {
- assertTrue(kernelMonitor.wasNotificationCalled());
- }
- }
- }
-
- /**
- * Tests that no exceptions are thrown if an attempt is made to remove a monitor not registered.
- */
- public void testRemoveUnassociated() {
- kernelMonitorBroadcaster.removeKernelMonitor(new MockKernelMonitor("unassociated monitor"));
- }
-
- private static class MockKernelMonitor implements KernelMonitor {
- private final String name;
- private boolean notificationCalled = false;
-
- private MockKernelMonitor(String name) {
- this.name = name;
- }
-
- public String toString() {
- return name;
- }
-
- private void rest() {
- notificationCalled = false;
- }
-
- public boolean wasNotificationCalled() {
- return notificationCalled;
- }
-
- public void serviceNotificationError(ServiceMonitor serviceMonitor, ServiceEvent serviceEvent, Throwable throwable) {
- assertFalse(notificationCalled);
- notificationCalled = true;
- assertSame(SERVICE_MONITOR, serviceMonitor);
- assertSame(SERVICE_EVENT, serviceEvent);
- assertSame(THROWABLE, throwable);
- }
- }
-}
\ No newline at end of file
diff --git a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/ServiceStateTest.java b/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/ServiceStateTest.java
deleted file mode 100644
index a438350..0000000
--- a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/ServiceStateTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.rmi.MarshalledObject;
-import java.net.MalformedURLException;
-
-import junit.framework.TestCase;
-
-/**
- * Tests that the ServiceState constants are consistent.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceStateTest extends TestCase {
- /**
- * Tests that the constances are .equals to them selves and no other constants.
- */
- public void testEquals() {
- assertTrue(ServiceState.STARTING.equals(ServiceState.STARTING));
- assertFalse(ServiceState.STARTING.equals(ServiceState.RUNNING));
- assertFalse(ServiceState.STARTING.equals(ServiceState.STOPPING));
- assertFalse(ServiceState.STARTING.equals(ServiceState.STOPPED));
-
- assertFalse(ServiceState.RUNNING.equals(ServiceState.STARTING));
- assertTrue(ServiceState.RUNNING.equals(ServiceState.RUNNING));
- assertFalse(ServiceState.RUNNING.equals(ServiceState.STOPPING));
- assertFalse(ServiceState.RUNNING.equals(ServiceState.STOPPED));
-
- assertFalse(ServiceState.STOPPING.equals(ServiceState.STARTING));
- assertFalse(ServiceState.STOPPING.equals(ServiceState.RUNNING));
- assertTrue(ServiceState.STOPPING.equals(ServiceState.STOPPING));
- assertFalse(ServiceState.STOPPING.equals(ServiceState.STOPPED));
-
- assertFalse(ServiceState.STOPPED.equals(ServiceState.STARTING));
- assertFalse(ServiceState.STOPPED.equals(ServiceState.RUNNING));
- assertFalse(ServiceState.STOPPED.equals(ServiceState.STOPPING));
- assertTrue(ServiceState.STOPPED.equals(ServiceState.STOPPED));
- }
-
- /**
- * Tests that the constants create a hashCode that is equal to their own hashCode an no other constants hashCode.
- */
- public void testHashCode() {
- assertTrue(ServiceState.STARTING.hashCode() == ServiceState.STARTING.hashCode());
- assertFalse(ServiceState.STARTING.hashCode() == ServiceState.RUNNING.hashCode());
- assertFalse(ServiceState.STARTING.hashCode() == ServiceState.STOPPING.hashCode());
- assertFalse(ServiceState.STARTING.hashCode() == ServiceState.STOPPED.hashCode());
-
- assertFalse(ServiceState.RUNNING.hashCode() == ServiceState.STARTING.hashCode());
- assertTrue(ServiceState.RUNNING.hashCode() == ServiceState.RUNNING.hashCode());
- assertFalse(ServiceState.RUNNING.hashCode() == ServiceState.STOPPING.hashCode());
- assertFalse(ServiceState.RUNNING.hashCode() == ServiceState.STOPPED.hashCode());
-
- assertFalse(ServiceState.STOPPING.hashCode() == ServiceState.STARTING.hashCode());
- assertFalse(ServiceState.STOPPING.hashCode() == ServiceState.RUNNING.hashCode());
- assertTrue(ServiceState.STOPPING.hashCode() == ServiceState.STOPPING.hashCode());
- assertFalse(ServiceState.STOPPING.hashCode() == ServiceState.STOPPED.hashCode());
-
- assertFalse(ServiceState.STOPPED.hashCode() == ServiceState.STARTING.hashCode());
- assertFalse(ServiceState.STOPPED.hashCode() == ServiceState.RUNNING.hashCode());
- assertFalse(ServiceState.STOPPED.hashCode() == ServiceState.STOPPING.hashCode());
- assertTrue(ServiceState.STOPPED.hashCode() == ServiceState.STOPPED.hashCode());
- }
-
- /**
- * Tests that getServiceState returns the same constant as the constant from which the index was gotten, and that
- * getServiceState throws an exception if an attempt is make to get an unknown constant.
- */
- public void testGetServiceState() {
- assertSame(ServiceState.STARTING, ServiceState.getServiceState(ServiceState.STARTING.getIndex()));
- assertSame(ServiceState.RUNNING, ServiceState.getServiceState(ServiceState.RUNNING.getIndex()));
- assertSame(ServiceState.STOPPING, ServiceState.getServiceState(ServiceState.STOPPING.getIndex()));
- assertSame(ServiceState.STOPPED, ServiceState.getServiceState(ServiceState.STOPPED.getIndex()));
-
- try {
- ServiceState.getServiceState(ServiceState.STOPPED.getIndex() + 1);
- fail("ServiceState.getServiceState(ServiceState.STOPPED.getIndex() + 1) should have thrown and exception");
- } catch (IllegalArgumentException expected) {
- // expected
- }
-
- try {
- ServiceState.getServiceState(ServiceState.STARTING.getIndex() - 1);
- fail("ServiceState.getServiceState(ServiceState.STARTING.getIndex() - 1) should have thrown and exception");
- } catch (IllegalArgumentException expected) {
- // expected
- }
- }
-
- /**
- * Tests that parseServiceState returns the same state when called with getName on a state, that it throws an exception
- * for an unknown state and that the parsing is done using a case insensitive match.
- */
- public void testParseServiceState() {
- assertSame(ServiceState.STARTING, ServiceState.parseServiceState(ServiceState.STARTING.getName()));
- assertSame(ServiceState.RUNNING, ServiceState.parseServiceState(ServiceState.RUNNING.getName()));
- assertSame(ServiceState.STOPPING, ServiceState.parseServiceState(ServiceState.STOPPING.getName()));
- assertSame(ServiceState.STOPPED, ServiceState.parseServiceState(ServiceState.STOPPED.getName()));
-
- try {
- ServiceState.parseServiceState("donkey");
- fail("ServiceState.parseServiceState(\"donkey\") should have thrown and exception");
- } catch (IllegalArgumentException expected) {
- // expected
- }
-
- assertSame(ServiceState.STARTING, ServiceState.parseServiceState("StARting"));
- assertSame(ServiceState.RUNNING, ServiceState.parseServiceState("running"));
- assertSame(ServiceState.STOPPING, ServiceState.parseServiceState("stoPPing"));
- assertSame(ServiceState.STOPPED, ServiceState.parseServiceState("StoppeD"));
- }
-
- /**
- * Tests that when a state is serialized an deserialized it returns the same state object. This test shoudl assure
- * that there is only one state instance with a specific index in existant at one time.
- * @throws Exception if a problem occurs
- */
- public void testSerialization() throws Exception {
- try {
- assertSame(ServiceState.STARTING, copyServiceState(ServiceState.STARTING));
- assertSame(ServiceState.RUNNING, copyServiceState(ServiceState.RUNNING));
- assertSame(ServiceState.STOPPING, copyServiceState(ServiceState.STOPPING));
- assertSame(ServiceState.STOPPED, copyServiceState(ServiceState.STOPPED));
- } catch (MalformedURLException ignore) {
- // TODO
- // Some people may have spaces in their classpath.
- // To fix this we need to register an RMI class loader, e.g.
- // org.apache.xbean.rmi.RMIClassLoaderSpiImpl, that handles spaces
- // in a classpath but this needs to be done at JVM startup.
- // Apparently when surefire allows forking of tests, we
- // can get this to work. Until then, we ingore this specific error.
- }
- }
-
- private ServiceState copyServiceState(ServiceState original) throws Exception {
- MarshalledObject marshalledObject = new MarshalledObject(original);
- return (ServiceState) marshalledObject.get();
- }
-}
diff --git a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/StaticServiceFactoryTest.java b/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/StaticServiceFactoryTest.java
deleted file mode 100644
index f2cad61..0000000
--- a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/StaticServiceFactoryTest.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import java.util.Set;
-import java.util.TreeSet;
-
-import junit.framework.TestCase;
-
-/**
- * Tests the StaticServiceFactory.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class StaticServiceFactoryTest extends TestCase {
- private static final Object SERVICE = new TreeSet();
- private static final ServiceContext SERVICE_CONTEXT = new MockServiceContext();
- private static final ServiceCondition START_CONDITION = new MockStartCondition();
- private static final ServiceCondition STOP_CONDITION = new MockStopCondition();
-
- /**
- * Tests that the constructor works when called with an Object and fails when called with null.
- */
- public void testConstructor() {
- new StaticServiceFactory(SERVICE);
- try {
- new StaticServiceFactory(null);
- fail("new StaticServiceFactory(null) should have thrown a NullPointerException");
- } catch (NullPointerException expected) {
- }
- }
-
- /**
- * Tests that create service returns the same object that was passed to the constructor.
- */
- public void testCreateService() {
- assertSame(SERVICE, new StaticServiceFactory(SERVICE).createService(SERVICE_CONTEXT));
- }
-
- /**
- * Tests that the service factory is not restartable.
- */
- public void testIsRestartable() {
- assertEquals(false, new StaticServiceFactory(SERVICE).isRestartable());
- }
-
- /**
- * Tests that geting and setting the enalbe flag.
- */
- public void testEnabled() {
- StaticServiceFactory serviceFactory = new StaticServiceFactory(SERVICE);
- assertEquals(true, serviceFactory.isEnabled());
- serviceFactory.setEnabled(false);
- assertEquals(false, serviceFactory.isEnabled());
- serviceFactory.setEnabled(true);
- assertEquals(true, serviceFactory.isEnabled());
- }
-
- /**
- * Tests getting and setting start and stop conditions.
- */
- public void testConditions() {
- StaticServiceFactory serviceFactory = new StaticServiceFactory(SERVICE);
-
- // get the dependency set
- Set dependencies = serviceFactory.getStartConditions();
- assertNotNull(dependencies);
- // it should be initially empty
- assertTrue(dependencies.isEmpty());
-
- serviceFactory.addStartCondition(START_CONDITION);
- // old dependency set should still be empty... it is a snapshot
- assertTrue(dependencies.isEmpty());
-
- // get a new dependency set
- dependencies = serviceFactory.getStartConditions();
- assertNotNull(dependencies);
- // should have our dependency in it
- assertEquals(1, dependencies.size());
- assertTrue(dependencies.contains(START_CONDITION));
-
- try {
- dependencies.clear();
- fail("dependencies.clear() should have thrown an Exception");
- } catch (Exception expected) {
- }
-
- // get the dependency set
- dependencies = serviceFactory.getStopConditions();
- assertNotNull(dependencies);
- // it should be initially empty
- assertTrue(dependencies.isEmpty());
-
- serviceFactory.addStopCondition(STOP_CONDITION);
- // old dependency set should still be empty... it is a snapshot
- assertTrue(dependencies.isEmpty());
-
- // get a new dependency set
- dependencies = serviceFactory.getStopConditions();
- assertNotNull(dependencies);
- // should have our dependency in it
- assertEquals(1, dependencies.size());
- assertTrue(dependencies.contains(STOP_CONDITION));
-
- try {
- dependencies.clear();
- fail("dependencies.clear() should have thrown an Exception");
- } catch (Exception expected) {
- }
- }
-
- /**
- * Tests that getTypes returns an array containing a single class which is the class of the service passed to the constuctor.
- */
- public void testGetTypes() {
- StaticServiceFactory serviceFactory = new StaticServiceFactory(SERVICE);
- Class[] types = serviceFactory.getTypes();
- assertNotNull(types);
- assertEquals(1, types.length);
- assertSame(SERVICE.getClass(), types[0]);
- }
-
- private static class MockServiceContext implements ServiceContext {
- public Kernel getKernel() {
- throw new UnsupportedOperationException();
- }
-
- public ServiceName getServiceName() {
- throw new UnsupportedOperationException();
- }
-
- public ClassLoader getClassLoader() {
- throw new UnsupportedOperationException();
- }
- }
-
- private static class MockStartCondition implements ServiceCondition {
- public void initialize(ServiceConditionContext context) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isSatisfied() {
- throw new UnsupportedOperationException();
- }
-
- public void destroy() {
- throw new UnsupportedOperationException();
- }
- }
-
- private static class MockStopCondition implements ServiceCondition {
- public void initialize(ServiceConditionContext context) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isSatisfied() {
- throw new UnsupportedOperationException();
- }
-
- public void destroy() {
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/StringServiceNameTest.java b/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/StringServiceNameTest.java
deleted file mode 100644
index a70a297..0000000
--- a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/StringServiceNameTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel;
-
-import junit.framework.TestCase;
-
-/**
- * Tests StringServiceName.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class StringServiceNameTest extends TestCase {
- /**
- * Tests that the constuctor works when passed a string and fails when passed null.
- */
- public void testConstructor() {
- new StringServiceName("foo");
-
- try {
- new StringServiceName(null);
- fail("new StringServiceName(null) should have thrown NullPointerException");
- } catch (NullPointerException expected) {
- }
- }
-
- /**
- * Tests that toString returns equivalent String as the one passed to the construcor.
- */
- public void testToString() {
- assertEquals("foo", new StringServiceName("foo").toString());
- }
-
- /**
- * Tests that equals works when comparing two names created with equivalent strings, and fails when not.
- */
- public void testEquals() {
- assertEquals(new StringServiceName("foo"), new StringServiceName("foo"));
- assertFalse(new StringServiceName("bar").equals(new StringServiceName("foo")));
- }
-
- /**
- * Tests that hashCode creates the same value when used on two names created with equivalent strings, and fails when not.
- */
- public void testHashCode() {
- assertEquals(new StringServiceName("foo").hashCode(), new StringServiceName("foo").hashCode());
- assertFalse(new StringServiceName("bar").hashCode() == new StringServiceName("foo").hashCode());
- }
-}
diff --git a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/ServiceManagerRegistryTest.java b/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/ServiceManagerRegistryTest.java
deleted file mode 100644
index 16ea8d8..0000000
--- a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/ServiceManagerRegistryTest.java
+++ /dev/null
@@ -1,897 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Arrays;
-import java.util.AbstractCollection;
-import java.util.AbstractSet;
-import java.util.Collection;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.io.Serializable;
-
-import edu.emory.mathcs.backport.java.util.concurrent.Callable;
-import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
-import edu.emory.mathcs.backport.java.util.concurrent.ExecutionException;
-import edu.emory.mathcs.backport.java.util.concurrent.FutureTask;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
-import junit.framework.TestCase;
-import org.apache.xbean.kernel.IllegalServiceStateException;
-import org.apache.xbean.kernel.KernelErrorsError;
-import org.apache.xbean.kernel.ServiceAlreadyExistsException;
-import org.apache.xbean.kernel.ServiceFactory;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.ServiceNotFoundException;
-import org.apache.xbean.kernel.ServiceRegistrationException;
-import org.apache.xbean.kernel.StaticServiceFactory;
-import org.apache.xbean.kernel.StopStrategies;
-import org.apache.xbean.kernel.StopStrategy;
-import org.apache.xbean.kernel.StringServiceName;
-import org.apache.xbean.kernel.UnsatisfiedConditionsException;
-import org.apache.xbean.kernel.NullServiceMonitor;
-
-/**
- * Test the ServiceManagerRegistry.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceManagerRegistryTest extends TestCase {
- private static final int TIMEOUT_DURATION = 5;
- private static final TimeUnit TIMEOUT_UNITS = TimeUnit.SECONDS;
-
- private static final StringServiceName SERVICE_NAME = new StringServiceName("Service");
- private static final StaticServiceFactory SERVICE_FACTORY = new StaticServiceFactory(new Object());
- private static final ClassLoader CLASS_LOADER = new URLClassLoader(new URL[0]);
- private static final Class[] EXPECTED_TYPES = new Class[] {
- TreeSet.class,
- AbstractSet.class,
- AbstractCollection.class,
- Object.class,
- SortedSet.class,
- Set.class,
- Collection.class,
- Cloneable.class,
- Serializable.class,
- List.class
- };
- private final MockServiceManager serviceManager = new MockServiceManager();
- private final MockServiceManagerFactory serviceManagerFactory = new MockServiceManagerFactory();
- private final ServiceManagerRegistry registry = new ServiceManagerRegistry(serviceManagerFactory);
-
- /**
- * Tests the initial state of the registry.
- */
- public void testInitialState() {
- assertFalse(registry.isRegistered(SERVICE_NAME));
- try {
- assertNull(registry.getServiceManager(SERVICE_NAME));
- fail("should have thrown an exception");
- } catch (ServiceNotFoundException expected) {
- // expected
- assertEquals(SERVICE_NAME, expected.getServiceName());
- }
- assertFalse(serviceManager.isInitializeCalled());
- assertFalse(serviceManager.isDestroyCalled());
- }
-
- /**
- * Test the registration and unregistration.
- * Strategy:
- * <ul><li>
- * Register a service
- * </li><li>
- * Verify the service was registered and callbacks were made
- * <ul><li>
- * Unregister the service
- * </li><li>
- * Verify the service was unregistered and callbacks were made
- * </li></ul>
- *
- * @throws Exception if there is a failure
- */
- public void testRegisterUnregister() throws Exception {
- register();
- unregister();
- }
-
- /**
- * Tests the destroy method.
- * Strategy:
- * <ul><li>
- * Register a service
- * </li><li>
- * Verify the service was registered and callbacks were made
- * <ul><li>
- * Destroy the registry
- * </li><li>
- * Verify the service was stopped and callbacks were made
- * </li></ul>
- *
- * @throws Exception if there is a failure
- */
- public void testDestroy() throws Exception {
- register();
- destroy();
- }
-
- /**
- * Tests that an exception is thrown if an attempt is made to register.
- *
- * @throws Exception if there is a failure
- */
- public void testDoubleRegister() throws Exception {
- register();
- try {
- registry.registerService(SERVICE_NAME, SERVICE_FACTORY, CLASS_LOADER);
- fail("should have thrown an exception");
- } catch (ServiceAlreadyExistsException expected) {
- // expected
- assertEquals(SERVICE_NAME, expected.getServiceName());
- }
- }
-
- /**
- * Test that an attempt to unregister a service that is not registered throws an exception.
- *
- * @throws Exception if there is a failure
- */
- public void testUnregisterUnknown() throws Exception {
- try {
- registry.unregisterService(SERVICE_NAME, StopStrategies.SYNCHRONOUS);
- } catch (ServiceNotFoundException expected) {
- // expected
- assertEquals(SERVICE_NAME, expected.getServiceName());
- }
- }
-
- /**
- * Tests that when the initialize method throws an exception the service is not registered.
- *
- * @throws Exception if there is a failure
- */
- public void testRegisterException() throws Exception {
- register(new Exception("register exception"));
- register(new RuntimeException("register runtime exception"));
- register(new Error("register error"));
- register();
- unregister();
- }
-
- /**
- * Tests that when the destroy method throws an exception the service is not unregistered.
- *
- * @throws Exception if there is a failure
- */
- public void testUnregisterException() throws Exception {
- register();
- unregister(new UnsatisfiedConditionsException("destroy exception", SERVICE_NAME, Collections.EMPTY_SET));
- unregister(new IllegalServiceStateException("destroy exception", SERVICE_NAME));
- unregister(new RuntimeException("destroy exception"));
- unregister(new Error("destroy exception"));
- unregister();
- }
-
- /**
- * Tests that when the destroy and/or stop methods throw an exception during registry destroy, that destruction
- * continues and the exceptions are thrown in a single KernelErrorsError.
- *
- * @throws Exception if there is a failure
- */
- public void testDestroyException() throws Exception {
- register();
- destroy(new UnsatisfiedConditionsException("destroy exception", SERVICE_NAME, Collections.EMPTY_SET), null);
- register();
- destroy(new RuntimeException("destroy exception"), null);
- register();
- destroy(new Error("destroy exception"), null);
- register();
- destroy(new UnsatisfiedConditionsException("destroy exception", SERVICE_NAME, Collections.EMPTY_SET), new UnsatisfiedConditionsException("destroy exception", SERVICE_NAME, Collections.EMPTY_SET));
- register();
- destroy(new RuntimeException("destroy exception"), new UnsatisfiedConditionsException("destroy exception", SERVICE_NAME, Collections.EMPTY_SET));
- register();
- destroy(new Error("destroy exception"), new UnsatisfiedConditionsException("destroy exception", SERVICE_NAME, Collections.EMPTY_SET));
- register();
- destroy(null, new UnsatisfiedConditionsException("destroy exception", SERVICE_NAME, Collections.EMPTY_SET));
- register();
- destroy(new UnsatisfiedConditionsException("destroy exception", SERVICE_NAME, Collections.EMPTY_SET), new IllegalServiceStateException("destroy exception", SERVICE_NAME));
- register();
- destroy(new RuntimeException("destroy exception"), new IllegalServiceStateException("destroy exception", SERVICE_NAME));
- register();
- destroy(new Error("destroy exception"), new IllegalServiceStateException("destroy exception", SERVICE_NAME));
- register();
- destroy(null, new IllegalServiceStateException("destroy exception", SERVICE_NAME));
- register();
- destroy(new UnsatisfiedConditionsException("destroy exception", SERVICE_NAME, Collections.EMPTY_SET), new RuntimeException("destroy exception"));
- register();
- destroy(new RuntimeException("destroy exception"), new RuntimeException("destroy exception"));
- register();
- destroy(new Error("destroy exception"), new RuntimeException("destroy exception"));
- register();
- destroy(null, new RuntimeException("destroy exception"));
- register();
- destroy(new UnsatisfiedConditionsException("destroy exception", SERVICE_NAME, Collections.EMPTY_SET), new Error("destroy exception"));
- register();
- destroy(new RuntimeException("destroy exception"), new Error("destroy exception"));
- register();
- destroy(new Error("destroy exception"), new Error("destroy exception"));
- register();
- destroy(null, new Error("destroy exception"));
- }
-
- /**
- * Tests that when a service manager blocks during registration, that the registry blocks isRegistered and
- * getServiceManager calls until the registration completes.
- *
- * @throws Exception if there is a failure
- */
- public void testRegisterWaiting() throws Exception {
- registerWaiting(null);
- }
-
- /**
- * Tests that when a service manager blocks during registration and then throws an exception, that the registry
- * blocks isRegistered and getServiceManager calls until the registration completes, and then returns the correct
- * values for an unregistered service.
- *
- * @throws Exception if there is a failure
- */
- public void testRegisterWaitingException() throws Exception {
- registerWaiting(new Exception("register exception"));
- registerWaiting(new RuntimeException("register runtime exception"));
- registerWaiting(new Error("register error"));
- }
-
- /**
- * Tests that when a blocking service throws an exception during registration a nother service can wait be waiting
- * to take over the registration from the failed thread.
- *
- * @throws Exception if there is a failure
- */
- public void testDoubleRegisterWaiting() throws Exception {
- // start thread to attempt to register but throw an exception
- FutureTask registerFailTask = registerWaitingTask(new Exception("register exception"));
-
- // start thread to successfully register
- final CountDownLatch registerStartedSignal = new CountDownLatch(1);
- final MockServiceManager newServiceManager = new MockServiceManager();
- newServiceManager.setWait();
- FutureTask registerTask = new FutureTask(new Callable() {
- public Object call() throws Exception {
- registerStartedSignal.countDown();
- register(null, newServiceManager);
- return Boolean.TRUE;
- }
- });
- Thread registerThread = new Thread(registerTask, "registerTask");
- registerThread.setDaemon(true);
- registerThread.start();
- registerStartedSignal.await(TIMEOUT_DURATION, TIMEOUT_UNITS);
-
- // sleep a bit to assure that the register thread entered the registry code
- Thread.sleep(100);
-
- // verify all are not done
- assertFalse(registerFailTask.isDone());
- assertFalse(registerTask.isDone());
-
- // finish register fail, and verify it failed
- serviceManager.signalExit();
- assertEquals(Boolean.FALSE, registerFailTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
-
- // verify success registration and verify itworked
- newServiceManager.signalExit();
- assertEquals(Boolean.TRUE, registerTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
- assertTrue(registry.isRegistered(SERVICE_NAME));
- assertEquals(newServiceManager, registry.getServiceManager(SERVICE_NAME));
- }
-
- /**
- * Tests that when a service manager blocks during unregistration, that the registry blocks isRegistered and
- * getServiceManager calls until the unregistration completes.
- *
- * @throws Exception if there is a failure
- */
- public void testUnregisterWaiting() throws Exception {
- register();
- unregisterWaiting(null);
- }
-
- /**
- * Tests that when a service manager blocks during unregistration and then throws an exception, that the registry
- * blocks isRegistered and getServiceManager calls until the unregistration completes, and then returns the correct
- * values for an unregistered service.
- *
- * @throws Exception if there is a failure
- */
- public void testUnregisterWaitingException() throws Exception {
- register();
- unregisterWaiting(new UnsatisfiedConditionsException("destroy exception", SERVICE_NAME, Collections.EMPTY_SET));
- unregisterWaiting(new IllegalServiceStateException("destroy exception", SERVICE_NAME));
- unregisterWaiting(new RuntimeException("destroy exception"));
- unregisterWaiting(new Error("destroy exception"));
- unregisterWaiting(null);
- }
-
- /**
- * Tests that when a service manager blocks during destroy, that the registry does not block isRegistered and
- * getServiceManager calls, and then returns the correct values for an unregistered service.
- *
- * @throws Exception if there is a failure
- */
- public void testDestroyWaiting() throws Exception {
- register();
-
- // start thread to destroy and wait
- FutureTask destroyTask = destroyWaitingTask();
-
- // verify all are not done
- assertFalse(destroyTask.isDone());
-
- // verify that the service already appears to be unregistered
- assertFalse(registry.isRegistered(SERVICE_NAME));
- try {
- assertNull(registry.getServiceManager(SERVICE_NAME));
- fail("should have thrown an exception");
- } catch (ServiceNotFoundException expected) {
- // expected
- assertEquals(SERVICE_NAME, expected.getServiceName());
- }
-
- // finish register
- serviceManager.signalExit();
-
- // verify registration worked
- assertEquals(Boolean.TRUE, destroyTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
- assertFalse(registry.isRegistered(SERVICE_NAME));
- try {
- assertNull(registry.getServiceManager(SERVICE_NAME));
- fail("should have thrown an exception");
- } catch (ServiceNotFoundException expected) {
- // expected
- assertEquals(SERVICE_NAME, expected.getServiceName());
- }
- }
-
- private void registerWaiting(Throwable throwable) throws Exception {
- // start thread to register and wait
- FutureTask registerTask = registerWaitingTask(throwable);
-
- // start thread to attempt getService
- FutureTask getServiceManagerTask = getServiceWaiting();
-
- // start thread to attempt isRegistered
- FutureTask isRegisteredTask = isRegisteredWaiting();
-
- // not necessary, but sleep a bit anyway
- Thread.sleep(100);
-
- // verify all are not done
- assertFalse(registerTask.isDone());
- assertFalse(getServiceManagerTask.isDone());
- assertFalse(isRegisteredTask.isDone());
-
- // finish register
- serviceManager.signalExit();
-
- if (throwable == null) {
- // verify registration worked
- assertEquals(Boolean.TRUE, registerTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
- assertTrue(registry.isRegistered(SERVICE_NAME));
- assertEquals(serviceManager, registry.getServiceManager(SERVICE_NAME));
-
- // verify waiting isRegistered worked
- assertEquals(Boolean.TRUE, isRegisteredTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
-
- // verify getServiceManager worked
- assertEquals(serviceManager, getServiceManagerTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
- } else {
- // verify registration failed
- assertEquals(Boolean.FALSE, registerTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
- assertFalse(registry.isRegistered(SERVICE_NAME));
- try {
- assertNull(registry.getServiceManager(SERVICE_NAME));
- fail("should have thrown an exception");
- } catch (ServiceNotFoundException expected) {
- // expected
- assertEquals(SERVICE_NAME, expected.getServiceName());
- }
-
- // verify waiting isRegistered worked
- assertEquals(Boolean.FALSE, isRegisteredTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
-
- // verify getServiceManager worked
- try {
- getServiceManagerTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS);
- fail("should have thrown an exception");
- } catch (ExecutionException e) {
- assertTrue(e.getCause() instanceof ServiceNotFoundException);
- ServiceNotFoundException serviceNotFoundException = (ServiceNotFoundException) e.getCause();
- assertSame(SERVICE_NAME, serviceNotFoundException.getServiceName());
- }
- }
- }
-
- private FutureTask registerWaitingTask(final Throwable throwable) throws InterruptedException {
- serviceManager.setWait();
- FutureTask registerTask = new FutureTask(new Callable() {
- public Object call() throws Exception {
- register(throwable);
- return Boolean.valueOf(throwable == null);
- }
- });
- Thread registerThread = new Thread(registerTask, throwable == null ? "registerTask" : "registerExceptionTask");
- registerThread.setDaemon(true);
- registerThread.start();
-
- // wait for register to block
- assertTrue(serviceManager.awaitEnterSignal());
- return registerTask;
- }
-
- private void unregisterWaiting(Throwable throwable) throws Exception {
- // start thread to unregister and wait
- FutureTask unregisterTask = unregisterWaitingTask(throwable);
-
- // start thread to attempt getService
- FutureTask getServiceManagerTask = getServiceWaiting();
-
- // start thread to attempt isRegistered
- FutureTask isRegisteredTask = isRegisteredWaiting();
-
- // not necessary, but sleep a bit anyway
- Thread.sleep(100);
-
- // verify all are not done
- assertFalse(unregisterTask.isDone());
- assertFalse(getServiceManagerTask.isDone());
- assertFalse(isRegisteredTask.isDone());
-
- // finish register
- serviceManager.signalExit();
-
- if (throwable == null) {
- // verify registration worked
- assertEquals(Boolean.TRUE, unregisterTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
- assertFalse(registry.isRegistered(SERVICE_NAME));
- try {
- assertNull(registry.getServiceManager(SERVICE_NAME));
- fail("should have thrown an exception");
- } catch (ServiceNotFoundException expected) {
- // expected
- assertEquals(SERVICE_NAME, expected.getServiceName());
- }
-
- // verify waiting isRegistered worked
- assertEquals(Boolean.FALSE, isRegisteredTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
-
- // verify getServiceManager worked
- try {
- getServiceManagerTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS);
- fail("should have thrown an exception");
- } catch (ExecutionException e) {
- assertTrue(e.getCause() instanceof ServiceNotFoundException);
- ServiceNotFoundException serviceNotFoundException = (ServiceNotFoundException) e.getCause();
- assertSame(SERVICE_NAME, serviceNotFoundException.getServiceName());
- }
- } else {
- // verify unregistration failed
- assertEquals(Boolean.FALSE, unregisterTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
- assertTrue(registry.isRegistered(SERVICE_NAME));
- assertEquals(serviceManager, registry.getServiceManager(SERVICE_NAME));
-
- // verify waiting isRegistered worked
- assertEquals(Boolean.TRUE, isRegisteredTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
-
- // verify getServiceManager worked
- assertEquals(serviceManager, getServiceManagerTask.get(TIMEOUT_DURATION, TIMEOUT_UNITS));
- }
- }
-
- private FutureTask unregisterWaitingTask(final Throwable throwable) throws InterruptedException {
- serviceManager.setWait();
- FutureTask unregisterTask = new FutureTask(new Callable() {
- public Object call() throws Exception {
- unregister(throwable);
- return Boolean.valueOf(throwable == null);
- }
- });
- Thread unregisterThread = new Thread(unregisterTask, throwable == null ? "unregisterTask" : "unregisterExceptionTask");
- unregisterThread.setDaemon(true);
- unregisterThread.start();
-
- // wait for register to block
- assertTrue(serviceManager.awaitEnterSignal());
- return unregisterTask;
- }
-
- private FutureTask destroyWaitingTask() throws InterruptedException {
- serviceManager.setWait();
- FutureTask unregisterTask = new FutureTask(new Callable() {
- public Object call() throws Exception {
- destroy();
- return Boolean.TRUE;
- }
- });
- Thread destroyThread = new Thread(unregisterTask, "destroyTask");
- destroyThread.setDaemon(true);
- destroyThread.start();
-
- // wait for register to block
- assertTrue(serviceManager.awaitEnterSignal());
- return unregisterTask;
- }
-
- private FutureTask getServiceWaiting() throws InterruptedException {
- final CountDownLatch getServiceManagerSignal = new CountDownLatch(1);
- FutureTask getServiceManagerTask = new FutureTask(new Callable() {
- public Object call() throws Exception {
- getServiceManagerSignal.countDown();
- return registry.getServiceManager(SERVICE_NAME);
- }
- });
- Thread getServiceManagerThread = new Thread(getServiceManagerTask, "getServiceManagerTask");
- getServiceManagerThread.setDaemon(true);
- getServiceManagerThread.start();
-
- // wait for thread started
- getServiceManagerSignal.await(TIMEOUT_DURATION, TIMEOUT_UNITS);
- return getServiceManagerTask;
- }
-
- private FutureTask isRegisteredWaiting() throws InterruptedException {
- final CountDownLatch isRegisteredSignal = new CountDownLatch(1);
- FutureTask isRegisteredTask = new FutureTask(new Callable() {
- public Object call() throws Exception {
- isRegisteredSignal.countDown();
- return Boolean.valueOf(registry.isRegistered(SERVICE_NAME));
- }
- });
- Thread isRegisteredThread = new Thread(isRegisteredTask, "isRegisteredTask");
- isRegisteredThread.setDaemon(true);
- isRegisteredThread.start();
-
- // wait for thread started
- isRegisteredSignal.await(TIMEOUT_DURATION, TIMEOUT_UNITS);
- return isRegisteredTask;
- }
-
- private void register() throws Exception {
- register(null, serviceManager);
- }
-
- private void register(Throwable throwable) throws Exception {
- register(throwable, serviceManager);
- }
-
- private void register(Throwable throwable, MockServiceManager serviceManager) throws Exception {
- serviceManager.reset();
- serviceManager.setInitializeException(throwable);
- serviceManagerFactory.addServiceManager(serviceManager);
- try {
- registry.registerService(SERVICE_NAME, SERVICE_FACTORY, CLASS_LOADER);
- assertNull(throwable);
- } catch (ServiceRegistrationException expected) {
- // expected
- assertSame(throwable, expected.getCause());
- assertSame(SERVICE_NAME, expected.getServiceName());
- }
-
- if (throwable == null) {
- assertTrue(registry.isRegistered(SERVICE_NAME));
- assertSame(serviceManager, registry.getServiceManager(SERVICE_NAME));
- for (int i = 0; i < EXPECTED_TYPES.length; i++) {
- assertSame(serviceManager, registry.getServiceManager(EXPECTED_TYPES[i]));
- assertTrue(registry.getServiceManagers(EXPECTED_TYPES[i]).contains(serviceManager));
- }
- } else {
- assertFalse(registry.isRegistered(SERVICE_NAME));
- try {
- assertNull(registry.getServiceManager(SERVICE_NAME));
- fail("should have thrown an exception");
- } catch (ServiceNotFoundException expected) {
- // expected
- assertEquals(SERVICE_NAME, expected.getServiceName());
- }
- for (int i = 0; i < EXPECTED_TYPES.length; i++) {
- assertNull(registry.getServiceManager(EXPECTED_TYPES[i]));
- assertTrue(registry.getServiceManagers(EXPECTED_TYPES[i]).isEmpty());
- }
- }
- assertTrue(serviceManager.isInitializeCalled());
- assertFalse(serviceManager.isDestroyCalled());
- }
-
- private void unregister() throws ServiceNotFoundException {
- unregister(null);
- }
-
- private void unregister(Throwable throwable) throws ServiceNotFoundException {
- serviceManager.reset();
- serviceManager.setDestroyException(throwable);
- try {
- registry.unregisterService(SERVICE_NAME, StopStrategies.SYNCHRONOUS);
- assertNull(throwable);
- } catch (ServiceRegistrationException expected) {
- // expected
- assertSame(SERVICE_NAME, expected.getServiceName());
- assertSame(throwable, expected.getCause());
- }
-
- if (throwable == null) {
- assertFalse(registry.isRegistered(SERVICE_NAME));
- try {
- assertNull(registry.getServiceManager(SERVICE_NAME));
- fail("should have thrown an exception");
- } catch (ServiceNotFoundException expected) {
- // expected
- assertEquals(SERVICE_NAME, expected.getServiceName());
- }
- for (int i = 0; i < EXPECTED_TYPES.length; i++) {
- assertNull(registry.getServiceManager(EXPECTED_TYPES[i]));
- assertTrue(registry.getServiceManagers(EXPECTED_TYPES[i]).isEmpty());
- }
- } else {
- assertTrue(registry.isRegistered(SERVICE_NAME));
- assertSame(serviceManager, registry.getServiceManager(SERVICE_NAME));
- for (int i = 0; i < EXPECTED_TYPES.length; i++) {
- assertSame(serviceManager, registry.getServiceManager(EXPECTED_TYPES[i]));
- assertTrue(registry.getServiceManagers(EXPECTED_TYPES[i]).contains(serviceManager));
- }
- }
- assertFalse(serviceManager.isInitializeCalled());
- assertTrue(serviceManager.isDestroyCalled());
- }
-
- private void destroy() {
- destroy(null, null);
- }
-
- private void destroy(Throwable stopException, Throwable destroyException) {
- serviceManager.reset();
- serviceManager.setStopException(stopException);
- serviceManager.setDestroyException(destroyException);
-
- try {
- registry.destroy();
- assertNull(stopException);
- assertNull(destroyException);
- } catch (KernelErrorsError kernelErrorsError) {
- List errors = new ArrayList(kernelErrorsError.getErrors());
- if (stopException != null) {
- assertTrue(errors.size() >= 3);
- assertTrue(errors.get(0) instanceof AssertionError);
- assertSame(stopException, ((AssertionError) errors.get(0)).getCause());
- assertTrue(errors.get(1) instanceof AssertionError);
- assertSame(stopException, ((AssertionError) errors.get(1)).getCause());
- assertTrue(errors.get(2) instanceof AssertionError);
- assertSame(stopException, ((AssertionError) errors.get(2)).getCause());
- errors = errors.subList(3, errors.size());
- }
-
- if (destroyException != null) {
- assertEquals(1, errors.size());
- assertTrue(errors.get(0) instanceof AssertionError);
- assertSame(destroyException, ((AssertionError) errors.get(0)).getCause());
- errors = Collections.EMPTY_LIST;
- }
-
- assertEquals(Collections.EMPTY_LIST, errors);
- }
-
- assertFalse(registry.isRegistered(SERVICE_NAME));
- try {
- assertNull(registry.getServiceManager(SERVICE_NAME));
- fail("should have thrown an exception");
- } catch (ServiceNotFoundException expected) {
- // expected
- assertEquals(SERVICE_NAME, expected.getServiceName());
- }
- assertFalse(serviceManager.isInitializeCalled());
- assertTrue(serviceManager.isStopCalled());
- assertTrue(serviceManager.isDestroyCalled());
- }
-
- private static class MockServiceManagerFactory extends ServiceManagerFactory {
- private final LinkedList serviceManagers = new LinkedList();
-
- private MockServiceManagerFactory() {
- super(null, null, null, 0, null);
- }
-
- public ServiceManager createServiceManager(long serviceId, ServiceName serviceName, ServiceFactory serviceFactory, ClassLoader classLoader) {
- assertEquals(SERVICE_NAME, serviceName);
- assertEquals(SERVICE_FACTORY, serviceFactory);
- assertEquals(CLASS_LOADER, classLoader);
- synchronized (serviceManagers) {
- return (ServiceManager) serviceManagers.removeFirst();
- }
- }
-
- public void addServiceManager(ServiceManager serviceManager) {
- synchronized (serviceManagers) {
- serviceManagers.add(serviceManager);
- }
- }
- }
-
- private static class MockServiceManager extends ServiceManager {
- private boolean initializeCalled;
- private boolean destroyCalled;
- private boolean stopCalled;
- private Throwable initializeException;
- private Throwable destroyException;
- private Throwable stopException;
- private CountDownLatch enterWaiting = new CountDownLatch(1);
- private CountDownLatch exitWaiting = new CountDownLatch(0);
- private static final Set TYPES = Collections.unmodifiableSet(new HashSet(Arrays.asList(
- new Class[] {TreeSet.class, List.class} )));
-
-
- private MockServiceManager() {
- super(null,
- 0,
- new StringServiceName("MockService"),
- new StaticServiceFactory(new Object()),
- null,
- new NullServiceMonitor(),
- 0,
- null);
- }
-
- private synchronized void reset() {
- initializeCalled = false;
- destroyCalled = false;
- stopCalled = false;
- initializeException = null;
- destroyException = null;
- stopException = null;
- }
-
- public Set getServiceTypes() {
- return TYPES;
- }
-
- public void initialize() throws IllegalServiceStateException, UnsatisfiedConditionsException, Exception {
- synchronized (this) {
- assertFalse(initializeCalled);
- initializeCalled = true;
- }
-
- signalEnter();
- awaitExitSignal();
-
- synchronized (this) {
- if (initializeException instanceof Exception) {
- throw (Exception) initializeException;
- } else if (initializeException instanceof Error) {
- throw (Error) initializeException;
- }
- }
- }
-
- public void destroy(StopStrategy stopStrategy) throws IllegalServiceStateException, UnsatisfiedConditionsException {
- synchronized (this) {
- assertFalse(destroyCalled);
- destroyCalled = true;
- }
-
- try {
- signalEnter();
- awaitExitSignal();
- } catch (InterruptedException e) {
- fail("destroyCondition.await() threw an exception");
- }
-
- synchronized (this) {
- if (destroyException instanceof UnsatisfiedConditionsException) {
- throw (UnsatisfiedConditionsException) destroyException;
- } else if (destroyException instanceof IllegalServiceStateException) {
- throw (IllegalServiceStateException) destroyException;
- } else if (destroyException instanceof RuntimeException) {
- throw (RuntimeException) destroyException;
- } else if (destroyException instanceof Error) {
- throw (Error) destroyException;
- }
- }
- }
-
- public synchronized boolean stop(StopStrategy stopStrategy) throws UnsatisfiedConditionsException {
- stopCalled = true;
-
- if (stopException instanceof UnsatisfiedConditionsException) {
- throw (UnsatisfiedConditionsException) stopException;
- } else if (stopException instanceof RuntimeException) {
- throw (RuntimeException) stopException;
- } else if (stopException instanceof Error) {
- throw (Error) stopException;
- }
- return true;
- }
-
- public synchronized boolean isInitializeCalled() {
- return initializeCalled;
- }
-
- public synchronized boolean isDestroyCalled() {
- return destroyCalled;
- }
-
- public synchronized boolean isStopCalled() {
- return stopCalled;
- }
-
- public synchronized void setInitializeException(Throwable initializeException) {
- this.initializeException = initializeException;
- }
-
- public synchronized void setDestroyException(Throwable destroyException) {
- this.destroyException = destroyException;
- }
-
- public synchronized void setStopException(Throwable stopException) {
- this.stopException = stopException;
- }
-
- public boolean awaitEnterSignal() throws InterruptedException {
- CountDownLatch signal;
- synchronized (this) {
- signal = enterWaiting;
- }
- boolean worked = signal.await(TIMEOUT_DURATION, TIMEOUT_UNITS);
- return worked;
- }
-
- private void signalEnter() {
- CountDownLatch signal;
- synchronized (this) {
- signal = enterWaiting;
- }
- signal.countDown();
- }
-
- public synchronized void setWait() {
- exitWaiting = new CountDownLatch(1);
- enterWaiting = new CountDownLatch(1);
- }
-
- public void signalExit() {
- CountDownLatch signal;
- synchronized (this) {
- signal = exitWaiting;
- }
- signal.countDown();
- }
-
- private void awaitExitSignal() throws InterruptedException {
- CountDownLatch signal;
- synchronized (this) {
- signal = exitWaiting;
- }
- signal.await(TIMEOUT_DURATION, TIMEOUT_UNITS);
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/ServiceManagerTest.java b/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/ServiceManagerTest.java
deleted file mode 100644
index 1b108eb..0000000
--- a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/ServiceManagerTest.java
+++ /dev/null
@@ -1,1723 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import edu.emory.mathcs.backport.java.util.concurrent.Callable;
-import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
-import edu.emory.mathcs.backport.java.util.concurrent.FutureTask;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
-import junit.framework.TestCase;
-import org.apache.xbean.kernel.ForcedStopException;
-import org.apache.xbean.kernel.IllegalServiceStateException;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.KernelMonitor;
-import org.apache.xbean.kernel.ServiceAlreadyExistsException;
-import org.apache.xbean.kernel.ServiceCondition;
-import org.apache.xbean.kernel.ServiceConditionContext;
-import org.apache.xbean.kernel.ServiceContext;
-import org.apache.xbean.kernel.ServiceEvent;
-import org.apache.xbean.kernel.ServiceFactory;
-import org.apache.xbean.kernel.ServiceMonitor;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.ServiceNotFoundException;
-import org.apache.xbean.kernel.ServiceRegistrationException;
-import org.apache.xbean.kernel.ServiceState;
-import org.apache.xbean.kernel.StartStrategies;
-import org.apache.xbean.kernel.StartStrategy;
-import org.apache.xbean.kernel.StaticServiceFactory;
-import org.apache.xbean.kernel.StopStrategies;
-import org.apache.xbean.kernel.StopStrategy;
-import org.apache.xbean.kernel.StringServiceName;
-import org.apache.xbean.kernel.UnregisterServiceException;
-import org.apache.xbean.kernel.UnsatisfiedConditionsException;
-
-/**
- * Test ServiceManager.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceManagerTest extends TestCase {
- private static final Object SERVICE = new Object();
- private final MockKernel kernel = new MockKernel();
- private final StringServiceName serviceName = new StringServiceName("Service");
- private final StringServiceName ownedServiceName = new StringServiceName("OwnedService");
- private final MockStartCondition startCondition = new MockStartCondition();
- private final MockStopCondition stopCondition = new MockStopCondition();
- private final MockServiceFactory serviceFactory = new MockServiceFactory();
- private final ClassLoader classLoader = new URLClassLoader(new URL[0]);
- private final MockServiceMonitor serviceMonitor = new MockServiceMonitor();
- private ServiceManager serviceManager;
-
- /**
- * Tests that the initial state of the service manager is as expected.
- */
- public void testInitialState() {
- assertSame(serviceName, serviceManager.getServiceName());
- assertSame(serviceFactory, serviceManager.getServiceFactory());
- assertSame(classLoader, serviceManager.getClassLoader());
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
- assertSame(ServiceState.STOPPED, serviceManager.getState());
- }
-
- /**
- * Tests that initialize and destroy work without exception.
- * @throws Exception if a problem occurs
- */
- public void testInitializeDestroy() throws Exception {
- initialize();
- destroy(StopStrategies.SYNCHRONOUS);
- initialize();
- destroy(StopStrategies.SYNCHRONOUS);
- }
-
- /**
- * Tests that start and stop work without exception.
- * @throws Exception if a problem occurs
- */
- public void testStartStop() throws Exception {
- startStop(StartStrategies.ASYNCHRONOUS, false);
- startStop(StartStrategies.SYNCHRONOUS, false);
- startStop(StartStrategies.UNREGISTER, false);
- startStop(StartStrategies.BLOCK, false);
-
- startStop(StartStrategies.ASYNCHRONOUS, false);
- startStop(StartStrategies.SYNCHRONOUS, false);
- startStop(StartStrategies.UNREGISTER, false);
- startStop(StartStrategies.BLOCK, false);
- }
-
- /**
- * Tests that startRecursive results in recursive start calls on the owned services.
- * @throws Exception if a problem occurs
- */
- public void testStartRecursive() throws Exception {
- startStop(StartStrategies.ASYNCHRONOUS, true);
- startStop(StartStrategies.SYNCHRONOUS, true);
- startStop(StartStrategies.UNREGISTER, true);
- startStop(StartStrategies.BLOCK, true);
-
- startStop(StartStrategies.ASYNCHRONOUS, true);
- startStop(StartStrategies.SYNCHRONOUS, true);
- startStop(StartStrategies.UNREGISTER, true);
- startStop(StartStrategies.BLOCK, true);
- }
-
- private void startStop(StartStrategy startStrategy, boolean recursive) throws Exception {
- start(recursive, startStrategy);
- stop(StopStrategies.SYNCHRONOUS);
-
- start(recursive, startStrategy);
- start(recursive, startStrategy);
- stop(StopStrategies.SYNCHRONOUS);
- stop(StopStrategies.SYNCHRONOUS);
- }
-
- /**
- * Tests how the start strategies respond when an Exception is thrown.
- * @throws Exception if a problem occurs
- */
- public void testStartException() throws Exception {
- startException(StartStrategies.ASYNCHRONOUS, false);
- startException(StartStrategies.SYNCHRONOUS, false);
- startException(StartStrategies.UNREGISTER, false);
- startException(StartStrategies.BLOCK, false);
-
- startException(StartStrategies.ASYNCHRONOUS, false);
- startException(StartStrategies.SYNCHRONOUS, false);
- startException(StartStrategies.UNREGISTER, false);
- startException(StartStrategies.BLOCK, false);
- }
-
- /**
- * Tests how startRecursive start strategies respond when an Exception is thrown.
- * @throws Exception if a problem occurs
- */
- public void testStartExceptionRecursive() throws Exception {
- startException(StartStrategies.ASYNCHRONOUS, true);
- startException(StartStrategies.SYNCHRONOUS, true);
- startException(StartStrategies.UNREGISTER, true);
- startException(StartStrategies.BLOCK, true);
-
- startException(StartStrategies.ASYNCHRONOUS, true);
- startException(StartStrategies.SYNCHRONOUS, true);
- startException(StartStrategies.UNREGISTER, true);
- startException(StartStrategies.BLOCK, true);
- }
-
- private void startException(StartStrategy startStrategy, boolean recursive) throws Exception {
- serviceFactory.throwExceptionFromCreate = true;
- try {
- start(recursive, startStrategy);
- } catch (MockCreateException e) {
- assertTrue(startStrategy == StartStrategies.SYNCHRONOUS || startStrategy == StartStrategies.BLOCK);
- assertEquals(serviceFactory.createException, e);
- } catch (UnregisterServiceException e) {
- assertEquals(StartStrategies.UNREGISTER, startStrategy);
- assertSame(serviceFactory.createException, e.getCause());
- assertEquals(serviceName, e.getServiceName());
- }
- stop(StopStrategies.SYNCHRONOUS);
- }
-
- /**
- * Tests how the start strategies respond when confronted with an unsatisfied start condition.
- * @throws Exception if a problem occurs
- */
- public void testStartWaiting() throws Exception {
- startWaiting(StartStrategies.ASYNCHRONOUS, false);
- startWaiting(StartStrategies.SYNCHRONOUS, false);
- startWaiting(StartStrategies.UNREGISTER, false);
-
- startWaiting(StartStrategies.ASYNCHRONOUS, false);
- startWaiting(StartStrategies.SYNCHRONOUS, false);
- startWaiting(StartStrategies.UNREGISTER, false);
- }
-
- /**
- * Tests how the startRecursive start strategies responed when confronted with an unsatisfied start condition.
- * @throws Exception
- */
- public void testStartWaitingRecursive() throws Exception {
- startWaiting(StartStrategies.ASYNCHRONOUS, true);
- startWaiting(StartStrategies.SYNCHRONOUS, true);
- startWaiting(StartStrategies.UNREGISTER, true);
-
- startWaiting(StartStrategies.ASYNCHRONOUS, true);
- startWaiting(StartStrategies.SYNCHRONOUS, true);
- startWaiting(StartStrategies.UNREGISTER, true);
- }
-
- private void startWaiting(StartStrategy startStrategy, boolean recursive) throws Exception {
- startCondition.satisfied = false;
- try {
- start(recursive, startStrategy);
- } catch (UnsatisfiedConditionsException e) {
- assertTrue(startStrategy == StartStrategies.SYNCHRONOUS);
- assertTrue(e.getUnsatisfiedConditions().contains(startCondition));
- assertEquals(serviceName, e.getServiceName());
- } catch (UnregisterServiceException e) {
- assertEquals(StartStrategies.UNREGISTER, startStrategy);
- assertEquals(serviceName, e.getServiceName());
- UnsatisfiedConditionsException cause = (UnsatisfiedConditionsException) e.getCause();
- assertTrue(cause.getUnsatisfiedConditions().contains(startCondition));
- assertEquals(serviceName, cause.getServiceName());
- }
- stop(StopStrategies.SYNCHRONOUS);
- }
-
-
- /**
- * Tests how the start strategies respond once a once unsatisfied start condition becomes satisfied.
- * @throws Exception if a problem occurs
- */
- public void testStartWaitingStart() throws Exception {
- startWaitingStart(StartStrategies.ASYNCHRONOUS, false);
- startWaitingStart(StartStrategies.SYNCHRONOUS, false);
- startWaitingStart(StartStrategies.UNREGISTER, false);
-
- startWaitingStart(StartStrategies.ASYNCHRONOUS, false);
- startWaitingStart(StartStrategies.SYNCHRONOUS, false);
- startWaitingStart(StartStrategies.UNREGISTER, false);
- }
-
- /**
- * Tests how startRecursive start strategies respond once a once unsatisfied start condition becomes satisfied.
- * @throws Exception if a problem occurs
- */
- public void testStartWaitingStartRecursive() throws Exception {
- startWaitingStart(StartStrategies.ASYNCHRONOUS, true);
- startWaitingStart(StartStrategies.SYNCHRONOUS, true);
- startWaitingStart(StartStrategies.UNREGISTER, true);
-
- startWaitingStart(StartStrategies.ASYNCHRONOUS, true);
- startWaitingStart(StartStrategies.SYNCHRONOUS, true);
- startWaitingStart(StartStrategies.UNREGISTER, true);
- }
-
- private void startWaitingStart(StartStrategy startStrategy, boolean recursive) throws Exception {
- startCondition.satisfied = recursive;
- try {
- start(recursive, startStrategy);
- } catch (UnsatisfiedConditionsException e) {
- assertTrue(startStrategy == StartStrategies.SYNCHRONOUS);
- assertTrue(e.getUnsatisfiedConditions().contains(startCondition));
- assertEquals(serviceName, e.getServiceName());
- } catch (UnregisterServiceException e) {
- assertEquals(StartStrategies.UNREGISTER, startStrategy);
- assertEquals(serviceName, e.getServiceName());
- UnsatisfiedConditionsException cause = (UnsatisfiedConditionsException) e.getCause();
- assertTrue(cause.getUnsatisfiedConditions().contains(startCondition));
- assertEquals(serviceName, cause.getServiceName());
- }
- try {
- start(recursive, startStrategy);
- } catch (UnsatisfiedConditionsException e) {
- assertTrue(startStrategy == StartStrategies.SYNCHRONOUS);
- assertTrue(e.getUnsatisfiedConditions().contains(startCondition));
- assertEquals(serviceName, e.getServiceName());
- } catch (UnregisterServiceException e) {
- assertEquals(StartStrategies.UNREGISTER, startStrategy);
- assertEquals(serviceName, e.getServiceName());
- UnsatisfiedConditionsException cause = (UnsatisfiedConditionsException) e.getCause();
- assertTrue(cause.getUnsatisfiedConditions().contains(startCondition));
- assertEquals(serviceName, cause.getServiceName());
- }
- startCondition.satisfied = true;
- start(recursive, startStrategy);
- start(recursive, startStrategy);
- stop(StopStrategies.SYNCHRONOUS);
- }
-
- /**
- * Tests the BLOCK start stragegy.
- * @throws Exception if a problem occurs
- */
- public void testBlockStartWaiting() throws Exception {
- startCondition.satisfied = false;
- startCondition.isSatisfiedSignal = new CountDownLatch(1);
- FutureTask startTask = new FutureTask(new Callable() {
- public Object call() throws Exception {
- start(false, StartStrategies.BLOCK);
- return Boolean.TRUE;
- }
- });
- Thread startThread = new Thread(startTask, "StartTask");
- startThread.setDaemon(true);
- startThread.start();
-
- // wait for the start thread to reach the startContion initialize method
- assertTrue(startCondition.isSatisfiedSignal.await(5, TimeUnit.SECONDS));
-
- // we should not have a service instance and be in the starting state
- assertSame(ServiceState.STARTING, serviceManager.getState());
- assertNull(serviceManager.getService());
- assertEquals(0, serviceManager.getStartTime());
- assertNotNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
- assertTrue(startCondition.initializeCalled);
- assertTrue(startCondition.isSatisfiedCalled);
- assertFalse(startCondition.destroyCalled);
-
- long now = System.currentTimeMillis();
- // introduce a bit of delay so subsequent times are much less likely to equal to not
- Thread.sleep(500);
-
- startCondition.satisfied = true;
- startCondition.context.setSatisfied();
-
- // wait for the start task to complete
- assertEquals(Boolean.TRUE, startTask.get(5, TimeUnit.SECONDS));
-
- // we should be running
- assertSame(ServiceState.RUNNING, serviceManager.getState());
- assertSame(SERVICE, serviceManager.getService());
- assertTrue(serviceManager.getStartTime() >= now);
- assertNotNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNotNull(serviceMonitor.running);
- assertNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
- assertTrue(startCondition.initializeCalled);
- assertTrue(startCondition.isSatisfiedCalled);
- assertFalse(startCondition.destroyCalled);
-
- stop(StopStrategies.SYNCHRONOUS);
- }
-
- /**
- * Tests how start responds when the service factory is not enabled.
- * @throws Exception if a problem occurs
- */
- public void testDisabledStart() throws Exception {
- disabledStart(StartStrategies.ASYNCHRONOUS);
- disabledStart(StartStrategies.SYNCHRONOUS);
- disabledStart(StartStrategies.UNREGISTER);
- disabledStart(StartStrategies.BLOCK);
-
- disabledStart(StartStrategies.ASYNCHRONOUS);
- disabledStart(StartStrategies.SYNCHRONOUS);
- disabledStart(StartStrategies.UNREGISTER);
- disabledStart(StartStrategies.BLOCK);
- }
-
- private void disabledStart(StartStrategy startStrategy) throws Exception {
- serviceFactory.setEnabled(false);
- try {
- serviceManager.start(false, startStrategy);
- fail("A disabled service should throw an IllegalServiceStateException from start");
- } catch (IllegalServiceStateException e) {
- // expected
- assertEquals(serviceName, e.getServiceName());
- }
-
- // move to starting disable, move to running, and try to restart
- serviceFactory.setEnabled(true);
- startCondition.satisfied = false;
- start(false, StartStrategies.ASYNCHRONOUS);
-
- serviceFactory.setEnabled(false);
- startCondition.satisfied = true;
- start(false, startStrategy);
- start(false, startStrategy);
- stop(StopStrategies.ASYNCHRONOUS);
- try {
- serviceManager.start(false, startStrategy);
- fail("A disabled service should throw an IllegalServiceStateException from start");
- } catch (IllegalServiceStateException e) {
- // expected
- assertEquals(serviceName, e.getServiceName());
- }
- }
-
- /**
- * Tests how the stop strategies respond when destroyService throws an Exception.
- * @throws Exception if a problem occurs
- */
- public void testStopException() throws Exception {
- stopException(StopStrategies.ASYNCHRONOUS);
- stopException(StopStrategies.SYNCHRONOUS);
- stopException(StopStrategies.FORCE);
- stopException(StopStrategies.BLOCK);
- }
-
- private void stopException(StopStrategy stopStrategy) throws Exception {
- serviceFactory.throwExceptionFromDestroy = true;
- start(false, StartStrategies.SYNCHRONOUS);
- stop(stopStrategy);
- }
-
- /**
- * Tests how the start and stop strategies work when both create and destroy throw exceptions.
- * @throws Exception if a problem occurs
- */
- public void testStartStopsException() throws Exception {
- startStopsException(StartStrategies.ASYNCHRONOUS, StopStrategies.ASYNCHRONOUS);
- startStopsException(StartStrategies.ASYNCHRONOUS, StopStrategies.SYNCHRONOUS);
- startStopsException(StartStrategies.ASYNCHRONOUS, StopStrategies.FORCE);
- startStopsException(StartStrategies.ASYNCHRONOUS, StopStrategies.BLOCK);
- startStopsException(StartStrategies.SYNCHRONOUS, StopStrategies.ASYNCHRONOUS);
- startStopsException(StartStrategies.SYNCHRONOUS, StopStrategies.SYNCHRONOUS);
- startStopsException(StartStrategies.SYNCHRONOUS, StopStrategies.FORCE);
- startStopsException(StartStrategies.SYNCHRONOUS, StopStrategies.BLOCK);
- startStopsException(StartStrategies.UNREGISTER, StopStrategies.ASYNCHRONOUS);
- startStopsException(StartStrategies.UNREGISTER, StopStrategies.SYNCHRONOUS);
- startStopsException(StartStrategies.UNREGISTER, StopStrategies.FORCE);
- startStopsException(StartStrategies.UNREGISTER, StopStrategies.BLOCK);
- startStopsException(StartStrategies.BLOCK, StopStrategies.ASYNCHRONOUS);
- startStopsException(StartStrategies.BLOCK, StopStrategies.SYNCHRONOUS);
- startStopsException(StartStrategies.BLOCK, StopStrategies.FORCE);
- startStopsException(StartStrategies.BLOCK, StopStrategies.BLOCK);
- }
-
- private void startStopsException(StartStrategy startStrategy, StopStrategy stopStrategy) throws Exception {
- serviceFactory.throwExceptionFromCreate = true;
- serviceFactory.throwExceptionFromDestroy = true;
- try {
- start(false, startStrategy);
- } catch (MockCreateException e) {
- assertTrue(startStrategy == StartStrategies.SYNCHRONOUS || startStrategy == StartStrategies.BLOCK);
- assertEquals(serviceFactory.createException, e);
- } catch (UnregisterServiceException e) {
- assertEquals(StartStrategies.UNREGISTER, startStrategy);
- assertEquals(serviceName, e.getServiceName());
- assertSame(serviceFactory.createException, e.getCause());
- }
- stop(stopStrategy);
- }
-
- /**
- * Tests how stop strategies respond when confronted with an unsatisfied stop condition.
- * @throws Exception if a problem occurs
- */
- public void testWaitingStop() throws Exception {
- waitingStop(StopStrategies.ASYNCHRONOUS);
- waitingStop(StopStrategies.SYNCHRONOUS);
- waitingStop(StopStrategies.FORCE);
- }
-
- private void waitingStop(StopStrategy stopStrategy) throws Exception {
- start(false, StartStrategies.SYNCHRONOUS);
- stopCondition.satisfied = false;
- try {
- stop(stopStrategy);
- } catch (UnsatisfiedConditionsException e) {
- assertTrue(stopStrategy == StopStrategies.SYNCHRONOUS);
- assertTrue(e.getUnsatisfiedConditions().contains(stopCondition));
- assertEquals(serviceName, e.getServiceName());
- }
- try {
- stop(stopStrategy);
- } catch (UnsatisfiedConditionsException e) {
- assertTrue(stopStrategy == StopStrategies.SYNCHRONOUS);
- assertTrue(e.getUnsatisfiedConditions().contains(stopCondition));
- assertEquals(serviceName, e.getServiceName());
- }
-
- stopCondition.satisfied = true;
- stop(stopStrategy);
- }
-
- /**
- * Tests the BLOCK stop strategy.
- * @throws Exception if a problem occurs
- */
- public void testBlockStopWaiting() throws Exception {
- start(false, StartStrategies.SYNCHRONOUS);
- stopCondition.satisfied = false;
- stopCondition.isStatisfiedSignal = new CountDownLatch(1);
- FutureTask stopTask = new FutureTask(new Callable() {
- public Object call() throws Exception {
- stop(StopStrategies.BLOCK);
- return Boolean.TRUE;
- }
- });
- Thread stopThread = new Thread(stopTask, "StopTask");
- stopThread.setDaemon(true);
- stopThread.start();
-
- // wait for the stop thread to reach the stopContion initialize method
- assertTrue(stopCondition.isStatisfiedSignal.await(5, TimeUnit.SECONDS));
-
- // we should blocked waiting to stop
- assertSame(ServiceState.STOPPING, serviceManager.getState());
- assertTrue(serviceManager.getStartTime() > 0);
- assertSame(SERVICE, serviceManager.getService());
- assertNull(serviceMonitor.waitingToStop);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
- assertNull(serviceMonitor.unregistered);
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertFalse(startCondition.destroyCalled);
- assertTrue(stopCondition.initializeCalled);
- assertTrue(stopCondition.isSatisfiedCalled);
- assertFalse(stopCondition.destroyCalled);
-
- // wait for the start task to complete
- stopCondition.satisfied = true;
- stopCondition.context.setSatisfied();
- assertEquals(Boolean.TRUE, stopTask.get(5, TimeUnit.SECONDS));
-
- // we should be STOPPED
- assertSame(ServiceState.STOPPED, serviceManager.getState());
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
- assertNotNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.waitingToStop);
- assertNull(serviceMonitor.stopError);
- assertNotNull(serviceMonitor.stopped);
- assertNull(serviceMonitor.unregistered);
- assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId());
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertTrue(startCondition.destroyCalled);
- assertTrue(stopCondition.initializeCalled);
- assertTrue(stopCondition.isSatisfiedCalled);
- assertTrue(stopCondition.destroyCalled);
- }
-
-
- /**
- * Tests that start throws an exception when the service is in the stoping state.
- * @throws Exception if a problem occurs
- */
- public void testStartFromStopping() throws Exception {
- startFromStopping(StartStrategies.ASYNCHRONOUS);
- startFromStopping(StartStrategies.SYNCHRONOUS);
- startFromStopping(StartStrategies.UNREGISTER);
- startFromStopping(StartStrategies.BLOCK);
- }
-
- private void startFromStopping(StartStrategy startStrategy) throws Exception {
- start(false, StartStrategies.ASYNCHRONOUS);
- stopCondition.satisfied = false;
- stop(StopStrategies.ASYNCHRONOUS);
- try {
- serviceManager.start(false, startStrategy);
- fail("Should have thrown an IllegalServiceStateException since start on a stopping service is an error");
- } catch (IllegalServiceStateException e) {
- // expected
- assertEquals(serviceName, e.getServiceName());
- }
- stopCondition.satisfied = true;
- stop(StopStrategies.ASYNCHRONOUS);
- }
-
- /**
- * Tests that a non-restartable servie is immedately started when initialized and stopped in destroy.
- * @throws Exception if a problem occurs
- */
- public void testNotRestartableInitDestroy() throws Exception {
- notRestartableInitDestroy(StopStrategies.ASYNCHRONOUS);
- notRestartableInitDestroy(StopStrategies.SYNCHRONOUS);
- notRestartableInitDestroy(StopStrategies.FORCE);
- notRestartableInitDestroy(StopStrategies.BLOCK);
- }
-
- private void notRestartableInitDestroy(StopStrategy stopStrategy) throws Exception {
- serviceFactory.restartable = false;
- initialize();
- destroy(stopStrategy);
- }
-
- /**
- * Tests how initialize on a non-restartable service responds when an Exception is thrown from create service.
- * @throws Exception if a problem occurs
- */
- public void testNotRestartableInitException() throws Exception {
- serviceFactory.throwExceptionFromCreate = true;
- serviceFactory.restartable = false;
- initialize();
- }
-
- /**
- * Tests how initialize on a non-restartable service responds when confronted with an unsatisfied start condition.
- * @throws Exception if a problem occurs
- */
- public void testNotRestartableInitWaiting() throws Exception {
- startCondition.satisfied = false;
- serviceFactory.restartable = false;
- initialize();
- }
-
- /**
- * Tests how initialize on a non-restartable service responds when the service factory is disabled.
- * @throws Exception if a problem occurs
- */
- public void testNotRestartableInitDisabled() throws Exception {
- serviceFactory.setEnabled(false);
- serviceFactory.restartable = false;
- initialize();
- }
-
- /**
- * Tests how destroy on a non-restartable service responds when destroyService throws an exception.
- * @throws Exception if a problem occurs
- */
- public void testNotRestartableDestroyException() throws Exception {
- notRestartableDestroyException(StopStrategies.ASYNCHRONOUS);
- notRestartableDestroyException(StopStrategies.SYNCHRONOUS);
- notRestartableDestroyException(StopStrategies.FORCE);
- notRestartableDestroyException(StopStrategies.BLOCK);
- }
-
- private void notRestartableDestroyException(StopStrategy stopStrategy) throws Exception {
- serviceFactory.throwExceptionFromDestroy = true;
- serviceFactory.restartable = false;
- initialize();
- destroy(stopStrategy);
- }
-
-
- /**
- * Tests how destroy on a non-restartable service responds when createService and destroyService throws an exception.
- * @throws Exception if a problem occurs
- */
- public void testNotRestartableInitDestroyException() throws Exception {
- notRestartableInitDestroyException(StopStrategies.ASYNCHRONOUS);
- notRestartableInitDestroyException(StopStrategies.SYNCHRONOUS);
- notRestartableInitDestroyException(StopStrategies.FORCE);
- notRestartableInitDestroyException(StopStrategies.BLOCK);
- }
-
- private void notRestartableInitDestroyException(StopStrategy stopStrategy) throws Exception {
- serviceFactory.throwExceptionFromCreate = true;
- serviceFactory.throwExceptionFromDestroy = true;
- serviceFactory.restartable = false;
- initialize();
- destroy(stopStrategy);
- }
-
- /**
- * Tests how destroy on a non-restartable service responds when confronted with an unsatisfied stop condition.
- * @throws Exception if a problem occurs
- */
- public void testNotRestartableWaitingStop() throws Exception {
- notRestartableWaitingDestroy(StopStrategies.ASYNCHRONOUS);
- notRestartableWaitingDestroy(StopStrategies.SYNCHRONOUS);
- notRestartableWaitingDestroy(StopStrategies.FORCE);
- }
-
- private void notRestartableWaitingDestroy(StopStrategy stopStrategy) throws Exception {
- serviceFactory.restartable = false;
- initialize();
- stopCondition.satisfied = false;
- destroy(stopStrategy);
- destroy(stopStrategy);
- stopCondition.satisfied = true;
- destroy(stopStrategy);
- }
-
- /**
- * Tests the BLOCK stop strategy on a non-restartable service.
- * @throws Exception if a problem occurs
- */
- public void testNotRestartableBlockWaitingStop() throws Exception {
- serviceFactory.restartable = false;
- initialize();
- stopCondition.satisfied = false;
- stopCondition.isStatisfiedSignal = new CountDownLatch(1);
- FutureTask destroyTask = new FutureTask(new Callable() {
- public Object call() throws Exception {
- destroy(StopStrategies.BLOCK);
- return Boolean.TRUE;
- }
- });
- Thread destroyThread = new Thread(destroyTask, "DestroyTask");
- destroyThread.setDaemon(true);
- destroyThread.start();
-
- // wait for the stop thread to reach the stopContion initialize method
- assertTrue(stopCondition.isStatisfiedSignal.await(5, TimeUnit.SECONDS));
-
- // we should blocked waiting to stop
- assertSame(ServiceState.RUNNING, serviceManager.getState());
- assertSame(serviceName, serviceManager.getServiceName());
- assertSame(serviceFactory, serviceManager.getServiceFactory());
- assertSame(classLoader, serviceManager.getClassLoader());
- assertTrue(serviceManager.getStartTime() > 0);
- assertNotNull(serviceManager.getService());
- assertNull(serviceMonitor.registered);
- assertNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.waitingToStop);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
- assertNull(serviceMonitor.unregistered);
-
- // wait for the destroy task to complete
- stopCondition.satisfied = true;
- stopCondition.context.setSatisfied();
- assertEquals(Boolean.TRUE, destroyTask.get(5, TimeUnit.SECONDS));
-
- // we should be STOPPED
- assertSame(ServiceState.STOPPED, serviceManager.getState());
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
- assertNull(serviceMonitor.registered);
- assertNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNotNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.waitingToStop);
- assertNull(serviceMonitor.stopError);
- assertNotNull(serviceMonitor.stopped);
- assertNotNull(serviceMonitor.unregistered);
- assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId());
- assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.unregistered.getEventId());
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertTrue(startCondition.destroyCalled);
- assertTrue(stopCondition.initializeCalled);
- assertTrue(stopCondition.isSatisfiedCalled);
- assertTrue(stopCondition.destroyCalled);
- }
-
- private void initialize() throws Exception {
- long now = System.currentTimeMillis();
- // introduce a bit of delay so subsequent times are much less likely to equal to not
- Thread.sleep(50);
-
- serviceMonitor.reset();
- startCondition.reset();
- stopCondition.reset();
- kernel.reset();
- try {
- serviceManager.initialize();
- } catch (MockCreateException e) {
- assertTrue(serviceFactory.throwExceptionFromCreate);
- assertSame(serviceFactory.createException, e);
- } catch (UnsatisfiedConditionsException e) {
- assertTrue(!startCondition.satisfied);
- assertTrue(e.getUnsatisfiedConditions().contains(startCondition));
- assertEquals(serviceName, e.getServiceName());
- } catch (IllegalServiceStateException e) {
- assertFalse(serviceFactory.isEnabled());
- assertEquals(serviceName, e.getServiceName());
- }
-
- assertSame(serviceName, serviceManager.getServiceName());
- assertSame(serviceFactory, serviceManager.getServiceFactory());
- assertSame(classLoader, serviceManager.getClassLoader());
-
- if (serviceFactory.restartable) {
- assertSame(ServiceState.STOPPED, serviceManager.getState());
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
- assertNotNull(serviceMonitor.registered);
- assertNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.waitingToStop);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
- assertNull(serviceMonitor.unregistered);
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertFalse(startCondition.destroyCalled);
- assertFalse(stopCondition.initializeCalled);
- assertFalse(stopCondition.isSatisfiedCalled);
- assertFalse(stopCondition.destroyCalled);
- } else if (!serviceFactory.isEnabled()) {
- assertSame(ServiceState.STOPPED, serviceManager.getState());
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
- assertNull(serviceMonitor.registered);
- assertNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
- assertNull(serviceMonitor.unregistered);
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertFalse(startCondition.destroyCalled);
- assertFalse(stopCondition.initializeCalled);
- assertFalse(stopCondition.isSatisfiedCalled);
- assertFalse(stopCondition.destroyCalled);
- } else if (!serviceFactory.throwExceptionFromCreate && startCondition.satisfied) {
- assertSame(ServiceState.RUNNING, serviceManager.getState());
- assertSame(SERVICE, serviceManager.getService());
- assertTrue(serviceManager.getStartTime() > now);
- assertNotNull(serviceMonitor.registered);
- assertNotNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNotNull(serviceMonitor.running);
- assertNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
- assertNull(serviceMonitor.unregistered);
- assertEquals(serviceMonitor.registered.getEventId() + 1, serviceMonitor.starting.getEventId());
- assertEquals(serviceMonitor.registered.getEventId() + 2, serviceMonitor.running.getEventId());
- assertTrue(startCondition.initializeCalled);
- assertTrue(startCondition.isSatisfiedCalled);
- assertFalse(startCondition.destroyCalled);
- assertFalse(stopCondition.initializeCalled);
- assertFalse(stopCondition.isSatisfiedCalled);
- assertFalse(stopCondition.destroyCalled);
- } else {
- assertSame(ServiceState.STOPPED, serviceManager.getState());
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
- assertNotNull(serviceMonitor.registered);
- assertNotNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNotNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.stopError);
- assertNotNull(serviceMonitor.stopped);
- assertNotNull(serviceMonitor.unregistered);
- assertEquals(serviceMonitor.registered.getEventId() + 1, serviceMonitor.starting.getEventId());
- assertEquals(serviceMonitor.registered.getEventId() + 2, serviceMonitor.stopping.getEventId());
- assertEquals(serviceMonitor.registered.getEventId() + 3, serviceMonitor.stopped.getEventId());
- assertEquals(serviceMonitor.registered.getEventId() + 4, serviceMonitor.unregistered.getEventId());
- assertTrue(startCondition.initializeCalled);
- assertTrue(startCondition.isSatisfiedCalled);
- assertTrue(startCondition.destroyCalled);
- assertFalse(stopCondition.initializeCalled);
- assertFalse(stopCondition.isSatisfiedCalled);
- assertFalse(stopCondition.destroyCalled);
- }
- }
-
- private void start(boolean recursive, StartStrategy startStrategy) throws Exception {
- ServiceState initialState = serviceManager.getState();
-
- long now = System.currentTimeMillis();
- // introduce a bit of delay so subsequent times are much less likely to equal to not
- Thread.sleep(50);
-
- serviceMonitor.reset();
- startCondition.reset();
- stopCondition.reset();
- kernel.reset();
- serviceManager.start(recursive, startStrategy);
-
- assertSame(serviceName, serviceManager.getServiceName());
- assertSame(serviceFactory, serviceManager.getServiceFactory());
- assertSame(classLoader, serviceManager.getClassLoader());
-
- // these events should never fire in response to start
- assertNull(serviceMonitor.registered);
- assertNull(serviceMonitor.waitingToStop);
- assertNull(serviceMonitor.unregistered);
-
- if (initialState == ServiceState.RUNNING) {
- //
- // We were alredy running so nothing should have happened
- //
- assertSame(ServiceState.RUNNING, serviceManager.getState());
- assertSame(SERVICE, serviceManager.getService());
- assertTrue(serviceManager.getStartTime() > 0);
- assertTrue(serviceManager.getStartTime() <= now);
-
- // verify expected events fired
- assertNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
-
- // check if recursive fired
- if (recursive) {
- assertEquals(1, kernel.startRecursive.size());
- assertTrue(kernel.startRecursive.contains(ownedServiceName));
- } else {
- assertTrue(kernel.startRecursive.isEmpty());
- }
-
- // start condition methods
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertFalse(startCondition.destroyCalled);
-
- // stop condition methods
- assertFalse(stopCondition.initializeCalled);
- assertFalse(stopCondition.isSatisfiedCalled);
- assertFalse(stopCondition.destroyCalled);
- } else if (!startCondition.satisfied) {
- //
- // watiting to start
- //
- assertTrue(initialState == ServiceState.STOPPED || initialState == ServiceState.STARTING);
-
- // we should have not a service instance and be in the starting state
- assertSame(ServiceState.STARTING, serviceManager.getState());
- assertNull(serviceManager.getService());
- assertEquals(0, serviceManager.getStartTime());
-
-
- // verify expected events fired
- assertNotNull(serviceMonitor.waitingToStart);
-
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
-
- // verify events fired in the correct order
- if (initialState == ServiceState.STOPPED) {
- assertEquals(serviceMonitor.starting.getEventId() + 1, serviceMonitor.waitingToStart.getEventId());
- }
-
- // our condition should be in the unsatisfied condition list
- assertNotNull(serviceMonitor.waitingToStart.getUnsatisfiedConditions());
- assertTrue(serviceMonitor.waitingToStart.getUnsatisfiedConditions().contains(startCondition));
-
- // check if recursive fired
- assertTrue(kernel.startRecursive.isEmpty());
-
- // start condition methods
- if (initialState == ServiceState.STOPPED) {
- assertTrue(startCondition.initializeCalled);
- } else {
- assertFalse(startCondition.initializeCalled);
- }
- assertTrue(startCondition.isSatisfiedCalled);
- assertFalse(startCondition.destroyCalled);
-
- // stop condition methods
- assertFalse(stopCondition.initializeCalled);
- assertFalse(stopCondition.isSatisfiedCalled);
- assertFalse(stopCondition.destroyCalled);
- } else if (!serviceFactory.throwExceptionFromCreate) {
- //
- // Normal transition to RUNNING from either STOPPED or STARTING
- //
- assertTrue(initialState == ServiceState.STOPPED || initialState == ServiceState.STARTING);
-
- // we should have a service instance and be in the running state
- assertSame(ServiceState.RUNNING, serviceManager.getState());
- assertSame(SERVICE, serviceManager.getService());
- assertTrue(serviceManager.getStartTime() > now);
-
- if (initialState == ServiceState.STOPPED) {
- assertNotNull(serviceMonitor.starting);
- } else {
- assertNull(serviceMonitor.starting);
- }
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNotNull(serviceMonitor.running);
- assertNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
-
- // verify events fired in the correct order
- if (initialState == ServiceState.STOPPED) {
- assertEquals(serviceMonitor.starting.getEventId() + 1, serviceMonitor.running.getEventId());
- }
-
- // check if recursive fired
- if (recursive) {
- assertEquals(1, kernel.startRecursive.size());
- assertTrue(kernel.startRecursive.contains(ownedServiceName));
- } else {
- assertTrue(kernel.startRecursive.isEmpty());
- }
-
- // start condition methods
- if (initialState == ServiceState.STOPPED) {
- assertTrue(startCondition.initializeCalled);
- } else {
- assertFalse(startCondition.initializeCalled);
- }
- assertTrue(startCondition.isSatisfiedCalled);
- assertFalse(startCondition.destroyCalled);
-
- // stop condition methods
- assertFalse(stopCondition.initializeCalled);
- assertFalse(stopCondition.isSatisfiedCalled);
- assertFalse(stopCondition.destroyCalled);
- } else {
- //
- // Throw an exception from the create method
- //
-
- // we should be stopped
- assertSame(ServiceState.STOPPED, serviceManager.getState());
- assertNull(serviceManager.getService());
- assertEquals(0, serviceManager.getStartTime());
-
- // verify expected events fired
- assertNotNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNotNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNotNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.stopError);
- assertNotNull(serviceMonitor.stopped);
-
- // verify events fired in the correct order
- assertEquals(serviceMonitor.starting.getEventId() + 1, serviceMonitor.startError.getEventId());
- assertEquals(serviceMonitor.starting.getEventId() + 2, serviceMonitor.stopping.getEventId());
- assertEquals(serviceMonitor.starting.getEventId() + 3, serviceMonitor.stopped.getEventId());
-
- // verify that the exception is in the reson field
- assertSame(serviceFactory.createException, serviceMonitor.startError.getCause());
-
- // check if recursive fired
- assertTrue(kernel.startRecursive.isEmpty());
-
- // start condition methods
- if (initialState == ServiceState.STOPPED) {
- assertTrue(startCondition.initializeCalled);
- } else {
- assertFalse(startCondition.initializeCalled);
- }
- assertTrue(startCondition.isSatisfiedCalled);
- assertTrue(startCondition.destroyCalled);
-
- // stop condition methods
- assertFalse(stopCondition.initializeCalled);
- assertFalse(stopCondition.isSatisfiedCalled);
- assertFalse(stopCondition.destroyCalled);
- }
- }
-
- private void stop(StopStrategy stopStrategy) throws Exception {
- serviceMonitor.reset();
- startCondition.reset();
- stopCondition.reset();
- kernel.reset();
- ServiceState initialState = serviceManager.getState();
- serviceManager.stop(stopStrategy);
-
- assertSame(serviceName, serviceManager.getServiceName());
- assertSame(serviceFactory, serviceManager.getServiceFactory());
- assertSame(classLoader, serviceManager.getClassLoader());
-
- // these events should never fire in response to start
- assertNull(serviceMonitor.registered);
- assertNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
-
- if (initialState == ServiceState.STOPPED) {
- //
- // We were alredy stopped so nothing should have happened
- //
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
- assertSame(ServiceState.STOPPED, serviceManager.getState());
-
- assertNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.waitingToStop);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
- assertNull(serviceMonitor.unregistered);
-
- // start condition methods
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertFalse(startCondition.destroyCalled);
-
- // stop condition methods
- assertFalse(stopCondition.initializeCalled);
- assertFalse(stopCondition.isSatisfiedCalled);
- assertFalse(stopCondition.destroyCalled);
- } else if (!stopCondition.satisfied && stopStrategy != StopStrategies.FORCE) {
- //
- // waiting to stop
- //
- assertSame(ServiceState.STOPPING, serviceManager.getState());
- assertTrue(serviceManager.getStartTime() > 0);
- assertSame(SERVICE, serviceManager.getService());
-
- // verify expected events fired
- if (initialState != ServiceState.STOPPING) {
- assertNotNull(serviceMonitor.stopping);
- }
- assertNotNull(serviceMonitor.waitingToStop);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
- assertNull(serviceMonitor.unregistered);
-
- // verify events fired in the correct order
- if (initialState != ServiceState.STOPPING) {
- assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.waitingToStop.getEventId());
- }
-
- // our condition should be in the unsatisfied condition list
- assertNotNull(serviceMonitor.waitingToStop.getUnsatisfiedConditions());
- assertTrue(serviceMonitor.waitingToStop.getUnsatisfiedConditions().contains(stopCondition));
-
- // start condition methods
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertFalse(startCondition.destroyCalled);
-
- // stop condition methods
- if (initialState == ServiceState.RUNNING) {
- assertTrue(stopCondition.initializeCalled);
- } else {
- assertFalse(stopCondition.initializeCalled);
- }
- assertTrue(stopCondition.isSatisfiedCalled);
- assertFalse(stopCondition.destroyCalled);
- } else if (!serviceFactory.throwExceptionFromDestroy) {
- //
- // Normal transition to STOPPED from either STARTING, RUNNING or STOPPING
- //
- assertSame(ServiceState.STOPPED, serviceManager.getState());
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
-
- // verify expected events fired
- if (initialState != ServiceState.STOPPING) {
- assertNotNull(serviceMonitor.stopping);
- }
- assertNull(serviceMonitor.waitingToStop);
- if (stopStrategy == StopStrategies.FORCE) {
- assertNotNull(serviceMonitor.stopError);
- ForcedStopException cause = (ForcedStopException) serviceMonitor.stopError.getCause();
- assertTrue(cause.getUnsatisfiedConditions().contains(stopCondition));
- assertEquals(serviceName, cause.getServiceName());
- } else {
- assertNull(serviceMonitor.stopError);
- }
- assertNotNull(serviceMonitor.stopped);
- assertNull(serviceMonitor.unregistered);
-
- // verify events fired in the correct order
- if (stopStrategy == StopStrategies.FORCE) {
- assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId());
- assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId());
- } else if (initialState != ServiceState.STOPPING) {
- assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId());
- }
-
- // start condition methods
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertTrue(startCondition.destroyCalled);
-
- // stop condition methods
- if (initialState == ServiceState.STOPPING) {
- assertFalse(stopCondition.initializeCalled);
- assertTrue(stopCondition.isSatisfiedCalled);
- assertTrue(stopCondition.destroyCalled);
- } else {
- assertTrue(stopCondition.initializeCalled);
- assertTrue(stopCondition.isSatisfiedCalled);
- assertTrue(stopCondition.destroyCalled);
- }
- } else {
- //
- // Throw an exception from the destroy method
- //
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
- assertSame(ServiceState.STOPPED, serviceManager.getState());
-
- // verify expected events fired
- if (initialState != ServiceState.STOPPING) {
- assertNotNull(serviceMonitor.stopping);
- }
- assertNull(serviceMonitor.waitingToStop);
- assertNotNull(serviceMonitor.stopError);
- assertNotNull(serviceMonitor.stopped);
- assertNull(serviceMonitor.unregistered);
-
- // verify events fired in the correct order
- if (initialState != ServiceState.STOPPING) {
- assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId());
- assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId());
- } else {
- assertEquals(serviceMonitor.stopError.getEventId() + 1, serviceMonitor.stopped.getEventId());
- }
-
- // verify that the exception is in the reson field
- assertSame(serviceFactory.destroyException, serviceMonitor.stopError.getCause());
-
- // start condition methods
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertTrue(startCondition.destroyCalled);
-
- // stop condition methods
- if (initialState == ServiceState.RUNNING) {
- assertTrue(stopCondition.initializeCalled);
- } else {
- assertFalse(stopCondition.initializeCalled);
- }
- assertTrue(stopCondition.isSatisfiedCalled);
- assertTrue(stopCondition.destroyCalled);
- }
- }
-
- private void destroy(StopStrategy stopStrategy) {
- ServiceState initialState = serviceManager.getState();
- serviceMonitor.reset();
- startCondition.reset();
- stopCondition.reset();
- kernel.reset();
- try {
- serviceManager.destroy(stopStrategy);
- } catch (IllegalServiceStateException e) {
- assertFalse(stopCondition.satisfied);
- assertSame(StopStrategies.ASYNCHRONOUS, stopStrategy);
- assertEquals(serviceName, e.getServiceName());
- } catch (UnsatisfiedConditionsException e) {
- assertFalse(stopCondition.satisfied);
- assertSame(StopStrategies.SYNCHRONOUS, stopStrategy);
- assertTrue(e.getUnsatisfiedConditions().contains(stopCondition));
- assertEquals(serviceName, e.getServiceName());
- }
-
- if (serviceFactory.restartable || initialState == ServiceState.STOPPED) {
- assertSame(ServiceState.STOPPED, serviceManager.getState());
- assertSame(serviceName, serviceManager.getServiceName());
- assertSame(serviceFactory, serviceManager.getServiceFactory());
- assertSame(classLoader, serviceManager.getClassLoader());
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
- // verify expected events fired
- assertNull(serviceMonitor.registered);
- assertNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.waitingToStop);
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
- assertNotNull(serviceMonitor.unregistered);
- } else if (!stopCondition.satisfied && stopStrategy != StopStrategies.FORCE) {
- assertSame(ServiceState.RUNNING, serviceManager.getState());
- assertSame(serviceName, serviceManager.getServiceName());
- assertSame(serviceFactory, serviceManager.getServiceFactory());
- assertSame(classLoader, serviceManager.getClassLoader());
- assertTrue(serviceManager.getStartTime() > 0);
- assertNotNull(serviceManager.getService());
- assertNull(serviceMonitor.registered);
- assertNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNull(serviceMonitor.stopping);
- if (stopStrategy == StopStrategies.ASYNCHRONOUS) {
- assertNotNull(serviceMonitor.waitingToStop);
- assertTrue(serviceMonitor.waitingToStop.getUnsatisfiedConditions().contains(stopCondition));
- } else {
- assertNull(serviceMonitor.waitingToStop);
- }
- assertNull(serviceMonitor.stopError);
- assertNull(serviceMonitor.stopped);
- assertNull(serviceMonitor.unregistered);
- } else if (!serviceFactory.throwExceptionFromDestroy) {
- assertSame(ServiceState.STOPPED, serviceManager.getState());
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
- assertNull(serviceMonitor.registered);
- assertNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNotNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.waitingToStop);
- if (!stopCondition.satisfied && stopStrategy == StopStrategies.FORCE) {
- assertNotNull(serviceMonitor.stopError);
- } else {
- assertNull(serviceMonitor.stopError);
- }
- assertNotNull(serviceMonitor.stopped);
- assertNotNull(serviceMonitor.unregistered);
- if (!stopCondition.satisfied && stopStrategy == StopStrategies.FORCE) {
- assertEquals(serviceMonitor.stopError.getEventId() + 1, serviceMonitor.stopping.getEventId());
- assertEquals(serviceMonitor.stopError.getEventId() + 2, serviceMonitor.stopped.getEventId());
- assertEquals(serviceMonitor.stopError.getEventId() + 3, serviceMonitor.unregistered.getEventId());
- } else {
- assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId());
- assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.unregistered.getEventId());
-
- }
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertTrue(startCondition.destroyCalled);
- // There is no way to determine if the init should have been called
- // stopCondition.initializeCalled
- assertTrue(stopCondition.isSatisfiedCalled);
- assertTrue(stopCondition.destroyCalled);
- } else {
- assertSame(ServiceState.STOPPED, serviceManager.getState());
- assertEquals(0, serviceManager.getStartTime());
- assertNull(serviceManager.getService());
- assertNull(serviceMonitor.registered);
- assertNull(serviceMonitor.starting);
- assertNull(serviceMonitor.waitingToStart);
- assertNull(serviceMonitor.startError);
- assertNull(serviceMonitor.running);
- assertNotNull(serviceMonitor.stopping);
- assertNull(serviceMonitor.waitingToStop);
- assertNotNull(serviceMonitor.stopError);
- assertNotNull(serviceMonitor.stopped);
- assertNotNull(serviceMonitor.unregistered);
- assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId());
- assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId());
- assertEquals(serviceMonitor.stopping.getEventId() + 3, serviceMonitor.unregistered.getEventId());
- assertFalse(startCondition.initializeCalled);
- assertFalse(startCondition.isSatisfiedCalled);
- assertTrue(startCondition.destroyCalled);
- assertTrue(stopCondition.initializeCalled);
- assertTrue(stopCondition.isSatisfiedCalled);
- assertTrue(stopCondition.destroyCalled);
- }
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- serviceManager = new ServiceManager(kernel,
- 0,
- serviceName,
- serviceFactory,
- classLoader,
- serviceMonitor,
- 10,
- TimeUnit.SECONDS);
- }
-
- private class MockServiceFactory extends StaticServiceFactory {
- private boolean restartable = true;
- private boolean throwExceptionFromCreate = false;
- private boolean throwExceptionFromDestroy = false;
- private MockCreateException createException;
- private MockDestroyException destroyException;
- private ServiceContext serviceContext;
-
- private MockServiceFactory() throws NullPointerException {
- super(SERVICE);
- }
-
- public Set getOwnedServices() {
- return Collections.singleton(ownedServiceName);
- }
-
- public boolean isRestartable() {
- return restartable;
- }
-
- public synchronized Set getStartConditions() {
- Set startConditions = new HashSet(super.getStartConditions());
- startConditions.add(startCondition);
- return startConditions;
- }
-
- public synchronized Set getStopConditions() {
- Set stopConditions = new HashSet(super.getStopConditions());
- stopConditions.add(stopCondition);
- return stopConditions;
- }
-
- public Object createService(ServiceContext serviceContext) {
- assertValidServiceContext(serviceContext);
- this.serviceContext = serviceContext;
-
- createException = new MockCreateException("MockCreateException");
- if (throwExceptionFromCreate) throw createException;
- return super.createService(serviceContext);
- }
-
- public void destroyService(ServiceContext serviceContext) {
- assertSame(this.serviceContext, serviceContext);
- assertValidServiceContext(serviceContext);
-
- destroyException = new MockDestroyException("MockDestroyException");
- if (throwExceptionFromDestroy) throw destroyException;
- super.destroyService(serviceContext);
- }
-
- private void assertValidServiceContext(ServiceContext serviceContext) {
- assertSame(serviceName, serviceContext.getServiceName());
- assertSame(kernel, serviceContext.getKernel());
- assertSame(classLoader, serviceContext.getClassLoader());
- }
-
- }
-
- private static class MockCreateException extends RuntimeException {
- private MockCreateException(String message) {
- super(message);
- }
- }
-
- private static class MockDestroyException extends RuntimeException {
- private MockDestroyException(String message) {
- super(message);
- }
- }
-
- private class MockStartCondition implements ServiceCondition {
- private boolean satisfied = true;
- private boolean initializeCalled = false;
- private boolean isSatisfiedCalled = false;
- private boolean destroyCalled = false;
- private ServiceConditionContext context;
- private CountDownLatch isSatisfiedSignal;
-
- private void reset() {
- initializeCalled = false;
- isSatisfiedCalled = false;
- destroyCalled = false;
- }
-
- public void initialize(ServiceConditionContext context) {
- assertValidServiceConditionContext(context);
- initializeCalled = true;
- this.context = context;
- }
-
- public boolean isSatisfied() {
- isSatisfiedCalled = true;
- if (isSatisfiedSignal != null) {
- isSatisfiedSignal.countDown();
- }
- return satisfied;
- }
-
- public void destroy() {
- destroyCalled = true;
- }
- }
-
- private class MockStopCondition implements ServiceCondition {
- private boolean satisfied = true;
- private boolean initializeCalled = false;
- private boolean isSatisfiedCalled = false;
- private boolean destroyCalled = false;
- private ServiceConditionContext context;
- private CountDownLatch isStatisfiedSignal;
-
- private void reset() {
- initializeCalled = false;
- isSatisfiedCalled = false;
- destroyCalled = false;
- }
-
- public void initialize(ServiceConditionContext context) {
- assertValidServiceConditionContext(context);
- initializeCalled = true;
- this.context = context;
- }
-
- public boolean isSatisfied() {
- isSatisfiedCalled = true;
- if (isStatisfiedSignal != null) {
- isStatisfiedSignal.countDown();
- }
- return satisfied;
- }
-
- public void destroy() {
- destroyCalled = true;
- }
- }
-
- private void assertValidServiceConditionContext(ServiceConditionContext context) {
- assertSame(serviceName, context.getServiceName());
- assertSame(kernel, context.getKernel());
- assertSame(classLoader, context.getClassLoader());
- }
-
- private class MockServiceMonitor implements ServiceMonitor {
- private ServiceEvent registered;
- private ServiceEvent starting;
- private ServiceEvent waitingToStart;
- private ServiceEvent startError;
- private ServiceEvent running;
- private ServiceEvent stopping;
- private ServiceEvent waitingToStop;
- private ServiceEvent stopError;
- private ServiceEvent stopped;
- private ServiceEvent unregistered;
-
- private void reset() {
- registered = null;
- starting = null;
- waitingToStart = null;
- startError = null;
- running = null;
- stopping = null;
- waitingToStop = null;
- stopError = null;
- stopped = null;
- unregistered = null;
- }
-
- public void serviceRegistered(ServiceEvent serviceEvent) {
- registered = serviceEvent;
- assertValidEvent(serviceEvent, false);
- }
-
- public void serviceStarting(ServiceEvent serviceEvent) {
- starting = serviceEvent;
- assertValidEvent(serviceEvent, false);
- }
-
- public void serviceWaitingToStart(ServiceEvent serviceEvent) {
- waitingToStart = serviceEvent;
- assertValidEvent(serviceEvent, false);
- }
-
- public void serviceStartError(ServiceEvent serviceEvent) {
- startError = serviceEvent;
- assertValidEvent(serviceEvent, false);
- }
-
- public void serviceRunning(ServiceEvent serviceEvent) {
- running = serviceEvent;
- assertValidEvent(serviceEvent, true);
- }
-
- public void serviceStopping(ServiceEvent serviceEvent) {
- stopping = serviceEvent;
- assertValidEvent(serviceEvent, false);
- }
-
- public void serviceWaitingToStop(ServiceEvent serviceEvent) {
- waitingToStop = serviceEvent;
- assertValidEvent(serviceEvent, true);
- }
-
- public void serviceStopError(ServiceEvent serviceEvent) {
- stopError = serviceEvent;
- assertValidEvent(serviceEvent, false);
- }
-
- public void serviceStopped(ServiceEvent serviceEvent) {
- stopped = serviceEvent;
- assertValidEvent(serviceEvent, false);
- }
-
- public void serviceUnregistered(ServiceEvent serviceEvent) {
- unregistered = serviceEvent;
- assertValidEvent(serviceEvent, false);
- }
-
- private void assertValidEvent(ServiceEvent serviceEvent, boolean mustHaveService) {
- assertSame(serviceName, serviceEvent.getServiceName());
- assertSame(kernel, serviceEvent.getKernel());
- assertSame(classLoader, serviceEvent.getClassLoader());
- assertSame(serviceFactory, serviceEvent.getServiceFactory());
- if (mustHaveService) {
- assertSame(SERVICE, serviceEvent.getService());
- }
- }
- }
-
- private static class MockKernel implements Kernel {
- private List startRecursive = new LinkedList();
-
- private void reset() {
- startRecursive.clear();
- }
-
- public void startServiceRecursive(ServiceName serviceName) throws ServiceNotFoundException, IllegalStateException {
- startRecursive.add(serviceName);
- }
-
- public void startServiceRecursive(ServiceName serviceName, StartStrategy startStrategy) throws ServiceNotFoundException, IllegalServiceStateException, UnsatisfiedConditionsException, Exception {
- startRecursive.add(serviceName);
- }
-
- //
- // Unimplemented methods
- //
- public void waitForDestruction() {
- throw new UnsupportedOperationException();
- }
-
- public void startService(ServiceName serviceName) throws ServiceNotFoundException, IllegalStateException {
- throw new UnsupportedOperationException();
- }
-
- public void startService(ServiceName serviceName, StartStrategy startStrategy) throws ServiceNotFoundException, IllegalServiceStateException, UnsatisfiedConditionsException, Exception {
- throw new UnsupportedOperationException();
- }
-
- public void stopService(ServiceName serviceName) throws ServiceNotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public void stopService(ServiceName serviceName, StopStrategy stopStrategy) throws ServiceNotFoundException, UnsatisfiedConditionsException {
- throw new UnsupportedOperationException();
- }
-
- public void destroy() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isRunning() {
- throw new UnsupportedOperationException();
- }
-
- public String getKernelName() {
- throw new UnsupportedOperationException();
- }
-
- public void registerService(ServiceName serviceName, ServiceFactory serviceFactory, ClassLoader classLoader) throws ServiceAlreadyExistsException, ServiceRegistrationException {
- throw new UnsupportedOperationException();
- }
-
- public void unregisterService(ServiceName serviceName) throws ServiceNotFoundException, IllegalStateException {
- throw new UnsupportedOperationException();
- }
-
- public void unregisterService(ServiceName serviceName, StopStrategy stopStrategy) throws ServiceNotFoundException, ServiceRegistrationException {
- throw new UnsupportedOperationException();
- }
-
- public boolean isRegistered(ServiceName serviceName) {
- throw new UnsupportedOperationException();
- }
-
- public ServiceState getServiceState(ServiceName serviceName) throws ServiceNotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public long getServiceStartTime(ServiceName serviceName) throws ServiceNotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public boolean isServiceEnabled(ServiceName serviceName) throws ServiceNotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public void setServiceEnabled(ServiceName serviceName, boolean enabled) throws ServiceNotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public Object getService(ServiceName serviceName) throws ServiceNotFoundException, IllegalArgumentException {
- throw new UnsupportedOperationException();
- }
-
- public Object getService(Class type) {
- throw new UnsupportedOperationException();
- }
-
- public List getServices(Class type) {
- throw new UnsupportedOperationException();
- }
-
- public ServiceFactory getServiceFactory(ServiceName serviceName) throws ServiceNotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public ServiceFactory getServiceFactory(Class type) {
- throw new UnsupportedOperationException();
- }
-
- public List getServiceFactories(Class type) {
- throw new UnsupportedOperationException();
- }
-
- public ClassLoader getClassLoaderFor(ServiceName serviceName) throws ServiceNotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public void addKernelMonitor(KernelMonitor kernelMonitor) {
- throw new UnsupportedOperationException();
- }
-
- public void removeKernelMonitor(KernelMonitor kernelMonitor) {
- throw new UnsupportedOperationException();
- }
-
- public void addServiceMonitor(ServiceMonitor serviceMonitor) {
- throw new UnsupportedOperationException();
- }
-
- public void addServiceMonitor(ServiceMonitor serviceMonitor, ServiceName serviceName) {
- throw new UnsupportedOperationException();
- }
-
- public void removeServiceMonitor(ServiceMonitor serviceMonitor) {
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/ServiceMonitorBroadcasterTest.java b/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/ServiceMonitorBroadcasterTest.java
deleted file mode 100644
index 9499ef9..0000000
--- a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/ServiceMonitorBroadcasterTest.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import junit.framework.TestCase;
-import org.apache.xbean.kernel.KernelErrorsError;
-import org.apache.xbean.kernel.KernelMonitor;
-import org.apache.xbean.kernel.NullServiceMonitor;
-import org.apache.xbean.kernel.ServiceEvent;
-import org.apache.xbean.kernel.ServiceMonitor;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.StaticServiceFactory;
-import org.apache.xbean.kernel.StringServiceName;
-
-/**
- * Tests ServiceMonitorBroadcaster.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceMonitorBroadcasterTest extends TestCase {
- private static final StandardKernel KERNEL = new StandardKernel("test");
- private static final StaticServiceFactory SERVICE_FACTORY = new StaticServiceFactory(new Object());
- private static final ClassLoader SYSTEM_CLASS_LOADER = ClassLoader.getSystemClassLoader();
-
- private static final int SERVICE_REGISTERED = 1 << 0;
- private static final int SERVICE_STARTING = 1 << 1;
- private static final int SERVICE_WAITING_TO_START = 1 << 2;
- private static final int SERVICE_START_ERROR = 1 << 3;
- private static final int SERVICE_RUNNING = 1 << 4;
- private static final int SERVICE_STOPPING = 1 << 5;
- private static final int SERVICE_WAITING_TO_STOP = 1 << 6;
- private static final int SERVICE_STOP_ERROR = 1 << 7;
- private static final int SERVICE_STOPPED = 1 << 8;
- private static final int SERVICE_UNREGISTERED = 1 << 9;
- private static final int[] NOTIFICATION_TYPES = new int[]{
- SERVICE_REGISTERED,
- SERVICE_STARTING,
- SERVICE_WAITING_TO_START,
- SERVICE_START_ERROR,
- SERVICE_RUNNING,
- SERVICE_STOPPING,
- SERVICE_WAITING_TO_STOP,
- SERVICE_STOP_ERROR,
- SERVICE_STOPPED,
- SERVICE_UNREGISTERED,
- };
-
-
- private static final int SERVICE_COUNT = 4;
- private static final ServiceName[] serviceName = new ServiceName[SERVICE_COUNT];
- private static final ServiceEvent[] serviceEvent = new ServiceEvent[SERVICE_COUNT];
- private final Set[] expectedMonitors = new Set[SERVICE_COUNT];
- private final Set[] unexpectedMonitors = new Set[SERVICE_COUNT];
-
- private final MockKernelMonitor kernelMonitor = new MockKernelMonitor();
- private final ServiceMonitorBroadcaster serviceMonitorBroadcaster = new ServiceMonitorBroadcaster(kernelMonitor);
- private MockServiceMonitor[] globalMonitors;
- private MockServiceMonitor[][] serviceMonitors;
- private MockServiceMonitor evenMonitor;
- private MockServiceMonitor oddMonitor;
-
- private Throwable throwable;
- private Throwable kernelThrowable;
-
- /**
- * Fires all events on every service and verifies.
- */
- public void testFireEvent() {
- fireAllEvents();
- }
-
- /**
- * Test that if a monitor is added more then once it only recieves the event once.
- * Strategy:
- * <ul><li>
- * Add a monitor several times
- * </li><li>
- * Fire all events and verify
- * </li></ul>
- */
- public void testMultipleAdd() {
- serviceMonitorBroadcaster.addServiceMonitor(globalMonitors[0], null);
- serviceMonitorBroadcaster.addServiceMonitor(globalMonitors[0], null);
- serviceMonitorBroadcaster.addServiceMonitor(globalMonitors[0], null);
- serviceMonitorBroadcaster.addServiceMonitor(serviceMonitors[1][0], serviceName[1]);
- serviceMonitorBroadcaster.addServiceMonitor(serviceMonitors[1][0], serviceName[1]);
- serviceMonitorBroadcaster.addServiceMonitor(serviceMonitors[1][0], serviceName[1]);
-
- fireAllEvents();
- }
-
- /**
- * Test that events are not fired to a monitor that has been removed.
- * Strategy:
- * </li><li>
- * Fire all events and verify
- * </li><li>
- * Removes some monitors
- * </li><li>
- * Fire all events and verify
- * </li></ul>
- */
- public void testRemove() {
- fireAllEvents();
-
- serviceMonitorBroadcaster.removeServiceMonitor(globalMonitors[0]);
- for (int i = 0; i < expectedMonitors.length; i++) {
- Set expectedMonitor = expectedMonitors[i];
- expectedMonitor.remove(globalMonitors[0]);
- }
- for (int i = 0; i < unexpectedMonitors.length; i++) {
- Set expectedMonitor = unexpectedMonitors[i];
- expectedMonitor.add(globalMonitors[0]);
- }
-
- serviceMonitorBroadcaster.removeServiceMonitor(serviceMonitors[1][0]);
- expectedMonitors[1].remove(serviceMonitors[1][0]);
- unexpectedMonitors[1].add(serviceMonitors[1][0]);
-
- fireAllEvents();
- }
-
- /**
- * Tests that no exceptions are thrown if an attempt is made to remove a monitor not registered.
- */
- public void testRemoveUnassociated() {
- serviceMonitorBroadcaster.removeServiceMonitor(new NullServiceMonitor());
- }
-
- /**
- * Test that when a service monitor throws a RuntimeException the kernel monitor is notified.
- * Strategy:
- * </li><li>
- * Set all monitors to throw a RuntimeException
- * </li><li>
- * Fire all events and verify
- * </li></ul>
- */
- public void testNotificationRuntimeException() {
- throwable = new RuntimeException("notification exception");
- fireAllEvents();
- }
-
- /**
- * Test that when a service monitor throws an Error the kernel monitor is notified.
- * Strategy:
- * </li><li>
- * Set all monitors to throw an Error
- * </li><li>
- * Fire all events and verify
- * </li></ul>
- */
- public void testNotificationError() {
- throwable = new Error("notification error");
- fireAllEvents();
- }
-
- /**
- * Tests that when a kernel monitor throws a RuntimeException that it is ignored.
- * </li><li>
- * Set all service monitors to throw a RuntimeException
- * </li><li>
- * Set kernel monitor to throw a RuntimeException
- * </li><li>
- * Fire all events and verify
- * </li></ul>
- */
- public void testKernelMonitorException() {
- throwable = new RuntimeException("notification exception");
- kernelThrowable = new RuntimeException("kernel exception");
- fireAllEvents();
- }
-
- /**
- * Tests that when a kernel monitor throws an Error that it is propagated back to call in a KernelErrorsError.
- * </li><li>
- * Set all service monitors to throw a RuntimeException
- * </li><li>
- * Set kernel monitor to throw an Error
- * </li><li>
- * Fire all events and verify
- * </li></ul>
- */
- public void testKernelMonitorError() {
- throwable = new RuntimeException("notification exception");
- kernelThrowable = new Error("kernel error");
- fireAllEvents();
- }
-
- private void fireAllEvents() {
- for (int serviceId = 0; serviceId < serviceEvent.length; serviceId++) {
- for (int j = 0; j < NOTIFICATION_TYPES.length; j++) {
- int notificationType = NOTIFICATION_TYPES[j];
- initMonitors(serviceId, throwable);
- fireEvent(serviceId, notificationType);
- assertNotificationCorrect(serviceId, notificationType);
- }
- }
- }
-
- private void initMonitors(int serviceId, Throwable throwable) {
- if (throwable != null) {
- kernelMonitor.init(expectedMonitors[serviceId], serviceEvent[serviceId], throwable, kernelThrowable);
- } else {
- kernelMonitor.init(Collections.EMPTY_SET, null, null, null);
-
- }
- for (Iterator iterator = expectedMonitors[serviceId].iterator(); iterator.hasNext();) {
- ((MockServiceMonitor) iterator.next()).init(serviceEvent[serviceId], throwable);
- }
- for (Iterator iterator = unexpectedMonitors[serviceId].iterator(); iterator.hasNext();) {
- ((MockServiceMonitor) iterator.next()).init(null, throwable);
- }
- }
-
- private void fireEvent(int serviceId, int notificationType) {
- try {
- if (notificationType == SERVICE_REGISTERED) {
- serviceMonitorBroadcaster.serviceRegistered(serviceEvent[serviceId]);
- } else if (notificationType == SERVICE_STARTING) {
- serviceMonitorBroadcaster.serviceStarting(serviceEvent[serviceId]);
- } else if (notificationType == SERVICE_WAITING_TO_START) {
- serviceMonitorBroadcaster.serviceWaitingToStart(serviceEvent[serviceId]);
- } else if (notificationType == SERVICE_START_ERROR) {
- serviceMonitorBroadcaster.serviceStartError(serviceEvent[serviceId]);
- } else if (notificationType == SERVICE_RUNNING) {
- serviceMonitorBroadcaster.serviceRunning(serviceEvent[serviceId]);
- } else if (notificationType == SERVICE_STOPPING) {
- serviceMonitorBroadcaster.serviceStopping(serviceEvent[serviceId]);
- } else if (notificationType == SERVICE_WAITING_TO_STOP) {
- serviceMonitorBroadcaster.serviceWaitingToStop(serviceEvent[serviceId]);
- } else if (notificationType == SERVICE_STOP_ERROR) {
- serviceMonitorBroadcaster.serviceStopError(serviceEvent[serviceId]);
- } else if (notificationType == SERVICE_STOPPED) {
- serviceMonitorBroadcaster.serviceStopped(serviceEvent[serviceId]);
- } else if (notificationType == SERVICE_UNREGISTERED) {
- serviceMonitorBroadcaster.serviceUnregistered(serviceEvent[serviceId]);
- } else {
- fail("Unknown notification type " + notificationType);
- }
- } catch (KernelErrorsError e) {
- assertEquals(e.getErrors().size(), expectedMonitors[serviceId].size());
- for (Iterator iterator = e.getErrors().iterator(); iterator.hasNext();) {
- assertEquals(kernelThrowable, iterator.next());
- }
- }
- }
-
- private void assertNotificationCorrect(int serviceId, int notificationType) {
- for (Iterator iterator = expectedMonitors[serviceId].iterator(); iterator.hasNext();) {
- MockServiceMonitor mockServiceMonitor = (MockServiceMonitor) iterator.next();
- assertEquals(notificationType, mockServiceMonitor.getCalled());
- }
- for (Iterator iterator = unexpectedMonitors[serviceId].iterator(); iterator.hasNext();) {
- MockServiceMonitor mockServiceMonitor = (MockServiceMonitor) iterator.next();
- assertEquals(0, mockServiceMonitor.getCalled());
- }
- assertTrue("Unfired service errors " + kernelMonitor.getExpectedServiceMonitors(), kernelMonitor.getExpectedServiceMonitors().isEmpty());
- }
-
- protected void setUp() throws Exception {
- super.setUp();
-
- // serviceNames
- for (int i = 0; i < serviceName.length; i++) {
- serviceName[i] = new StringServiceName("service-" + i);
- }
-
- // serviceEvents
- for (int i = 0; i < serviceEvent.length; i++) {
- serviceEvent[i] = createEvent(serviceName[i]);
- }
-
- // all monitors
- Set allMonitors = new LinkedHashSet();
-
- // global
- globalMonitors = createMonitors(2, "global");
- allMonitors.addAll(Arrays.asList(globalMonitors));
- for (int i = 0; i < globalMonitors.length; i++) {
- MockServiceMonitor gloalMonitor = globalMonitors[i];
- serviceMonitorBroadcaster.addServiceMonitor(gloalMonitor, null);
- }
-
- // service specific
- serviceMonitors = new MockServiceMonitor[SERVICE_COUNT][];
- for (int i = 0; i < serviceMonitors.length; i++) {
- serviceMonitors[i] = createMonitors(i, "service" + i);
- allMonitors.addAll(Arrays.asList(serviceMonitors[i]));
- for (int j = 0; j < serviceMonitors[i].length; j++) {
- MockServiceMonitor serviceMonitor = serviceMonitors[i][j];
- serviceMonitorBroadcaster.addServiceMonitor(serviceMonitor, serviceName[i]);
- }
- }
-
- // even numbered services
- evenMonitor = new MockServiceMonitor("even");
- allMonitors.add(evenMonitor);
- for (int i = 0; i < serviceName.length; i++) {
- if (i % 2 == 0) {
- serviceMonitorBroadcaster.addServiceMonitor(evenMonitor, serviceName[i]);
- }
-
- }
-
- // odd numbered services
- oddMonitor = new MockServiceMonitor("odd");
- allMonitors.add(oddMonitor);
- for (int i = 0; i < serviceName.length; i++) {
- if (i % 2 != 0) {
- serviceMonitorBroadcaster.addServiceMonitor(oddMonitor, serviceName[i]);
- }
-
- }
-
- // expected monitors
- for (int i = 0; i < expectedMonitors.length; i++) {
- expectedMonitors[i] = new LinkedHashSet();
- expectedMonitors[i].addAll(Arrays.asList(globalMonitors));
- expectedMonitors[i].addAll(Arrays.asList(serviceMonitors[i]));
- if (i % 2 == 0) {
- expectedMonitors[i].add(evenMonitor);
- } else {
- expectedMonitors[i].add(oddMonitor);
- }
- }
-
- // unexpected monitors
- for (int i = 0; i < unexpectedMonitors.length; i++) {
- unexpectedMonitors[i] = new LinkedHashSet(allMonitors);
- unexpectedMonitors[i].removeAll(expectedMonitors[i]);
- }
- }
-
- private MockServiceMonitor[] createMonitors(int count, String name) {
- MockServiceMonitor[] gloalMonitors = new MockServiceMonitor[count];
- for (int i = 0; i < gloalMonitors.length; i++) {
- gloalMonitors[i] = new MockServiceMonitor(name + "-" + i);
- }
- return gloalMonitors;
- }
-
- private static ServiceEvent createEvent(ServiceName serviceName) {
- return new ServiceEvent(0,
- KERNEL,
- serviceName,
- SERVICE_FACTORY,
- SYSTEM_CLASS_LOADER,
- null,
- null,
- null);
- }
-
- private static class MockServiceMonitor implements ServiceMonitor {
- private final String name;
- private int called;
- private ServiceEvent expectedEvent;
- private Throwable throwable;
-
- private MockServiceMonitor(String name) {
- this.name = name;
- }
-
- public String toString() {
- return name;
- }
-
- private void init(ServiceEvent expectedEvent, Throwable throwable) {
- this.expectedEvent = expectedEvent;
- this.throwable = throwable;
- called = 0;
- }
-
- public int getCalled() {
- return called;
- }
-
- public void serviceRegistered(ServiceEvent serviceEvent) {
- assertTrue("alread called", (called & SERVICE_REGISTERED) == 0);
- called |= SERVICE_REGISTERED;
- assertNotNull("call not expected", expectedEvent);
- assertSame("wrong event object", expectedEvent, serviceEvent);
- throwIfNecessary();
- }
-
- public void serviceStarting(ServiceEvent serviceEvent) {
- assertTrue("alread called", (called & SERVICE_STARTING) == 0);
- called |= SERVICE_STARTING;
- assertNotNull("call not expected", expectedEvent);
- assertSame("wrong event object", expectedEvent, serviceEvent);
- throwIfNecessary();
- }
-
- public void serviceWaitingToStart(ServiceEvent serviceEvent) {
- assertTrue("alread called", (called & SERVICE_WAITING_TO_START) == 0);
- called |= SERVICE_WAITING_TO_START;
- assertNotNull("call not expected", expectedEvent);
- assertSame("wrong event object", expectedEvent, serviceEvent);
- throwIfNecessary();
- }
-
- public void serviceStartError(ServiceEvent serviceEvent) {
- assertTrue("alread called", (called & SERVICE_START_ERROR) == 0);
- called |= SERVICE_START_ERROR;
- assertNotNull("call not expected", expectedEvent);
- assertSame("wrong event object", expectedEvent, serviceEvent);
- throwIfNecessary();
- }
-
- public void serviceRunning(ServiceEvent serviceEvent) {
- assertTrue("alread called", (called & SERVICE_RUNNING) == 0);
- called |= SERVICE_RUNNING;
- assertNotNull("call not expected", expectedEvent);
- assertSame("wrong event object", expectedEvent, serviceEvent);
- throwIfNecessary();
- }
-
- public void serviceStopping(ServiceEvent serviceEvent) {
- assertTrue("alread called", (called & SERVICE_STOPPING) == 0);
- called |= SERVICE_STOPPING;
- assertNotNull("call not expected", expectedEvent);
- assertSame("wrong event object", expectedEvent, serviceEvent);
- throwIfNecessary();
- }
-
- public void serviceWaitingToStop(ServiceEvent serviceEvent) {
- assertTrue("alread called", (called & SERVICE_WAITING_TO_STOP) == 0);
- called |= SERVICE_WAITING_TO_STOP;
- assertNotNull("call not expected", expectedEvent);
- assertSame("wrong event object", expectedEvent, serviceEvent);
- throwIfNecessary();
- }
-
- public void serviceStopError(ServiceEvent serviceEvent) {
- assertTrue("alread called", (called & SERVICE_STOP_ERROR) == 0);
- called |= SERVICE_STOP_ERROR;
- assertNotNull("call not expected", expectedEvent);
- assertSame("wrong event object", expectedEvent, serviceEvent);
- throwIfNecessary();
- }
-
- public void serviceStopped(ServiceEvent serviceEvent) {
- assertTrue("alread called", (called & SERVICE_STOPPED) == 0);
- called |= SERVICE_STOPPED;
- assertNotNull("call not expected", expectedEvent);
- assertSame("wrong event object", expectedEvent, serviceEvent);
- throwIfNecessary();
- }
-
- public void serviceUnregistered(ServiceEvent serviceEvent) {
- assertTrue("alread called", (called & SERVICE_UNREGISTERED) == 0);
- called |= SERVICE_UNREGISTERED;
- assertNotNull("call not expected", expectedEvent);
- assertSame("wrong event object", expectedEvent, serviceEvent);
- throwIfNecessary();
- }
-
- private void throwIfNecessary() {
- if (throwable instanceof RuntimeException) {
- throw (RuntimeException) throwable;
- } else if (throwable instanceof Error) {
- throw (Error) throwable;
- } else {
- assertNull(throwable);
- }
- }
- }
-
- private static class MockKernelMonitor implements KernelMonitor {
- private Set expectedServiceMonitors;
- private ServiceEvent expectedEvent;
- private Throwable expectedThrowable;
- private Throwable kernelThrowable;
-
- private void init(Set expectedServiceMonitors, ServiceEvent expectedEvent, Throwable expectedThrowable, Throwable kernelThrowable) {
- this.expectedServiceMonitors = new LinkedHashSet(expectedServiceMonitors);
- this.expectedEvent = expectedEvent;
- this.expectedThrowable = expectedThrowable;
- this.kernelThrowable = kernelThrowable;
- }
-
- public Set getExpectedServiceMonitors() {
- return expectedServiceMonitors;
- }
-
- public void serviceNotificationError(ServiceMonitor serviceMonitor, ServiceEvent serviceEvent, Throwable throwable) {
- assertNotNull(expectedEvent);
- assertTrue(expectedServiceMonitors.contains(serviceMonitor));
- expectedServiceMonitors.remove(serviceMonitor);
- assertSame(expectedEvent, serviceEvent);
- assertSame(expectedThrowable, throwable);
- throwIfNecessary();
- }
-
- private void throwIfNecessary() {
- if (kernelThrowable instanceof RuntimeException) {
- throw (RuntimeException) kernelThrowable;
- } else if (kernelThrowable instanceof Error) {
- throw (Error) kernelThrowable;
- } else {
- assertNull(kernelThrowable);
- }
- }
- }
-}
diff --git a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/StandardKernelTest.java b/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/StandardKernelTest.java
deleted file mode 100644
index eb9389f..0000000
--- a/trunk/xbean-kernel/src/test/java/org/apache/xbean/kernel/standard/StandardKernelTest.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.kernel.standard;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-
-import junit.framework.TestCase;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.ServiceNotFoundException;
-import org.apache.xbean.kernel.ServiceState;
-import org.apache.xbean.kernel.StartStrategies;
-import org.apache.xbean.kernel.StaticServiceFactory;
-import org.apache.xbean.kernel.StopStrategies;
-import org.apache.xbean.kernel.StringServiceName;
-
-/**
- * Tests the StandardKernel.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class StandardKernelTest extends TestCase {
- private static final Object SERVICE = new Object();
- private static final String KERNEL_NAME = "test";
- private final Kernel kernel = new StandardKernel(KERNEL_NAME);
- private final StringServiceName serviceName = new StringServiceName("Service");
-// private final StringServiceName ownedServiceName = new StringServiceName("OwnedService");
- private final MockServiceFactory serviceFactory = new MockServiceFactory();
- private final ClassLoader classLoader = new URLClassLoader(new URL[0]);
-
- /**
- * Tests the initial state of the kernel is as expected.
- * @throws Exception if a problem occurs
- */
- public void testInitialState() throws Exception {
- assertEquals(KERNEL_NAME, kernel.getKernelName());
- assertTrue(kernel.isRunning());
-
- assertFalse(kernel.isRegistered(serviceName));
- try {
- kernel.getServiceFactory(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.getClassLoaderFor(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.getServiceState(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.getService(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.getServiceStartTime(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.isServiceEnabled(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.startService(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.startService(serviceName, StartStrategies.ASYNCHRONOUS);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.startServiceRecursive(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.startServiceRecursive(serviceName, StartStrategies.ASYNCHRONOUS);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.stopService(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.stopService(serviceName, StopStrategies.ASYNCHRONOUS);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
-
- kernel.destroy();
- assertEquals(KERNEL_NAME, kernel.getKernelName());
- assertFalse(kernel.isRunning());
-
- assertFalse(kernel.isRegistered(serviceName));
- try {
- kernel.getServiceFactory(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.getClassLoaderFor(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.getServiceState(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.getService(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.getServiceStartTime(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.isServiceEnabled(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.startService(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.startService(serviceName, StartStrategies.ASYNCHRONOUS);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.startServiceRecursive(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.startServiceRecursive(serviceName, StartStrategies.ASYNCHRONOUS);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.stopService(serviceName);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- try {
- kernel.stopService(serviceName, StopStrategies.ASYNCHRONOUS);
- fail("expected exception");
- } catch (ServiceNotFoundException e) {
- // expected
- assertSame(serviceName, e.getServiceName());
- }
- }
-
- /**
- * Test the life cycle of a simple service.
- * @throws Exception if a problem occurs
- */
- public void testSimpleLifecycle() throws Exception {
- kernel.registerService(serviceName, serviceFactory, classLoader);
- assertTrue(kernel.isRegistered(serviceName));
- assertSame(serviceFactory, kernel.getServiceFactory(serviceName));
- assertSame(classLoader, kernel.getClassLoaderFor(serviceName));
- assertSame(ServiceState.STOPPED, kernel.getServiceState(serviceName));
- assertNull(kernel.getService(serviceName));
- assertEquals(0, kernel.getServiceStartTime(serviceName));
- assertTrue(kernel.isServiceEnabled(serviceName));
- }
-
- private static class MockServiceFactory extends StaticServiceFactory {
- private boolean restartable = true;
-
- private MockServiceFactory() throws NullPointerException {
- super(SERVICE);
- }
-
- public boolean isRestartable() {
- return restartable;
- }
- }
-}
diff --git a/trunk/xbean-osgi/LICENSE.txt b/trunk/xbean-osgi/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-osgi/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-osgi/NOTICE.txt b/trunk/xbean-osgi/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-osgi/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-osgi/pom.xml b/trunk/xbean-osgi/pom.xml
deleted file mode 100644
index 71b8b94..0000000
--- a/trunk/xbean-osgi/pom.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-osgi</artifactId>
- <name>XBean :: OSGi</name>
- <version>2.4-SNAPSHOT</version>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkMode>once</forkMode>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.equinox</groupId>
- <artifactId>osgi</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/Artifact.java b/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/Artifact.java
deleted file mode 100644
index 9c0737e..0000000
--- a/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/Artifact.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.osgi;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface Artifact {
- String getGroupId();
-
- String getArtifactId();
-
- String getVersion();
-
- String getType();
-}
diff --git a/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/BundleClassLoader.java b/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/BundleClassLoader.java
deleted file mode 100644
index 2feb070..0000000
--- a/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/BundleClassLoader.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.osgi;
-
-import org.osgi.framework.Bundle;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class BundleClassLoader extends ClassLoader {
- private final Bundle bundle;
-
- public BundleClassLoader(Bundle bundle) {
- this.bundle = bundle;
- }
-
- public Class loadClass(String name) throws ClassNotFoundException {
- return bundle.loadClass(name);
- }
-
- public URL getResource(String name) {
- return bundle.getResource(name);
- }
-
- protected Enumeration findResources(String name) throws IOException {
- return bundle.getResources(name);
- }
-}
diff --git a/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/Dependency.java b/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/Dependency.java
deleted file mode 100644
index 0637466..0000000
--- a/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/Dependency.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.osgi;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class Dependency implements Artifact {
- private final String groupId;
- private final String artifactId;
- private final String version;
- private final String type;
-
- public Dependency(String groupId, String artifactId, String version, String type) {
- this.groupId = groupId;
- this.artifactId = artifactId;
- this.version = version;
- this.type = type;
- }
-
- public String getGroupId() {
- return groupId;
- }
-
- public String getArtifactId() {
- return artifactId;
- }
-
- public String getVersion() {
- return version;
- }
-
- public String getType() {
- return type;
- }
-}
diff --git a/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/MavenBundleManager.java b/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/MavenBundleManager.java
deleted file mode 100644
index 868fb36..0000000
--- a/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/MavenBundleManager.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.osgi;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class MavenBundleManager {
- private final BundleContext bundleContext;
- private final File localRepository;
-
- public MavenBundleManager(BundleContext bundleContext, File localRepository) {
- this.bundleContext = bundleContext;
- this.localRepository = localRepository;
- }
-
- public Project loadProject(Artifact artifact) {
- if (artifact instanceof Project) {
- return (Project) artifact;
- } else {
- return new Project(artifact.getGroupId(),
- artifact.getArtifactId(),
- artifact.getVersion(),
- artifact.getType(),
- Collections.EMPTY_SET);
- }
- }
-
- public Project loadProject(String groupId, String artifactId, String version) {
- return new Project(groupId, artifactId, version, "jar", Collections.EMPTY_SET);
- }
-
- public Bundle installBundle(String groupId, String artifactId, String version) throws Exception {
- return installBundle(loadProject(groupId, artifactId, version));
- }
-
- public Bundle installBundle(Artifact artifact) throws Exception {
- String symbolicName = artifact.getGroupId() + "." + artifact.getArtifactId();
- String bundleVersion = coerceToOsgiVersion(artifact.getVersion());
-
- // check if we already loaded this bundle
- Bundle[] bundles = bundleContext.getBundles();
- for (int i = 0; i < bundles.length; i++) {
- Bundle bundle = bundles[i];
- if (symbolicName.equals(bundle.getSymbolicName()) &&
- bundleVersion.equals(bundle.getHeaders().get(Constants.BUNDLE_VERSION))) {
- return bundle;
- }
- }
-
- // load the project object model for this artiface
- Project project = loadProject(artifact);
-
- // build an OSGi manifest for the project
- Manifest manifest = createOsgiManifest(project);
-
- // create a jar in memory for the manifest
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- JarOutputStream jarOut = new JarOutputStream(out, manifest);
- jarOut.close();
- out.close();
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-
- // install the in memory jar
- Bundle bundle = bundleContext.installBundle(symbolicName, in);
-
- // install bundles for all of the dependencies
- for (Iterator iterator = project.getDependencies().iterator(); iterator.hasNext();) {
- Artifact dependency = (Artifact) iterator.next();
- installBundle(dependency);
- }
-
- return bundle;
- }
-
- public Manifest createOsgiManifest(Project project) throws IOException {
- String groupId = project.getGroupId();
- String artifactId = project.getArtifactId();
- String version = project.getVersion();
- String jar = groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/" + project.getJar();
-
- StringBuffer requireBundle = new StringBuffer();
- for (Iterator iterator = project.getDependencies().iterator(); iterator.hasNext();) {
- Artifact dependency = (Artifact) iterator.next();
- if (requireBundle.length() > 0) requireBundle.append(',');
-
- requireBundle.append(dependency.getGroupId()).append('.').append(dependency.getArtifactId());
- requireBundle.append(";visibility:=reexport;bundle-version:=").append(coerceToOsgiVersion(dependency.getVersion()));
-
- }
-
- String jarPath = new File(localRepository, jar).getAbsolutePath();
- StringBuffer exports = createExportList(jarPath);
-
- Manifest manifest = new Manifest();
- Attributes attributes = manifest.getMainAttributes();
- attributes.put(Attributes.Name.MANIFEST_VERSION, "1.0");
- attributes.putValue(Constants.BUNDLE_MANIFESTVERSION, "2");
- attributes.putValue(Constants.BUNDLE_VENDOR, groupId);
- attributes.putValue(Constants.BUNDLE_NAME, artifactId);
- attributes.putValue(Constants.BUNDLE_VERSION, coerceToOsgiVersion(version));
- attributes.putValue(Constants.BUNDLE_SYMBOLICNAME, groupId + "." + artifactId);
- attributes.putValue("Eclipse-AutoStart", "true");
-
-
- attributes.putValue(Constants.BUNDLE_CLASSPATH, ".,external:" + jarPath);
-
- attributes.putValue(Constants.EXPORT_PACKAGE, exports.toString());
- if (requireBundle != null && requireBundle.length() > 0) {
- attributes.putValue(Constants.REQUIRE_BUNDLE, requireBundle.toString());
- }
-
- return manifest;
- }
-
- private static String coerceToOsgiVersion(String version) {
- int partsFound = 0;
- String[] versionParts = new String[] { "0", "0", "0"};
- StringBuffer qualifier = new StringBuffer();
- for (StringTokenizer stringTokenizer = new StringTokenizer(version, ".-"); stringTokenizer.hasMoreTokens();) {
- String part = stringTokenizer.nextToken();
- if (partsFound < 4) {
- try {
- Integer.parseInt(part);
- versionParts[partsFound++] = part;
- } catch (NumberFormatException e) {
- partsFound = 4;
- qualifier.append(coerceToOsgiQualifier(part));
- }
- } else {
- if (qualifier.length() > 0) qualifier.append("_");
- qualifier.append(coerceToOsgiQualifier(part));
- }
- }
-
- StringBuffer osgiVersion = new StringBuffer();
- osgiVersion.append(versionParts[0]).append(".").append(versionParts[1]).append(".").append(versionParts[2]);
- if (qualifier.length() > 0) {
- osgiVersion.append(".").append(qualifier);
- }
- return osgiVersion.toString();
- }
-
- private static String coerceToOsgiQualifier(String qualifier) {
- char[] chars = qualifier.toCharArray();
- for (int i = 0; i < chars.length; i++) {
- char c = chars[i];
- if (!Character.isLetterOrDigit(c) && c != '_' && c != '-') {
- chars[i] = '_';
- }
- }
- return new String(chars);
- }
-
-
- private static StringBuffer createExportList(String jarPath) throws IOException {
- Set packages = new HashSet();
- FileInputStream in = null;
- try {
- in = new FileInputStream(jarPath);
- JarInputStream jarIn = new JarInputStream(in);
- for (JarEntry jarEntry = jarIn.getNextJarEntry(); jarEntry != null; jarEntry = jarIn.getNextJarEntry()) {
- String packageName = jarEntry.getName();
- if (!jarEntry.isDirectory()) {
- int index = packageName.lastIndexOf("/");
- // we can't export the default package
- if (index > 0) {
- packageName = packageName.substring(0, index);
- if (!packageName.equals("META-INF")) {
- packageName = packageName.replace('/', '.');
- packages.add(packageName);
- }
- }
- }
- }
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- }
- }
- }
-
- StringBuffer exports = new StringBuffer();
- for (Iterator iterator = packages.iterator(); iterator.hasNext();) {
- String packageName = (String) iterator.next();
- if (exports.length() > 0) exports.append(";");
- exports.append(packageName);
- }
- return exports;
- }
-}
diff --git a/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/Project.java b/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/Project.java
deleted file mode 100644
index 0a1fc00..0000000
--- a/trunk/xbean-osgi/src/main/java/org/apache/xbean/osgi/Project.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.osgi;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Collections;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class Project implements Artifact {
- private final String groupId;
- private final String artifactId;
- private final String version;
- private final String type;
- private final String jar;
- private final Set dependencies;
-
- public Project(String groupId, String artifactId, String version, String type, Set dependencies) {
- this(groupId, artifactId, version, type, artifactId + "-" + version + "." + type, dependencies);
- }
-
- public Project(String groupId, String artifactId, String version, String type, String jar, Set dependencies) {
- this.groupId = groupId;
- this.artifactId = artifactId;
- this.version = version;
- this.type = type;
- this.jar = jar;
-
- Set deps = new HashSet();
- for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) {
- Artifact dependency = (Artifact) iterator.next();
- deps.add(dependency);
- }
- this.dependencies = Collections.unmodifiableSet(deps);
- }
-
- public String getGroupId() {
- return groupId;
- }
-
- public String getArtifactId() {
- return artifactId;
- }
-
- public String getVersion() {
- return version;
- }
-
- public String getType() {
- return type;
- }
-
- public String getJar() {
- return jar;
- }
-
- public Set getDependencies() {
- return dependencies;
- }
-}
diff --git a/trunk/xbean-osgi/src/main/resources/META-INF/LICENSE b/trunk/xbean-osgi/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-osgi/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-osgi/src/main/resources/META-INF/NOTICE b/trunk/xbean-osgi/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-osgi/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-osgi/src/test/java/org/apache/xbean/osgi/OSGiTest.java b/trunk/xbean-osgi/src/test/java/org/apache/xbean/osgi/OSGiTest.java
deleted file mode 100644
index 2e4fe75..0000000
--- a/trunk/xbean-osgi/src/test/java/org/apache/xbean/osgi/OSGiTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.osgi;
-
-import junit.framework.TestCase;
-import org.eclipse.core.runtime.adaptor.EclipseAdaptor;
-import org.eclipse.core.runtime.adaptor.LocationManager;
-import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
-import org.eclipse.osgi.framework.internal.core.OSGi;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Bundle;
-
-import java.io.File;
-import java.util.Collections;
-import java.net.URLDecoder;
-
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class OSGiTest extends TestCase {
- private static final String basedir = System.getProperties().getProperty("basedir", ".");
- private OSGi osgi;
- private BundleContext bundleContext;
- private MavenBundleManager mavenBundleManager;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- System.setProperty("osgi.clean", "true");
-
- File osgiDir = new File(basedir, "target/osgi");
- osgiDir.mkdirs();
- System.setProperty("osgi.configuration.area", osgiDir.getAbsolutePath());
- System.setProperty("osgi.install.area", osgiDir.getAbsolutePath());
- System.setProperty("osgi.framework", URLDecoder.decode(EclipseAdaptor.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm(), "UTF-8"));
- LocationManager.initializeLocations();
-
- FrameworkAdaptor adaptor = new EclipseAdaptor(null);
- osgi = new OSGi(adaptor);
- osgi.launch();
- bundleContext = osgi.getBundleContext();
- mavenBundleManager = new MavenBundleManager(bundleContext, new File(System.getProperty("user.home"), ".m2/repository"));
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- osgi.shutdown();
- }
-
- public void testNothing() throws Exception {
- }
-
- public void XtestAddBundel() throws Exception {
- Project project;
- Bundle bundle;
- BundleClassLoader bundleClassLoader;
- Class clazz = null;
-
- project = mavenBundleManager.loadProject("org.springframework", "spring", "1.2.4");
- bundle = mavenBundleManager.installBundle(project);
- bundleClassLoader = new BundleClassLoader(bundle);
-
- clazz = bundle.loadClass("org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser");
- assertNotNull(clazz);
-
- clazz = bundleClassLoader.loadClass("org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser");
- assertNotNull(clazz);
-
- assertSame(bundle, mavenBundleManager.installBundle(project));
-
- project = new Project("org.apache.xbean",
- "xbean-spring",
- "2.1-SNAPSHOT",
- "jar",
- Collections.singleton(new Dependency("org.springframework", "spring", "1.2.4", "jar")));
- bundle = mavenBundleManager.installBundle(project);
- bundleClassLoader = new BundleClassLoader(bundle);
-
- clazz = bundle.loadClass("org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser");
- assertNotNull(clazz);
-
- clazz = bundleClassLoader.loadClass("org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser");
- assertNotNull(clazz);
-
- clazz = bundle.loadClass("org.apache.xbean.spring.context.impl.XBeanXmlBeanDefinitionParser");
- assertNotNull(clazz);
-
- clazz = bundleClassLoader.loadClass("org.apache.xbean.spring.context.impl.XBeanXmlBeanDefinitionParser");
- assertNotNull(clazz);
-
- assertSame(bundle, mavenBundleManager.installBundle(project));
- }
-}
diff --git a/trunk/xbean-oxm/LICENSE.txt b/trunk/xbean-oxm/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-oxm/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-oxm/NOTICE.txt b/trunk/xbean-oxm/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-oxm/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-oxm/pom.xml b/trunk/xbean-oxm/pom.xml
deleted file mode 100644
index dd4c0b9..0000000
--- a/trunk/xbean-oxm/pom.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-oxm</artifactId>
- <name>XBean :: Object to XML Matcher</name>
- <version>2.4-SNAPSHOT</version>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/trunk/xbean-oxm/src/main/resources/META-INF/LICENSE b/trunk/xbean-oxm/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-oxm/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-oxm/src/main/resources/META-INF/NOTICE b/trunk/xbean-oxm/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-oxm/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-reflect/pom.xml b/trunk/xbean-reflect/pom.xml
deleted file mode 100644
index 847813b..0000000
--- a/trunk/xbean-reflect/pom.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-reflect</artifactId>
- <name>XBean :: Reflect</name>
- <version>2.4-SNAPSHOT</version>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.4</source>
- <target>1.4</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/ClassLoading.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/ClassLoading.java
deleted file mode 100644
index ea9841c..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/ClassLoading.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean;
-
-import java.lang.reflect.Array;
-import java.util.HashMap;
-
-/**
- * Utility class for loading classes by a variety of name variations.
- * <p/>
- * Supported names types are:
- * <p/>
- * 1) Fully qualified class name (e.g., "java.lang.String", "org.apache.xbean.ClassLoading"
- * 2) Method signature encoding ("Ljava.lang.String;", "J", "I", etc.)
- * 3) Primitive type names ("int", "boolean", etc.)
- * 4) Method array signature strings ("[I", "[Ljava.lang.String")
- * 5) Arrays using Java code format ("int[]", "java.lang.String[][]")
- * <p/>
- * The classes are loaded using the provided class loader. For the basic types, the primitive
- * reflection types are returned.
- *
- * @version $Rev: 6685 $
- */
-public class ClassLoading {
-
- /**
- * Table for mapping primitive class names/signatures to the implementing
- * class object
- */
- private static final HashMap PRIMITIVE_CLASS_MAP = new HashMap();
-
- /**
- * Table for mapping primitive classes back to their name signature type, which
- * allows a reverse mapping to be performed from a class object into a resolvable
- * signature.
- */
- private static final HashMap CLASS_TO_SIGNATURE_MAP = new HashMap();
-
-
- /**
- * Setup the primitives map. We make any entry for each primitive class using both the
- * human readable name and the method signature shorthand type.
- */
- static {
- PRIMITIVE_CLASS_MAP.put("boolean", boolean.class);
- PRIMITIVE_CLASS_MAP.put("Z", boolean.class);
- PRIMITIVE_CLASS_MAP.put("byte", byte.class);
- PRIMITIVE_CLASS_MAP.put("B", byte.class);
- PRIMITIVE_CLASS_MAP.put("char", char.class);
- PRIMITIVE_CLASS_MAP.put("C", char.class);
- PRIMITIVE_CLASS_MAP.put("short", short.class);
- PRIMITIVE_CLASS_MAP.put("S", short.class);
- PRIMITIVE_CLASS_MAP.put("int", int.class);
- PRIMITIVE_CLASS_MAP.put("I", int.class);
- PRIMITIVE_CLASS_MAP.put("long", long.class);
- PRIMITIVE_CLASS_MAP.put("J", long.class);
- PRIMITIVE_CLASS_MAP.put("float", float.class);
- PRIMITIVE_CLASS_MAP.put("F", float.class);
- PRIMITIVE_CLASS_MAP.put("double", double.class);
- PRIMITIVE_CLASS_MAP.put("D", double.class);
- PRIMITIVE_CLASS_MAP.put("void", void.class);
- PRIMITIVE_CLASS_MAP.put("V", void.class);
-
- // Now build a reverse mapping table. The table above has a many-to-one mapping for
- // class names. To do the reverse, we need to pick just one. As long as the
- // returned name supports "round tripping" of the requests, this will work fine.
-
- CLASS_TO_SIGNATURE_MAP.put(boolean.class, "Z");
- CLASS_TO_SIGNATURE_MAP.put(byte.class, "B");
- CLASS_TO_SIGNATURE_MAP.put(char.class, "C");
- CLASS_TO_SIGNATURE_MAP.put(short.class, "S");
- CLASS_TO_SIGNATURE_MAP.put(int.class, "I");
- CLASS_TO_SIGNATURE_MAP.put(long.class, "J");
- CLASS_TO_SIGNATURE_MAP.put(float.class, "F");
- CLASS_TO_SIGNATURE_MAP.put(double.class, "D");
- CLASS_TO_SIGNATURE_MAP.put(void.class, "V");
-
- }
-
-
- /**
- * Load a class that matches the requested name, using the provided class loader context.
- * <p/>
- * The class name may be a standard class name, the name of a primitive type Java
- * reflection class (e.g., "boolean" or "int"), or a type in method type signature
- * encoding. Array classes in either encoding form are also processed.
- *
- * @param className The name of the required class.
- * @param classLoader The class loader used to resolve the class object.
- * @return The Class object resolved from "className".
- * @throws ClassNotFoundException When unable to resolve the class object.
- * @throws IllegalArgumentException If either argument is null.
- */
- public static Class loadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
-
- // the tests require IllegalArgumentExceptions for null values on either of these.
- if (className == null) {
- throw new IllegalArgumentException("className is null");
- }
-
- if (classLoader == null) {
- throw new IllegalArgumentException("classLoader is null");
- }
- // The easiest case is a proper class name. We just have the class loader resolve this.
- // If the class loader throws a ClassNotFoundException, then we need to check each of the
- // special name encodings we support.
- try {
- return classLoader.loadClass(className);
- } catch (ClassNotFoundException ignore) {
- // if not found, continue on to the other name forms.
- }
-
-
- // The second easiest version to resolve is a direct map to a primitive type name
- // or method signature. Check our name-to-class map for one of those.
- Class resolvedClass = (Class) PRIMITIVE_CLASS_MAP.get(className);
- if (resolvedClass != null) {
- return resolvedClass;
- }
-
- // Class names in method signature have the format "Lfully.resolved.name;",
- // so if it ends in a semicolon and begins with an "L", this must be in
- // this format. Have the class loader try to load this. There are no other
- // options if this fails, so just allow the class loader to throw the
- // ClassNotFoundException.
- if (className.endsWith(";") && className.startsWith("L")) {
- // pick out the name portion
- String typeName = className.substring(1, className.length() - 1);
- // and delegate the loading to the class loader.
- return classLoader.loadClass(typeName);
- }
-
- // All we have left now are the array types. Method signature array types
- // have a series of leading "[" characters to specify the number of dimensions.
- // The other array type we handle uses trailing "[]" for the dimensions, just
- // like the Java language syntax.
-
- // first check for the signature form ([[[[type).
- if (className.charAt(0) == '[') {
- // we have at least one array marker, now count how many leading '['s we have
- // to get the dimension count.
- int count = 0;
- int nameLen = className.length();
-
- while (count < nameLen && className.charAt(count) == '[') {
- count++;
- }
-
- // pull of the name subtype, which is everything after the last '['
- String arrayTypeName = className.substring(count, className.length());
- // resolve the type using a recursive call, which will load any of the primitive signature
- // types as well as class names.
- Class arrayType = loadClass(arrayTypeName, classLoader);
-
- // Resolving array types require a little more work. The array classes are
- // created dynamically when the first instance of a given dimension and type is
- // created. We need to create one using reflection to do this.
- return getArrayClass(arrayType, count);
- }
-
-
- // ok, last chance. Now check for an array specification in Java language
- // syntax. This will be a type name followed by pairs of "[]" to indicate
- // the number of dimensions.
- if (className.endsWith("[]")) {
- // get the base component class name and the arrayDimensions
- int count = 0;
- int position = className.length();
-
- while (position > 1 && className.substring(position - 2, position).equals("[]")) {
- // count this dimension
- count++;
- // and step back the probe position.
- position -= 2;
- }
-
- // position now points at the location of the last successful test. This makes it
- // easy to pick off the class name.
-
- String typeName = className.substring(0, position);
-
- // load the base type, again, doing this recursively
- Class arrayType = loadClass(typeName, classLoader);
- // and turn this into the class object
- return getArrayClass(arrayType, count);
- }
-
- // We're out of options, just toss an exception over the wall.
- throw new ClassNotFoundException(className);
- }
-
-
- /**
- * Map a class object back to a class name. The returned class object
- * must be "round trippable", which means
- * <p/>
- * type == ClassLoading.loadClass(ClassLoading.getClassName(type), classLoader)
- * <p/>
- * must be true. To ensure this, the class name is always returned in
- * method signature format.
- *
- * @param type The class object we convert into name form.
- * @return A string representation of the class name, in method signature
- * format.
- */
- public static String getClassName(Class type) {
- return getClassName(type, false);
- }
-
- public static String getClassName(Object instance) {
- return getClassName(instance, false);
- }
-
- public static String getClassName(Object instance, boolean pretty) {
- if (instance == null) {
- return "null";
- }
- return getClassName(instance.getClass(), pretty);
- }
-
- public static String getClassName(Class type, boolean pretty) {
- StringBuffer name = new StringBuffer();
-
- // we test these in reverse order from the resolution steps,
- // first handling arrays, then primitive types, and finally
- // "normal" class objects.
-
- // First handle arrays. If a class is an array, the type is
- // element stored at that level. So, for a 2-dimensional array
- // of ints, the top-level type will be "[I". We need to loop
- // down the hierarchy until we hit a non-array type.
- while (type.isArray()) {
- // add another array indicator at the front of the name,
- // and continue with the next type.
- name.append('[');
- if (pretty) name.append(']');
- type = type.getComponentType();
- }
-
- // we're down to the base type. If this is a primitive, then
- // we poke in the single-character type specifier.
- if (type.isPrimitive()) {
- if (pretty) {
- name.insert(0, type.getName());
- } else {
- name.append((String) CLASS_TO_SIGNATURE_MAP.get(type));
- }
- }
- // a "normal" class. This gets expressing using the "Lmy.class.name;" syntax.
- else {
- if (pretty) {
- name.insert(0, type.getName());
- } else {
- name.append('L');
- name.append(type.getName());
- name.append(';');
- }
- }
- return name.toString();
- }
-
- private static Class getArrayClass(Class type, int dimension) {
- // Array.newInstance() requires an array of the requested number of dimensions
- // that gives the size for each dimension. We just request 0 in each of the
- // dimentions, which is not unlike a black hole sigularity.
- int dimensions[] = new int[dimension];
- // create an instance and return the associated class object.
- return Array.newInstance(type, dimensions).getClass();
- }
-}
-
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/AbstractCollectionConverter.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/AbstractCollectionConverter.java
deleted file mode 100644
index d267e9e..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/AbstractCollectionConverter.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.beans.PropertyEditor;
-import java.util.Collection;
-import java.util.List;
-import java.util.ArrayList;
-import java.lang.reflect.Array;
-
-/**
- * @version $Rev: 6687 $ $Date: 2005-12-28T21:08:56.733437Z $
- */
-public abstract class AbstractCollectionConverter extends AbstractConverter {
- private final PropertyEditor editor;
-
- public AbstractCollectionConverter(Class type) {
- super(type);
- this.editor = new StringEditor();
- }
-
- public AbstractCollectionConverter(Class type, PropertyEditor editor) {
- super(type);
-
- if (editor == null) throw new NullPointerException("editor is null");
- this.editor = editor;
- }
-
- protected final Object toObjectImpl(String text) {
- List list = CollectionUtil.toList(text, editor);
- if (list == null) {
- return null;
- }
- Object collection = createCollection(list);
- return collection;
- }
-
- protected abstract Object createCollection(List list);
-
- protected final String toStringImpl(Object value) {
- Collection values;
- if (value.getClass().isArray()) {
- values = new ArrayList(Array.getLength(value));
- for (int i = 0; i < Array.getLength(value); i++) {
- values.add(Array.get(value, i));
- }
- } else {
- values = (Collection) value;
- }
-
- String text = CollectionUtil.toString(values, editor);
- return text;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/AbstractConverter.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/AbstractConverter.java
deleted file mode 100644
index 25f2f44..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/AbstractConverter.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.beans.PropertyEditorSupport;
-
-import org.apache.xbean.ClassLoading;
-
-/**
- * A base class for converters. This class handles all converter methods, and redirects all conversion requests to
- * toStringImpl and toObjectImpl. These methods can assume that the supplied value or text is never null, and that
- * type checking has been applied to the value.
- *
- * @version $Rev: 6680 $
- */
-public abstract class AbstractConverter extends PropertyEditorSupport implements Converter {
- private final Class type;
-
- /**
- * Creates an abstract converter for the specified type.
- *
- * @param type type of the property editor
- */
- protected AbstractConverter(Class type) {
- super();
- if (type == null) throw new NullPointerException("type is null");
- this.type = type;
- }
-
- public final Class getType() {
- return type;
- }
-
- public final String getAsText() {
- Object value = super.getValue();
- String text = toString(value);
- return text;
- }
-
- public final void setAsText(String text) {
- Object value = toObject(text.trim());
- super.setValue(value);
- }
-
- public final Object getValue() {
- Object value = super.getValue();
- return value;
- }
-
- public final void setValue(Object value) {
- if (value == null) {
- super.setValue(null);
- }
- if (!type.isInstance(value)) {
- throw new PropertyEditorException("Value is not an instance of " + ClassLoading.getClassName(type));
- }
- super.setValue(value);
- }
-
- public final String toString(Object value) {
- if (value == null) {
- return null;
- }
- if (!type.isInstance(value)) {
- throw new PropertyEditorException("Value is not an instance of " + ClassLoading.getClassName(type) + ": " + value.getClass().getName());
- }
- return toStringImpl(value);
- }
-
- public final Object toObject(String text) {
- if (text == null) {
- return null;
- }
-
- Object value = toObjectImpl(text.trim());
- return value;
- }
-
- /**
- * Converts the supplied object to text. The supplied object will always be an instance of the editor type, and
- * specifically will never be null or a String (unless this is the String editor).
- *
- * @param value an instance of the editor type
- * @return the text equivalent of the value
- */
- protected String toStringImpl(Object value) {
- String text = value.toString();
- return text;
- }
-
- /**
- * Converts the supplied text in to an instance of the editor type. The text will never be null, and trim() will
- * already have been called.
- *
- * @param text the text to convert
- * @return an instance of the editor type
- */
- protected abstract Object toObjectImpl(String text);
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/AbstractMapConverter.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/AbstractMapConverter.java
deleted file mode 100644
index cb1ab2e..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/AbstractMapConverter.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.beans.PropertyEditor;
-import java.util.Map;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public abstract class AbstractMapConverter extends AbstractConverter {
- private final PropertyEditor keyEditor;
- private final PropertyEditor valueEditor;
-
- public AbstractMapConverter(Class type) {
- super(type);
- this.keyEditor = new StringEditor();
- this.valueEditor = new StringEditor();
- }
-
- protected AbstractMapConverter(Class type, PropertyEditor keyEditor, PropertyEditor valueEditor) {
- super(type);
- this.keyEditor = keyEditor;
- this.valueEditor = valueEditor;
- }
-
- /**
- * Treats the text value of this property as an input stream that
- * is converted into a Property bundle.
- *
- * @return a Properties object
- * @throws PropertyEditorException An error occurred creating the Properties object.
- */
- protected final Object toObjectImpl(String text) {
- Map map = CollectionUtil.toMap(text, keyEditor, valueEditor);
- if (map == null) {
- return null;
- }
- Map finalMap = createMap(map);
- return finalMap;
- }
-
- protected abstract Map createMap(Map map);
-
- protected final String toStringImpl(Object value) {
- Map map = (Map) value;
- String text = CollectionUtil.toString(map, keyEditor, valueEditor);
- return text;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ArrayConverter.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ArrayConverter.java
deleted file mode 100644
index 18856a9..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ArrayConverter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.beans.PropertyEditor;
-import java.lang.reflect.Array;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.apache.xbean.ClassLoading;
-
-/**
- * Adapter for editing array types.
- *
- * @version $Rev: 6687 $ $Date: 2005-12-28T21:08:56.733437Z $
- */
-public final class ArrayConverter extends AbstractCollectionConverter {
- public ArrayConverter(Class type, PropertyEditor editor) {
- super(type, editor);
-
- if (!type.isArray()) {
- throw new IllegalArgumentException("type is not an array " + ClassLoading.getClassName(type));
- }
-
- if (type.getComponentType().isArray()) {
- throw new IllegalArgumentException("type is a multi-dimensional array " + ClassLoading.getClassName(type, true));
- }
-
- if (editor == null) throw new NullPointerException("editor is null");
- }
-
- protected Object createCollection(List list) {
- Object array = Array.newInstance(getType().getComponentType(), list.size());
- for (ListIterator iterator = list.listIterator(); iterator.hasNext();) {
- Object item = iterator.next();
- int index = iterator.previousIndex();
- Array.set(array, index, item);
- }
- return array;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ArrayListEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ArrayListEditor.java
deleted file mode 100644
index cc43a58..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ArrayListEditor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Adapter for editing array types.
- *
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public final class ArrayListEditor extends AbstractCollectionConverter {
- public ArrayListEditor() {
- super(ArrayList.class);
- }
-
- protected Object createCollection(List list) {
- return new ArrayList(list);
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/BigDecimalEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/BigDecimalEditor.java
deleted file mode 100644
index 9dfdb28..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/BigDecimalEditor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.math.BigDecimal;
-
-/**
- * A property editor for BigDecimal typed properties.
- *
- * @version $Rev: 6680 $
- */
-public class BigDecimalEditor extends AbstractConverter {
- public BigDecimalEditor() {
- super(BigDecimal.class);
- }
-
- /**
- * Convert the text value of the property into a BigDecimal instance.
- *
- * @return a BigDecimal object constructed from the property text value.
- */
- protected Object toObjectImpl(String text) {
- try {
- // just instantiate a BigDecimal instance from the test string value.
- return new BigDecimal(text);
- } catch (NumberFormatException e) {
- // any format errors show up as a NumberFormatException, which we turn into a PropertyEditorException.
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/BigIntegerEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/BigIntegerEditor.java
deleted file mode 100644
index 0486425..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/BigIntegerEditor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.math.BigInteger;
-
-/**
- * A property editor for BigDecimal typed properties.
- *
- * @version $Rev: 6680 $
- */
-public class BigIntegerEditor extends AbstractConverter {
- public BigIntegerEditor() {
- super(BigInteger.class);
- }
-
- protected Object toObjectImpl(String value) {
- try {
- // just instantiate a BigDecimal instance from the test string value.
- return new BigInteger(value);
- } catch (NumberFormatException e) {
- // any format errors show up as a NumberFormatException, which we turn into a PropertyEditorException.
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/BooleanEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/BooleanEditor.java
deleted file mode 100644
index 2c3e7a8..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/BooleanEditor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class BooleanEditor extends AbstractConverter {
- public BooleanEditor() {
- super(Boolean.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- return Boolean.valueOf(text);
- } catch (Exception e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ByteEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ByteEditor.java
deleted file mode 100644
index 855c525..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ByteEditor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class ByteEditor extends AbstractConverter {
- public ByteEditor() {
- super(Byte.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- return Byte.valueOf(text);
- } catch (Exception e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/CharacterEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/CharacterEditor.java
deleted file mode 100644
index fc2e9af..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/CharacterEditor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class CharacterEditor extends AbstractConverter {
- public CharacterEditor() {
- super(Character.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- if (text.length() != 1) {
- throw new IllegalArgumentException("wrong size: " + text);
- }
- return new Character(text.charAt(0));
- } catch (Exception e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ClassEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ClassEditor.java
deleted file mode 100644
index 6ccdcd9..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ClassEditor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import org.apache.xbean.ClassLoading;
-
-/**
- * A property editor for converting class names into class object instances
- *
- * @version $Rev: 6680 $
- */
-public class ClassEditor extends AbstractConverter {
- public ClassEditor() {
- super(Class.class);
- }
-
- /**
- * Return a resolved class using the text value of the property as the name.
- * The class is loading using the current context class loader, using the resolution
- * rules defined by ClassLoading.java.
- *
- * @return a Class object created from the text value of the name.
- * @throws PropertyEditorException Unable to resolve the Class object from the name.
- */
- protected Object toObjectImpl(String text) {
- try {
- // load this using the current thread's context loader.
- return ClassLoading.loadClass(text, Thread.currentThread().getContextClassLoader());
- } catch (Exception e) {
- // not found exceptions are just turned into wrapped property exceptions.
- throw new PropertyEditorException("Unable to resolve class " + text, e);
- }
- }
-
- protected String toStringImpl(Object value) {
- Class clazz = (Class) value;
- String text = ClassLoading.getClassName(clazz);
- return text;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/CollectionUtil.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/CollectionUtil.java
deleted file mode 100644
index 725afeb..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/CollectionUtil.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.beans.PropertyEditor;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.Collection;
-import java.util.Properties;
-import java.util.Map;
-import java.util.LinkedHashMap;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
-
-import org.apache.xbean.ClassLoading;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public final class CollectionUtil {
- public static List toList(String text, PropertyEditor componentEditor) {
- if (text.length() == 0) {
- return null;
- }
-
- // text may be surrounded with [ and ]
- if (text.startsWith("[") && text.endsWith("]")) {
- text = text.substring(1, text.length() - 1).trim();
- }
-
- List list = new LinkedList();
-
- if (text.length() > 0) {
- StringTokenizer stok = new StringTokenizer(text, ",");
- while (stok.hasMoreTokens()) {
- String innerText = stok.nextToken();
- Object value = componentToObject(innerText, componentEditor);
- list.add(value);
- }
- }
-
- return list;
- }
-
- public static String toString(Collection values, PropertyEditor componentEditor) {
- if (values.size() == 0) {
- return "[]";
- }
-
- StringBuffer result = new StringBuffer();
- result.append("[");
- int i = 0;
- for (Iterator iterator = values.iterator(); iterator.hasNext();) {
- Object object = iterator.next();
- String text = componentToString(object, componentEditor);
-
- if (i > 0) {
- result.append(",");
- }
- result.append(text);
- i++;
- }
- result.append("]");
- return result.toString();
- }
-
- public static final Map toMap(String text, PropertyEditor keyEditor, PropertyEditor valueEditor) {
- Properties properties = new Properties();
- try {
- ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes());
- properties.load(stream);
- } catch (IOException e) {
- // any errors here are just a property exception
- throw new PropertyEditorException(e);
- }
-
- // run the properties through the editors
- Map map = new LinkedHashMap(properties.size());
- for (Iterator iterator = properties.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String keyText = (String) entry.getKey();
- String valueText = (String) entry.getValue();
-
- Object keyObject = componentToObject(keyText, keyEditor);
- Object valueObject = componentToObject(valueText, valueEditor);
-
- map.put(keyObject, valueObject);
- }
- return map;
- }
-
- public static final String toString(Map map, PropertyEditor keyEditor, PropertyEditor valueEditor) {
- // run the properties through the editors
- Properties properties = new Properties();
- for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- Object keyObject = entry.getKey();
- Object valueObject = entry.getValue();
-
- String keyText = componentToString(keyObject, keyEditor);
- String valueText = componentToString(valueObject, valueEditor);
-
- properties.setProperty(keyText, valueText);
- }
-
- // write using the properties object
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- properties.store(out, null);
- String text = new String(out.toByteArray());
- return text;
- } catch (IOException e) {
- // any errors here are just a property exception
- throw new PropertyEditorException(e);
- }
- }
-
- private static final String componentToString(Object value, PropertyEditor componentEditor) {
- if (value == null) {
- return null;
- }
- if (componentEditor instanceof Converter) {
- Converter converter = (Converter) componentEditor;
- Class type = converter.getType();
- if (!type.isInstance(value)) {
- throw new PropertyEditorException("Value is not an instance of " + ClassLoading.getClassName(type) + ": " + value.getClass().getName());
- }
- return converter.toString(value);
- } else {
- componentEditor.setValue(value);
- String text = componentEditor.getAsText();
- return text;
- }
- }
-
- private static final Object componentToObject(String text, PropertyEditor componentEditor) {
- if (text == null) {
- return null;
- }
-
- if (componentEditor instanceof Converter) {
- Converter converter = (Converter) componentEditor;
- Object value = converter.toObject(text.trim());
- return value;
- } else {
- componentEditor.setAsText(text);
- Object value = componentEditor.getValue();
- return value;
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/Converter.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/Converter.java
deleted file mode 100644
index 37c4305..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/Converter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.beans.PropertyEditor;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public interface Converter extends PropertyEditor {
- /**
- * Gets the the type of object supported by this converter.
- * @return
- */
- Class getType();
-
- /**
- * Converts the supplied object to text. If value is null, null will be returned. If value is not an instance of
- * the this converter's type, a PropertyEditorException will be thrown.
- *
- * @param value an instance of the editor type
- * @return the text equivalent of the value
- * @throws PropertyEditorException if an error occurs while converting the value to a String (this is very rare)
- */
- String toString(Object value) throws PropertyEditorException;
-
- /**
- * Converts the supplied text in to an instance of the editor type. If text is null, null will be returned.
- *
- * @param text the text to convert
- * @return an instance of the editor type
- * @throws PropertyEditorException if an error occurs while converting the text to an object
- */
- Object toObject(String text) throws PropertyEditorException;
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/DateEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/DateEditor.java
deleted file mode 100644
index 6529502..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/DateEditor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.util.Date;
-
-/**
- * A property editor for Date typed properties.
- *
- * @version $Rev: 6680 $
- */
-public class DateEditor extends AbstractConverter {
- private final DateFormat formatter;
-
- public DateEditor() {
- super(Date.class);
-
- // Get a date formatter to parse this.
- // This retrieves the formatter using the current execution locale,
- // which could present an intererting problem when applied to deployment
- // plans written in other locales. Sort of a Catch-22 situation.
- formatter = DateFormat.getDateInstance();
- }
-
- /**
- * Convert the text value of the property into a Date object instance.
- *
- * @return a Date object constructed from the property text value.
- * @throws PropertyEditorException Unable to parse the string value into a Date.
- */
- protected Object toObjectImpl(String text) {
- try {
- return formatter.parse(text);
- } catch (ParseException e) {
- // any format errors show up as a ParseException, which we turn into a PropertyEditorException.
- throw new PropertyEditorException(e);
- }
- }
-
- protected String toStringImpl(Object value) {
- Date date = (Date) value;
- String text = formatter.format(date);
- return text;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/DoubleEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/DoubleEditor.java
deleted file mode 100644
index f940dd6..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/DoubleEditor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class DoubleEditor extends AbstractConverter {
- public DoubleEditor() {
- super(Double.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- return Double.valueOf(text);
- } catch (Exception e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/FileEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/FileEditor.java
deleted file mode 100644
index d8c8084..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/FileEditor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * A property editor for {@link File}.
- *
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class FileEditor extends AbstractConverter {
- public FileEditor() {
- super(File.class);
- }
-
- /**
- * Returns a URL for the input object converted to a string.
- *
- * @return a URL object
- * @throws PropertyEditorException An IOException occured.
- */
- protected Object toObjectImpl(String text) {
- try {
- return new File(text).getCanonicalFile();
- } catch (IOException e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/FloatEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/FloatEditor.java
deleted file mode 100644
index 7046ea6..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/FloatEditor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class FloatEditor extends AbstractConverter {
- public FloatEditor() {
- super(Float.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- return Float.valueOf(text);
- } catch (Exception e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/HashMapEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/HashMapEditor.java
deleted file mode 100644
index 25a4599..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/HashMapEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A property editor for indirect property bundles. This editor
- * transforms the text value of the propery into a Property resource bundle.
- *
- * @version $Rev: 6680 $
- */
-public class HashMapEditor extends AbstractMapConverter {
- public HashMapEditor() {
- super(HashMap.class);
- }
-
- protected Map createMap(Map map) {
- Map finalMap = new HashMap(map);
- return finalMap;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/HashtableEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/HashtableEditor.java
deleted file mode 100644
index 8236cb6..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/HashtableEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-/**
- * A property editor for indirect property bundles. This editor
- * transforms the text value of the propery into a Property resource bundle.
- *
- * @version $Rev: 6680 $
- */
-public class HashtableEditor extends AbstractMapConverter {
- public HashtableEditor() {
- super(Hashtable.class);
- }
-
- protected Map createMap(Map map) {
- Map finalMap = new Hashtable(map);
- return finalMap;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/IdentityHashMapEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/IdentityHashMapEditor.java
deleted file mode 100644
index 432917b..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/IdentityHashMapEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.util.IdentityHashMap;
-import java.util.Map;
-
-/**
- * A property editor for indirect property bundles. This editor
- * transforms the text value of the propery into a Property resource bundle.
- *
- * @version $Rev: 6680 $
- */
-public class IdentityHashMapEditor extends AbstractMapConverter {
- public IdentityHashMapEditor() {
- super(IdentityHashMap.class);
- }
-
- protected Map createMap(Map map) {
- Map finalMap = new IdentityHashMap(map);
- return finalMap;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/Inet4AddressEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/Inet4AddressEditor.java
deleted file mode 100644
index 3cdf7e5..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/Inet4AddressEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.net.Inet4Address;
-import java.net.UnknownHostException;
-
-/**
- * @version $Rev: 6687 $ $Date: 2005-12-28T21:08:56.733437Z $
- */
-public class Inet4AddressEditor extends AbstractConverter {
- public Inet4AddressEditor() {
- super(Inet4Address.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- return Inet4Address.getByName(text);
- } catch (UnknownHostException e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/Inet6AddressEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/Inet6AddressEditor.java
deleted file mode 100644
index c40d90b..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/Inet6AddressEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.net.Inet6Address;
-import java.net.UnknownHostException;
-
-/**
- * @version $Rev: 6687 $ $Date: 2005-12-28T21:08:56.733437Z $
- */
-public class Inet6AddressEditor extends AbstractConverter {
- public Inet6AddressEditor() {
- super(Inet6Address.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- return Inet6Address.getByName(text);
- } catch (UnknownHostException e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/InetAddressEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/InetAddressEditor.java
deleted file mode 100644
index 858a16d..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/InetAddressEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class InetAddressEditor extends AbstractConverter {
- public InetAddressEditor() {
- super(InetAddress.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- return InetAddress.getByName(text);
- } catch (UnknownHostException e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/IntegerEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/IntegerEditor.java
deleted file mode 100644
index 840a5b8..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/IntegerEditor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class IntegerEditor extends AbstractConverter {
- public IntegerEditor() {
- super(Integer.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- return Integer.valueOf(text);
- } catch (Exception e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LinkedHashMapEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LinkedHashMapEditor.java
deleted file mode 100644
index 7a35271..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LinkedHashMapEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * A property editor for indirect property bundles. This editor
- * transforms the text value of the propery into a Property resource bundle.
- *
- * @version $Rev: 6680 $
- */
-public class LinkedHashMapEditor extends AbstractMapConverter {
- public LinkedHashMapEditor() {
- super(LinkedHashMap.class);
- }
-
- protected Map createMap(Map map) {
- Map finalMap = new LinkedHashMap(map);
- return finalMap;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LinkedHashSetEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LinkedHashSetEditor.java
deleted file mode 100644
index 15fe197..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LinkedHashSetEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Adapter for editing array types.
- *
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public final class LinkedHashSetEditor extends AbstractCollectionConverter {
- public LinkedHashSetEditor() {
- super(Set.class);
- }
-
- protected Object createCollection(List list) {
- return new LinkedHashSet(list);
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LinkedListEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LinkedListEditor.java
deleted file mode 100644
index dc1f8e3..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LinkedListEditor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.util.List;
-import java.util.LinkedList;
-
-/**
- * Adapter for editing array types.
- *
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public final class LinkedListEditor extends AbstractCollectionConverter {
- public LinkedListEditor() {
- super(LinkedList.class);
- }
-
- protected Object createCollection(List list) {
- return new LinkedList(list);
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ListEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ListEditor.java
deleted file mode 100644
index da66022..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ListEditor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Adapter for editing array types.
- *
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public final class ListEditor extends AbstractCollectionConverter {
- public ListEditor() {
- super(List.class);
- }
-
- protected Object createCollection(List list) {
- return new ArrayList(list);
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LongEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LongEditor.java
deleted file mode 100644
index 4230d09..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/LongEditor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class LongEditor extends AbstractConverter {
- public LongEditor() {
- super(Long.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- return Long.valueOf(text);
- } catch (Exception e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/MapEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/MapEditor.java
deleted file mode 100644
index 8c87974..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/MapEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * A property editor for indirect property bundles. This editor
- * transforms the text value of the propery into a Property resource bundle.
- *
- * @version $Rev: 6680 $
- */
-public class MapEditor extends AbstractMapConverter {
- public MapEditor() {
- super(Map.class);
- }
-
- protected Map createMap(Map map) {
- Map finalMap = new LinkedHashMap(map);
- return finalMap;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ObjectNameEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ObjectNameEditor.java
deleted file mode 100644
index 5e45b3c..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ObjectNameEditor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-/**
- * A property editor for {@link javax.management.ObjectName}.
- *
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class ObjectNameEditor extends AbstractConverter {
- public ObjectNameEditor() {
- super(ObjectName.class);
- }
-
- /**
- * Returns a ObjectName for the input object converted to a string.
- *
- * @return a ObjectName object
- * @throws PropertyEditorException An MalformedObjectNameException occured.
- */
- protected Object toObjectImpl(String text) {
- try {
- return new ObjectName(text);
- } catch (MalformedObjectNameException e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertiesEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertiesEditor.java
deleted file mode 100644
index b3fdb2e..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertiesEditor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * A property editor for indirect property bundles. This editor
- * transforms the text value of the propery into a Property resource bundle.
- *
- * @version $Rev: 6680 $
- */
-public class PropertiesEditor extends AbstractMapConverter {
- public PropertiesEditor() {
- super(Properties.class);
- }
-
- protected Map createMap(Map map) {
- Properties properties = new Properties();
- properties.putAll(map);
- return properties;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditorException.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditorException.java
deleted file mode 100644
index 718c5f5..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditorException.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-
-/**
- * An exception for property editor conversion problems.
- *
- * @version $Rev: 6680 $
- */
-public class PropertyEditorException extends RuntimeException {
-
- /**
- * Default constructor for a PropertyException.
- */
- public PropertyEditorException() {
- }
-
- /**
- * PropertyEditorException with a wrappered inner exception.
- *
- * @param cause Original root cause of the PropertyEditorException.
- */
- public PropertyEditorException(Throwable cause) {
- super(cause);
- }
-
- /**
- * A PropertyEditorException with just an error message.
- *
- * @param message The text error message describing the condition.
- */
- public PropertyEditorException(String message) {
- super(message);
- }
-
- /**
- * An exception with both a message and an internal exception.
- *
- * @param message The test error message.
- * @param cause The root cause for the exception.
- */
- public PropertyEditorException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditors.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditors.java
deleted file mode 100644
index d67e41d..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditors.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.beans.PropertyEditor;
-import java.beans.PropertyEditorManager;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.xbean.ClassLoading;
-
-/**
- * The property editor manager. This orchestrates Geronimo usage of
- * property editors, allowing additional search paths to be added and
- * specific editors to be registered.
- *
- * @version $Rev: 6687 $
- */
-public class PropertyEditors {
- private static final Map registry = Collections.synchronizedMap(new ReferenceIdentityMap());
- private static final Map PRIMITIVE_TO_WRAPPER;
- private static final Map WRAPPER_TO_PRIMITIVE;
-
- /**
- * Register all of the built in converters
- */
- static {
- Map map = new HashMap();
- map.put(boolean.class, Boolean.class);
- map.put(char.class, Character.class);
- map.put(byte.class, Byte.class);
- map.put(short.class, Short.class);
- map.put(int.class, Integer.class);
- map.put(long.class, Long.class);
- map.put(float.class, Float.class);
- map.put(double.class, Double.class);
- PRIMITIVE_TO_WRAPPER = Collections.unmodifiableMap(map);
-
-
- map = new HashMap();
- map.put(Boolean.class, boolean.class);
- map.put(Character.class, char.class);
- map.put(Byte.class, byte.class);
- map.put(Short.class, short.class);
- map.put(Integer.class, int.class);
- map.put(Long.class, long.class);
- map.put(Float.class, float.class);
- map.put(Double.class, double.class);
- WRAPPER_TO_PRIMITIVE = Collections.unmodifiableMap(map);
-
- // Explicitly register the types
- registerConverter(new ArrayListEditor());
- registerConverter(new BigDecimalEditor());
- registerConverter(new BigIntegerEditor());
- registerConverter(new BooleanEditor());
- registerConverter(new ByteEditor());
- registerConverter(new CharacterEditor());
- registerConverter(new ClassEditor());
- registerConverter(new DateEditor());
- registerConverter(new DoubleEditor());
- registerConverter(new FileEditor());
- registerConverter(new FloatEditor());
- registerConverter(new HashMapEditor());
- registerConverter(new HashtableEditor());
- registerConverter(new IdentityHashMapEditor());
- registerConverter(new Inet4AddressEditor());
- registerConverter(new Inet6AddressEditor());
- registerConverter(new InetAddressEditor());
- registerConverter(new IntegerEditor());
- registerConverter(new LinkedHashMapEditor());
- registerConverter(new LinkedHashSetEditor());
- registerConverter(new LinkedListEditor());
- registerConverter(new ListEditor());
- registerConverter(new LongEditor());
- registerConverter(new MapEditor());
- registerConverter(new ObjectNameEditor());
- registerConverter(new PropertiesEditor());
- registerConverter(new SetEditor());
- registerConverter(new ShortEditor());
- registerConverter(new SortedMapEditor());
- registerConverter(new SortedSetEditor());
- registerConverter(new StringEditor());
- registerConverter(new TreeMapEditor());
- registerConverter(new TreeSetEditor());
- registerConverter(new URIEditor());
- registerConverter(new URLEditor());
- registerConverter(new VectorEditor());
- registerConverter(new WeakHashMapEditor());
- }
-
- public static void registerConverter(Converter converter) {
- if (converter == null) throw new NullPointerException("editor is null");
- Class type = converter.getType();
- registry.put(type, converter);
- PropertyEditorManager.registerEditor(type, converter.getClass());
-
- if (PRIMITIVE_TO_WRAPPER.containsKey(type)) {
- Class wrapperType = (Class) PRIMITIVE_TO_WRAPPER.get(type);
- registry.put(wrapperType, converter);
- PropertyEditorManager.registerEditor(wrapperType, converter.getClass());
- } else if (WRAPPER_TO_PRIMITIVE.containsKey(type)) {
- Class primitiveType = (Class) WRAPPER_TO_PRIMITIVE.get(type);
- registry.put(primitiveType, converter);
- PropertyEditorManager.registerEditor(primitiveType, converter.getClass());
- }
- }
-
- public static boolean canConvert(String type, ClassLoader classLoader) {
- if (type == null) throw new NullPointerException("type is null");
- if (classLoader == null) throw new NullPointerException("classLoader is null");
-
- // load using the ClassLoading utility, which also manages arrays and primitive classes.
- Class typeClass = null;
- try {
- typeClass = ClassLoading.loadClass(type, classLoader);
- } catch (ClassNotFoundException e) {
- throw new PropertyEditorException("Type class could not be found: " + type);
- }
-
- return canConvert(typeClass);
-
- }
-
- public static boolean canConvert(Class type) {
- Converter converter = findConverter(type);
- if (converter != null) {
- return true;
- }
-
- // fall back to a property editor
- PropertyEditor editor = findEditor(type);
- if (editor != null) {
- return true;
- }
-
- return false;
- }
-
- public static String toString(Object value) throws PropertyEditorException {
- if (value == null) throw new NullPointerException("value is null");
-
- // get an editor for this type
- Class type = value.getClass();
-
- // try to get a converter from our registry as they are way faster and easier to use
- Converter converter = findConverter(type);
- if (converter != null) {
- return converter.toString(value);
- }
-
- // fall back to a property editor
- PropertyEditor editor = findEditor(type);
- if (editor == null) {
- throw new PropertyEditorException("Unable to find PropertyEditor for " + ClassLoading.getClassName(type, true));
- }
-
- // create the string value
- editor.setValue(value);
- String textValue = null;
- try {
- textValue = editor.getAsText();
- } catch (Exception e) {
- throw new PropertyEditorException("Error while converting a \"" + ClassLoading.getClassName(type, true) + "\" to text " +
- " using the property editor " + ClassLoading.getClassName(editor.getClass(), true), e);
- }
- return textValue;
- }
-
- public static Object getValue(String type, String value, ClassLoader classLoader) throws PropertyEditorException {
- if (type == null) throw new NullPointerException("type is null");
- if (value == null) throw new NullPointerException("value is null");
- if (classLoader == null) throw new NullPointerException("classLoader is null");
-
- // load using the ClassLoading utility, which also manages arrays and primitive classes.
- Class typeClass = null;
- try {
- typeClass = ClassLoading.loadClass(type, classLoader);
- } catch (ClassNotFoundException e) {
- throw new PropertyEditorException("Type class could not be found: " + type);
- }
-
- return getValue(typeClass, value);
-
- }
-
- public static Object getValue(Class type, String value) throws PropertyEditorException {
- if (type == null) throw new NullPointerException("type is null");
- if (value == null) throw new NullPointerException("value is null");
-
- // try to get a converter from our registry as they are way faster and easier to use
- Converter converter = findConverter(type);
- if (converter != null) {
- return converter.toObject(value);
- }
-
- // fall back to a property editor
- PropertyEditor editor = findEditor(type);
- if (editor == null) {
- throw new PropertyEditorException("Unable to find PropertyEditor for " + ClassLoading.getClassName(type, true));
- }
-
- // create the object value
- editor.setAsText(value);
- Object objectValue = null;
- try {
- objectValue = editor.getValue();
- } catch (Exception e) {
- throw new PropertyEditorException("Error while converting \"" + value + "\" to a " + ClassLoading.getClassName(type, true) +
- " using the property editor " + ClassLoading.getClassName(editor.getClass(), true), e);
- }
- return objectValue;
- }
-
- private static Converter findConverter(Class type) {
- if (type == null) throw new NullPointerException("type is null");
-
- Converter converter = (Converter) registry.get(type);
-
- // we're outta here if we got one.
- if (converter != null) {
- return converter;
- }
-
- Class[] declaredClasses = type.getDeclaredClasses();
- for (int i = 0; i < declaredClasses.length; i++) {
- Class declaredClass = declaredClasses[i];
- if (Converter.class.isAssignableFrom(declaredClass)) {
- try {
- converter = (Converter) declaredClass.newInstance();
- registerConverter(converter);
-
- // try to get the converter from the registry... the converter
- // created above may have been for another class
- converter = (Converter) registry.get(type);
- if (converter != null) {
- return converter;
- }
- } catch (Exception e) {
- }
-
- }
- }
-
- // it's possible this was a request for an array class. We might not
- // recognize the array type directly, but the component type might be
- // resolvable
- if (type.isArray() && !type.getComponentType().isArray()) {
- // do a recursive lookup on the base type
- converter = findConverter(type.getComponentType());
- // if we found a suitable editor for the base component type,
- // wrapper this in an array adaptor for real use
- if (converter != null) {
- return new ArrayConverter(type, converter);
- }
- }
-
- // nothing found
- return null;
- }
-
- /**
- * Locate a property editor for qiven class of object.
- *
- * @param type The target object class of the property.
- * @return The resolved editor, if any. Returns null if a suitable editor
- * could not be located.
- */
- private static PropertyEditor findEditor(Class type) {
- if (type == null) throw new NullPointerException("type is null");
-
- // try to locate this directly from the editor manager first.
- PropertyEditor editor = PropertyEditorManager.findEditor(type);
-
- // we're outta here if we got one.
- if (editor != null) {
- return editor;
- }
-
- // it's possible this was a request for an array class. We might not
- // recognize the array type directly, but the component type might be
- // resolvable
- if (type.isArray() && !type.getComponentType().isArray()) {
- // do a recursive lookup on the base type
- editor = findEditor(type.getComponentType());
- // if we found a suitable editor for the base component type,
- // wrapper this in an array adaptor for real use
- if (editor != null) {
- return new ArrayConverter(type, editor);
- }
- }
-
- // nothing found
- return null;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ReferenceIdentityMap.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ReferenceIdentityMap.java
deleted file mode 100644
index 071e1f2..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ReferenceIdentityMap.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.lang.ref.Reference;
-import java.lang.ref.WeakReference;
-import java.lang.ref.ReferenceQueue;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Streamlined version of a WeakIdentityHashMap. Provides Identity semantics with
- * Weak References to keys. This allows proxies to be GC'ed when no longer referenced
- * by clients. <code>BasicProxymanager.destroyProxy()</code> need not be invoked when a
- * proxy is no longer needed. Note that this is not a full Map implementation.
- * The iteration and collection capabilities of Map have been discarded to keep the
- * implementation lightweight.
- * <p>
- * Much of this code was cribbed from the Commons Collection 3.1 implementation of
- * <code>ReferenceIdentityMap</code> and <code>AbstractReferenceMap</code>.
- */
-public class ReferenceIdentityMap implements Map {
-
- /** The default capacity to use. Always use a power of 2!!! */
- private static final int DEFAULT_CAPACITY = 16;
- /** The default load factor to use */
- private static final float DEFAULT_LOAD_FACTOR = 0.75f;
- /** The maximum capacity allowed */
- private static final int MAXIMUM_CAPACITY = 1 << 30;
-
- /** Load factor, normally 0.75 */
- private float loadFactor;
- /** The size of the map */
- private transient int size;
- /** Map entries */
- private transient ReferenceEntry[] data;
- /** Size at which to rehash */
- private transient int threshold;
-
- /**
- * ReferenceQueue used to eliminate GC'ed entries.
- */
- private ReferenceQueue purgeQueue;
-
- public ReferenceIdentityMap() {
- this.loadFactor = DEFAULT_LOAD_FACTOR;
- this.data = new ReferenceEntry[DEFAULT_CAPACITY];
- this.threshold = calculateThreshold(DEFAULT_CAPACITY, loadFactor);
- this.purgeQueue = new ReferenceQueue();
- }
-
- /**
- * Gets the size of the map.
- *
- * @return the size
- */
- public int size() {
- purge();
- return size;
- }
-
- /**
- * Checks whether the map is currently empty.
- *
- * @return true if the map is currently size zero
- */
- public boolean isEmpty() {
- purge();
- return (size == 0);
- }
-
- /**
- * Checks whether the map contains the specified key.
- *
- * @param key the key to search for
- * @return true if the map contains the key
- */
- public boolean containsKey(Object key) {
- purge();
- ReferenceEntry entry = getEntry(key);
- if (entry == null) {
- return false;
- }
- return (entry.getValue() != null);
- }
-
- /**
- * Checks whether the map contains the specified value.
- *
- * @param value the value to search for
- * @return true if the map contains the value
- */
- public boolean containsValue(Object value) {
- purge();
- if (value == null || size == 0) {
- return false;
- }
- ReferenceEntry [] table = data;
- for (int i = 0; i < table.length; i++) {
- ReferenceEntry entry = table[i];
- while (entry != null) {
- if (value.equals(entry.getValue())) {
- return true;
- }
- entry = entry.next;
- }
- }
- return false;
- }
-
- /**
- * Gets the value mapped to the key specified.
- *
- * @param key the key
- * @return the mapped value, null if no match
- */
- public Object get(Object key) {
- purge();
- ReferenceEntry entry = getEntry(key);
- if (entry == null) {
- return null;
- }
- return entry.getValue();
- }
-
-
- /**
- * Puts a key-value entry into this map.
- * Neither the key nor the value may be null.
- *
- * @param key the key to add, must not be null
- * @param value the value to add, must not be null
- * @return the value previously mapped to this key, null if none
- */
- public Object put(Object key, Object value) {
- assert key != null: "key is null";
- assert value != null: "value is null";
-
- purge();
-
- int hashCode = hash(key);
- int index = hashIndex(hashCode, data.length);
- ReferenceEntry entry = data[index];
- while (entry != null) {
- if (entry.hashCode == hashCode && key == entry.getKey()) {
- return entry.setValue(value);
- }
- entry = entry.next;
- }
-
- createEntry(index, hashCode, key, value);
- return null;
- }
-
- /**
- * Removes the specified mapping from this map.
- *
- * @param key the mapping to remove
- * @return the value mapped to the removed key, null if key not in map
- */
- public Object remove(Object key) {
- if (key == null) {
- return null;
- }
- purge();
- int hashCode = hash(key);
- int index = hashIndex(hashCode, data.length);
- ReferenceEntry entry = data[index];
- ReferenceEntry previous = null;
- while (entry != null) {
- if (entry.hashCode == hashCode && (key == entry.getKey())) {
- Object oldValue = entry.getValue();
- removeEntry(entry, index, previous);
- return oldValue;
- }
- previous = entry;
- entry = entry.next;
- }
- return null;
- }
-
- /**
- * Clears the map, resetting the size to zero and nullifying references
- * to avoid garbage collection issues.
- */
- public void clear() {
- ReferenceEntry[] data = this.data;
- for (int i = data.length - 1; i >= 0; i--) {
- data[i] = null;
- }
- size = 0;
- while (purgeQueue.poll() != null) {} // drain the queue
- }
-
- public Collection values() {
- throw new UnsupportedOperationException();
- }
-
- public void putAll(Map t) {
- throw new UnsupportedOperationException();
- }
-
- public Set entrySet() {
- throw new UnsupportedOperationException();
- }
-
- public Set keySet() {
- throw new UnsupportedOperationException();
- }
-
- // end of public methods
-
- /**
- * Gets the entry mapped to the key specified.
- * @param key the key
- * @return the entry, null if no match
- */
- private ReferenceEntry getEntry(Object key) {
- if (key == null) {
- return null;
- }
- int hashCode = hash(key);
- ReferenceEntry entry = data[hashIndex(hashCode, data.length)];
- while (entry != null) {
- if (entry.hashCode == hashCode && (key == entry.getKey())) {
- return entry;
- }
- entry = entry.next;
- }
- return null;
- }
-
- /**
- * Creates a new ReferenceEntry.
- *
- * @param index the index into the data map
- * @param hashCode the hash code for the new entry
- * @param key the key to store
- * @param value the value to store
- * @return the newly created entry
- */
- private ReferenceEntry createEntry(int index, int hashCode, Object key, Object value) {
- ReferenceEntry newEntry = new ReferenceEntry(this, data[index], hashCode, key, value);
- data[index] = newEntry;
- size++;
- checkCapacity();
- return newEntry;
- }
-
- /**
- * Removes an entry from the chain stored in a particular index.
- * <p>
- * This implementation removes the entry from the data storage table.
- * The size is not updated.
- *
- * @param entry the entry to remove
- * @param hashIndex the index into the data structure
- * @param previous the previous entry in the chain
- */
- private void removeEntry(ReferenceEntry entry, int hashIndex, ReferenceEntry previous) {
- if (previous == null) {
- data[hashIndex] = entry.next;
- } else {
- previous.next = entry.next;
- }
- size--;
- entry.next = null;
- entry.clear();
- entry.value = null;
- }
-
- /**
- * Checks the capacity of the map and enlarges it if necessary.
- * <p>
- * This implementation uses the threshold to check if the map needs enlarging
- */
- private void checkCapacity() {
- if (size >= threshold) {
- int newCapacity = data.length * 2;
- if (newCapacity <= MAXIMUM_CAPACITY) {
- ensureCapacity(newCapacity);
- }
- }
- }
-
- /**
- * Changes the size of the data structure to the capacity proposed.
- *
- * @param newCapacity the new capacity of the array (a power of two, less or equal to max)
- */
- private void ensureCapacity(int newCapacity) {
- int oldCapacity = data.length;
- if (newCapacity <= oldCapacity) {
- return;
- }
-
- ReferenceEntry oldEntries[] = data;
- ReferenceEntry newEntries[] = new ReferenceEntry[newCapacity];
-
- for (int i = oldCapacity - 1; i >= 0; i--) {
- ReferenceEntry entry = oldEntries[i];
- if (entry != null) {
- oldEntries[i] = null; // gc
- do {
- ReferenceEntry next = entry.next;
- int index = hashIndex(entry.hashCode, newCapacity);
- entry.next = newEntries[index];
- newEntries[index] = entry;
- entry = next;
- } while (entry != null);
- }
- }
- threshold = calculateThreshold(newCapacity, loadFactor);
- data = newEntries;
- }
-
- /**
- * Calculates the new threshold of the map, where it will be resized.
- * This implementation uses the load factor.
- *
- * @param newCapacity the new capacity
- * @param factor the load factor
- * @return the new resize threshold
- */
- private int calculateThreshold(int newCapacity, float factor) {
- return (int) (newCapacity * factor);
- }
-
- /**
- * Gets the hash code for the key specified.
- * <p>
- * This implementation uses the identity hash code.
- *
- * @param key the key to get a hash code for
- * @return the hash code
- */
- private int hash(Object key) {
- return System.identityHashCode(key);
- }
-
- /**
- * Gets the index into the data storage for the hashCode specified.
- * This implementation uses the least significant bits of the hashCode.
- *
- * @param hashCode the hash code to use
- * @param dataSize the size of the data to pick a bucket from
- * @return the bucket index
- */
- private int hashIndex(int hashCode, int dataSize) {
- return hashCode & (dataSize - 1);
- }
-
- // Code that handles WeakReference cleanup... Invoked prior to
- // any operation accessing the ReferenceEntry array...
-
- /**
- * Purges stale mappings from this map.
- * <p>
- * Note that this method is not synchronized! Special
- * care must be taken if, for instance, you want stale
- * mappings to be removed on a periodic basis by some
- * background thread.
- */
- private void purge() {
- Reference entryRef = purgeQueue.poll();
- while (entryRef != null) {
- purge(entryRef);
- entryRef = purgeQueue.poll();
- }
- }
-
- /**
- * Purges the specified reference.
- *
- * @param purgedEntry the reference to purge
- */
- private void purge(Reference purgedEntry) {
- int hash = ((ReferenceEntry)purgedEntry).hashCode;
- int index = hashIndex(hash, data.length);
- ReferenceEntry previous = null;
- ReferenceEntry currentEntry = data[index];
- while (currentEntry != null) {
- if (currentEntry == purgedEntry) {
- currentEntry.purged();
- if (previous == null) {
- data[index] = currentEntry.next;
- } else {
- previous.next = currentEntry.next;
- }
- this.size--;
- return;
- }
- previous = currentEntry;
- currentEntry = currentEntry.next;
- }
- }
-
- /**
- * Each entry in the Map is represented with a ReferenceEntry.
- * <p>
- * If getKey() or getValue() returns null, it means
- * the mapping is stale and should be removed.
- *
- * @since Commons Collections 3.1
- */
- private static class ReferenceEntry extends WeakReference {
- /** The next entry in the hash chain */
- private ReferenceEntry next;
- /** The hash code of the key */
- private int hashCode;
- /** The value */
- private Object value;
-
- /**
- * Creates a new entry object for the ReferenceMap.
- *
- * @param parent the parent map
- * @param next the next entry in the hash bucket
- * @param hashCode the hash code of the key
- * @param key the key
- * @param value the value
- */
- private ReferenceEntry(ReferenceIdentityMap parent, ReferenceEntry next, int hashCode, Object key, Object value) {
- super(key, parent.purgeQueue);
- this.next = next;
- this.hashCode = hashCode;
- this.value = value;
- }
-
- /**
- * Gets the key from the entry.
- * This method dereferences weak and soft keys and thus may return null.
- *
- * @return the key, which may be null if it was garbage collected
- */
- private Object getKey() {
- return this.get();
- }
-
- /**
- * Gets the value from the entry.
- * This method dereferences weak and soft value and thus may return null.
- *
- * @return the value, which may be null if it was garbage collected
- */
- private Object getValue() {
- return value;
- }
-
- /**
- * Sets the value of the entry.
- *
- * @param obj the object to store
- * @return the previous value
- */
- private Object setValue(Object obj) {
- Object old = getValue();
- value = obj;
- return old;
- }
-
- /**
- * Purges this entry.
- */
- private void purged() {
- this.clear();
- value = null;
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/SetEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/SetEditor.java
deleted file mode 100644
index 1d164b5..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/SetEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Adapter for editing array types.
- *
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public final class SetEditor extends AbstractCollectionConverter {
- public SetEditor() {
- super(Set.class);
- }
-
- protected Object createCollection(List list) {
- return new LinkedHashSet(list);
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ShortEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ShortEditor.java
deleted file mode 100644
index 11bf276..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/ShortEditor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class ShortEditor extends AbstractConverter {
- public ShortEditor() {
- super(Short.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- return Short.valueOf(text);
- } catch (Exception e) {
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/SortedMapEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/SortedMapEditor.java
deleted file mode 100644
index f8507ee..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/SortedMapEditor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.SortedMap;
-
-/**
- * A property editor for indirect property bundles. This editor
- * transforms the text value of the propery into a Property resource bundle.
- *
- * @version $Rev: 6680 $
- */
-public class SortedMapEditor extends AbstractMapConverter {
- public SortedMapEditor() {
- super(SortedMap.class);
- }
-
- protected Map createMap(Map map) {
- Map finalMap = new TreeMap(map);
- return finalMap;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/SortedSetEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/SortedSetEditor.java
deleted file mode 100644
index efe992e..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/SortedSetEditor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.util.List;
-import java.util.TreeSet;
-
-/**
- * Adapter for editing array types.
- *
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public final class SortedSetEditor extends AbstractCollectionConverter {
- public SortedSetEditor() {
- super(TreeSet.class);
- }
-
- protected Object createCollection(List list) {
- return new TreeSet(list);
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/StringEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/StringEditor.java
deleted file mode 100644
index b6507a9..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/StringEditor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class StringEditor extends AbstractConverter {
- public StringEditor() {
- super(String.class);
- }
-
- protected Object toObjectImpl(String text) {
- return text;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/TreeMapEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/TreeMapEditor.java
deleted file mode 100644
index 0eefd9f..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/TreeMapEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.util.Map;
-import java.util.TreeMap;
-
-/**
- * A property editor for indirect property bundles. This editor
- * transforms the text value of the propery into a Property resource bundle.
- *
- * @version $Rev: 6680 $
- */
-public class TreeMapEditor extends AbstractMapConverter {
- public TreeMapEditor() {
- super(TreeMap.class);
- }
-
- protected Map createMap(Map map) {
- Map finalMap = new TreeMap(map);
- return finalMap;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/TreeSetEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/TreeSetEditor.java
deleted file mode 100644
index 944edc3..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/TreeSetEditor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.util.List;
-import java.util.TreeSet;
-
-/**
- * Adapter for editing array types.
- *
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public final class TreeSetEditor extends AbstractCollectionConverter {
- public TreeSetEditor() {
- super(TreeSet.class);
- }
-
- protected Object createCollection(List list) {
- return new TreeSet(list);
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/URIEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/URIEditor.java
deleted file mode 100644
index 575c589..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/URIEditor.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class URIEditor extends AbstractConverter {
- public URIEditor() {
- super(URI.class);
- }
-
- protected Object toObjectImpl(String text) {
- try {
- return new URI(text);
- } catch (URISyntaxException e) {
- throw new PropertyEditorException(e);
- }
- }
-
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/URLEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/URLEditor.java
deleted file mode 100644
index e80fef3..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/URLEditor.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * A property editor for URL typed properties.
- *
- * @version $Rev: 6680 $
- */
-public class URLEditor extends AbstractConverter {
- public URLEditor() {
- super(URL.class);
- }
-
- /**
- * Convert the text value of the property into a URL object instance.
- *
- * @return a URL object constructed from the property text value.
- */
- protected Object toObjectImpl(String text) {
- try {
- // try to create directly from the text property.
- URL url = new URL(text);
- // this parsed correctly, but if this is a file object,
- // we need to make sure this gets converted into the proper
- // absolute directory form.
- try {
- if (url.getProtocol().equals("file")) {
- // ok, this is a file URL, so get the file string portion,
- // convert that to a file object, then go through the URI()/URL()
- // conversion sequence to get a fully valid URL().
- return new File(url.getFile()).toURI().toURL();
- }
- } catch (Exception e) {
- // any error here is returned as a property editor exception.
- throw new PropertyEditorException(e);
- }
-
- return url;
- } catch (MalformedURLException e) {
- // this is a format error, but it could have been specified as a local
- // file name. so try to create a file object and make a URL from that.
- }
-
- try {
- // The file class has direct support for returning as a URL, but the Javadoc
- // for File.toURL() recommends converting the File object to a URI first
- // so that untranslatable characters get handled correctly.
- return new File(text).toURI().toURL();
- } catch (MalformedURLException e) {
- // any error here is returned as a property editor exception.
- throw new PropertyEditorException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/VectorEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/VectorEditor.java
deleted file mode 100644
index 50dbda4..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/VectorEditor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.propertyeditor;
-
-import java.util.List;
-import java.util.Vector;
-
-/**
- * Adapter for editing array types.
- *
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public final class VectorEditor extends AbstractCollectionConverter {
- public VectorEditor() {
- super(Vector.class);
- }
-
- protected Object createCollection(List list) {
- return new Vector(list);
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/WeakHashMapEditor.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/WeakHashMapEditor.java
deleted file mode 100644
index 1d9cd4a..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/WeakHashMapEditor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.propertyeditor;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-/**
- * A property editor for indirect property bundles. This editor
- * transforms the text value of the propery into a Property resource bundle.
- *
- * @version $Rev: 6680 $
- */
-public class WeakHashMapEditor extends AbstractMapConverter {
- public WeakHashMapEditor() {
- super(WeakHashMap.class);
- }
-
- protected Map createMap(Map map) {
- Map finalMap = new WeakHashMap(map);
- return finalMap;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/CollectionRecipe.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/CollectionRecipe.java
deleted file mode 100644
index 9be7c7c..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/CollectionRecipe.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.recipe;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.xbean.ClassLoading;
-
-/**
- * @version $Rev: 6685 $ $Date: 2005-12-28T00:29:37.967210Z $
- */
-public class CollectionRecipe implements Recipe {
- private final List list;
- private final String type;
-
- public CollectionRecipe() {
- list = new ArrayList();
- type = ArrayList.class.getName();
- }
-
- public CollectionRecipe(String type) {
- list = new ArrayList();
- this.type = type;
- }
-
- public CollectionRecipe(Class type) {
- if (type == null) throw new NullPointerException("type is null");
- if (!RecipeHelper.hasDefaultConstructor(type)) throw new IllegalArgumentException("Type does not have a default constructor " + type);
- this.list = new ArrayList();
- this.type = type.getName();
- }
-
- public CollectionRecipe(Collection collection) {
- if (collection == null) throw new NullPointerException("collection is null");
-
- this.list = new ArrayList(collection.size());
-
- // If the specified set has a default constructor we will recreate the set, otherwise we use a the default
- if (RecipeHelper.hasDefaultConstructor(collection.getClass())) {
- this.type = collection.getClass().getName();
- } else if (collection instanceof SortedSet) {
- this.type = TreeSet.class.getName();
- } else if (collection instanceof Set) {
- this.type = LinkedHashSet.class.getName();
- } else {
- this.type = ArrayList.class.getName();
- }
- addAll(collection);
- }
-
- public CollectionRecipe(String type, Collection collection) {
- if (type == null) throw new NullPointerException("type is null");
- if (collection == null) throw new NullPointerException("collection is null");
- this.list = new ArrayList(collection.size());
- this.type = type;
- addAll(collection);
- }
-
- public CollectionRecipe(Class type, Collection collection) {
- if (type == null) throw new NullPointerException("type is null");
- if (!RecipeHelper.hasDefaultConstructor(type)) throw new IllegalArgumentException("Type does not have a default constructor " + type);
- if (collection == null) throw new NullPointerException("collection is null");
- this.list = new ArrayList(collection.size());
- this.type = type.getName();
- addAll(collection);
- }
-
- public CollectionRecipe(CollectionRecipe collectionRecipe) {
- if (collectionRecipe == null) throw new NullPointerException("setRecipe is null");
- this.type = collectionRecipe.type;
- list = new ArrayList(collectionRecipe.list);
- }
-
- public Object create(ClassLoader classLoader) {
- Class setType = null;
- try {
- setType = ClassLoading.loadClass(type, classLoader);
- } catch (ClassNotFoundException e) {
- throw new ConstructionException("Type class could not be found: " + type);
- }
-
- if (!RecipeHelper.hasDefaultConstructor(setType)) {
- throw new ConstructionException("Type does not have a default constructor " + type);
- }
-
- Object o;
- try {
- o = setType.newInstance();
- } catch (Exception e) {
- throw new ConstructionException("Error while creating set instance: " + type);
- }
-
- if(!(o instanceof Collection)) {
- throw new ConstructionException("Specified set type does not implement the Collection interface: " + type);
- }
-
- Collection instance = (Collection) o;
- int i =0;
- for (Iterator iterator = list.iterator(); iterator.hasNext();) {
- Object value = iterator.next();
- if (value instanceof Recipe) {
- Recipe recipe = (Recipe) value;
- try {
- value = recipe.create(classLoader);
- } catch (ConstructionException e) {
- e.setPrependAttributeName("[" + type + " item " + i + "]");
- throw e;
- }
- }
- instance.add(value);
- i++;
- }
- return instance;
- }
-
- public void add(Boolean value) {
- if (value == null) throw new NullPointerException("value is null");
- list.add(value);
- }
-
- public void add(Character value) {
- if (value == null) throw new NullPointerException("value is null");
- list.add(value);
- }
-
- public void add(Byte value) {
- if (value == null) throw new NullPointerException("value is null");
- list.add(value);
- }
-
- public void add(Short value) {
- if (value == null) throw new NullPointerException("value is null");
- list.add(value);
- }
-
- public void add(Integer value) {
- if (value == null) throw new NullPointerException("value is null");
- list.add(value);
- }
-
- public void add(Long value) {
- if (value == null) throw new NullPointerException("value is null");
- list.add(value);
- }
-
- public void add(Float value) {
- if (value == null) throw new NullPointerException("value is null");
- list.add(value);
- }
-
- public void add(Double value) {
- if (value == null) throw new NullPointerException("value is null");
- list.add(value);
- }
-
- public void add(String value) {
- if (value == null) throw new NullPointerException("value is null");
- list.add(value);
- }
-
- public void add(Recipe value) {
- if (value == null) throw new NullPointerException("value is null");
- list.add(value);
- }
-
- public void addAll(Collection value) {
- if (value == null) throw new NullPointerException("value is null");
- for (Iterator iterator = value.iterator(); iterator.hasNext();) {
- Object o = iterator.next();
- if (o instanceof Boolean) {
- add((Boolean)o);
- } else if (o instanceof Character) {
- add((Character)o);
- } else if (o instanceof Byte) {
- add((Byte)o);
- } else if (o instanceof Short) {
- add((Short)o);
- } else if (o instanceof Integer) {
- add((Integer)o);
- } else if (o instanceof Long) {
- add((Long)o);
- } else if (o instanceof Float) {
- add((Float)o);
- } else if (o instanceof Double) {
- add((Double)o);
- } else if (o instanceof String) {
- add((String)o);
- } else if (o instanceof Recipe) {
- add((Recipe)o);
- } else {
- add(new ValueRecipe(o));
- }
- }
- }
-
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ConstructionException.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ConstructionException.java
deleted file mode 100644
index ccc93c4..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ConstructionException.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.recipe;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public class ConstructionException extends RuntimeException {
- private String beanName;
- private String attributeName;
-
- public ConstructionException() {
- }
-
- public ConstructionException(String message) {
- super(message);
- }
-
- public ConstructionException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ConstructionException(Throwable cause) {
- super(cause);
- }
-
- public String getBeanName() {
- return beanName;
- }
-
- public void setBeanName(String beanName) {
- this.beanName = beanName;
- }
-
- public String getAttributeName() {
- return attributeName;
- }
-
- public void setAttributeName(String attributeName) {
- this.attributeName = attributeName;
- }
-
- public void setPrependAttributeName(String attributeName) {
- this.attributeName += attributeName;
- }
-
- public String getMessage() {
- return "Unable to create bean " + beanName + " attribute " + attributeName + ": " + super.getMessage();
-
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/MapRecipe.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/MapRecipe.java
deleted file mode 100644
index d74bcca..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/MapRecipe.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.recipe;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.apache.xbean.ClassLoading;
-
-/**
- * @version $Rev: 6687 $ $Date: 2005-12-28T21:08:56.733437Z $
- */
-public class MapRecipe implements Recipe {
- private final List entries;
- private final String type;
-
- public MapRecipe() {
- type = LinkedHashMap.class.getName();
- entries = new ArrayList();
- }
-
- public MapRecipe(String type) {
- this.type = type;
- entries = new ArrayList();
- }
-
- public MapRecipe(Class type) {
- this.type = type.getName();
- if (!RecipeHelper.hasDefaultConstructor(type)) throw new IllegalArgumentException("Type does not have a default constructor " + type);
- entries = new ArrayList();
- }
-
- public MapRecipe(Map map) {
- if (map == null) throw new NullPointerException("map is null");
-
- entries = new ArrayList(map.size());
-
- // If the specified set has a default constructor we will recreate the set, otherwise we use a LinkedHashMap or TreeMap
- if (RecipeHelper.hasDefaultConstructor(map.getClass())) {
- this.type = map.getClass().getName();
- } else if (map instanceof SortedMap) {
- this.type = TreeMap.class.getName();
- } else {
- this.type = LinkedHashMap.class.getName();
- }
- putAll(map);
- }
-
- public MapRecipe(String type, Map map) {
- if (map == null) throw new NullPointerException("map is null");
- this.type = type;
- entries = new ArrayList(map.size());
- putAll(map);
- }
-
- public MapRecipe(Class type, Map map) {
- if (map == null) throw new NullPointerException("map is null");
- if (!RecipeHelper.hasDefaultConstructor(type)) throw new IllegalArgumentException("Type does not have a default constructor " + type);
- this.type = type.getName();
- entries = new ArrayList(map.size());
- putAll(map);
- }
-
- public MapRecipe(MapRecipe mapRecipe) {
- if (mapRecipe == null) throw new NullPointerException("mapRecipe is null");
- this.type = mapRecipe.type;
- entries = new ArrayList(mapRecipe.entries);
- }
-
- public Object create(ClassLoader classLoader) {
- Class mapType = null;
- try {
- mapType = ClassLoading.loadClass(type, classLoader);
- } catch (ClassNotFoundException e) {
- throw new ConstructionException("Type class could not be found: " + type);
- }
-
- if (!RecipeHelper.hasDefaultConstructor(mapType)) {
- throw new ConstructionException("Type does not have a default constructor " + type);
- }
-
- Object o;
- try {
- o = mapType.newInstance();
- } catch (Exception e) {
- throw new ConstructionException("Error while creating set instance: " + type);
- }
-
- if(!(o instanceof Map)) {
- throw new ConstructionException("Specified map type does not implement the Map interface: " + type);
- }
-
- Map instance = (Map) o;
- for (Iterator iterator = entries.iterator(); iterator.hasNext();) {
- Object[] entry = (Object[]) iterator.next();
-
- Object key = entry[0];
- if (key instanceof Recipe) {
- Recipe recipe = (Recipe) key;
- try {
- key = recipe.create(classLoader);
- } catch (ConstructionException e) {
- e.setPrependAttributeName("[" + type + " " + key + "]");
- throw e;
- }
- }
-
- Object value = entry[1];
- if (value instanceof Recipe) {
- Recipe recipe = (Recipe) value;
- try {
- value = recipe.create(classLoader);
- } catch (ConstructionException e) {
- e.setPrependAttributeName("[" + type + " " + key + "]");
- throw e;
- }
- }
-
- instance.put(key, value);
- }
- return instance;
- }
-
- public void put(Object key, Object value) {
- if (key == null) throw new NullPointerException("key is null");
- if (!RecipeHelper.isSimpleType(key)) {
- key = new ValueRecipe(key);
- }
- if (!RecipeHelper.isSimpleType(value)) {
- value = new ValueRecipe(value);
- }
- entries.add(new Object[] { key, value});
- }
-
- public void putAll(Map map) {
- if (map == null) throw new NullPointerException("map is null");
- for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- Object key = entry.getKey();
- Object value = entry.getValue();
- put(key, value);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ObjectRecipe.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ObjectRecipe.java
deleted file mode 100644
index e023031..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ObjectRecipe.java
+++ /dev/null
@@ -1,611 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.recipe;
-
-import org.apache.xbean.ClassLoading;
-import org.apache.xbean.propertyeditor.PropertyEditors;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @version $Rev: 6688 $ $Date: 2005-12-29T02:08:29.200064Z $
- */
-public class ObjectRecipe implements Recipe {
- private final String type;
- private final String factoryMethod;
- private final String[] constructorArgNames;
- private final Class[] constructorArgTypes;
- private final LinkedHashMap properties;
-
- public ObjectRecipe(Class type) {
- this(type.getName());
- }
-
- public ObjectRecipe(Class type, String factoryMethod) {
- this(type.getName(), factoryMethod);
- }
-
- public ObjectRecipe(Class type, Map properties) {
- this(type.getName(), properties);
- }
-
- public ObjectRecipe(Class type, String[] constructorArgNames, Class[] constructorArgTypes) {
- this(type.getName(), constructorArgNames, constructorArgTypes);
- }
-
- public ObjectRecipe(Class type, String factoryMethod, String[] constructorArgNames, Class[] constructorArgTypes) {
- this(type.getName(), factoryMethod, constructorArgNames, constructorArgTypes);
- }
-
- public ObjectRecipe(String typeName) {
- this(typeName, null, null, null, null);
- }
-
- public ObjectRecipe(String typeName, String factoryMethod) {
- this(typeName, factoryMethod, null, null, null);
- }
-
- public ObjectRecipe(String typeName, Map properties) {
- this(typeName, null, null, null, properties);
- }
-
- public ObjectRecipe(String typeName, String[] constructorArgNames, Class[] constructorArgTypes) {
- this(typeName, null, constructorArgNames, constructorArgTypes, null);
- }
-
- public ObjectRecipe(String typeName, String factoryMethod, String[] constructorArgNames, Class[] constructorArgTypes) {
- this(typeName, factoryMethod, constructorArgNames, constructorArgTypes, null);
- }
-
- public ObjectRecipe(String type, String factoryMethod, String[] constructorArgNames, Class[] constructorArgTypes, Map properties) {
- this.type = type;
- this.factoryMethod = factoryMethod;
- if (constructorArgNames != null) {
- this.constructorArgNames = constructorArgNames;
- } else {
- this.constructorArgNames = new String[0];
- }
- if (constructorArgTypes != null) {
- this.constructorArgTypes = constructorArgTypes;
- } else {
- this.constructorArgTypes = new Class[0];
- }
- if (properties != null) {
- this.properties = new LinkedHashMap(properties);
- setAllProperties(properties);
- } else {
- this.properties = new LinkedHashMap();
- }
- }
-
- public Object getProperty(String name) {
- if (name == null) throw new NullPointerException("name is null");
- Object value = properties.get(name);
- return value;
- }
-
- public void setProperty(String name, Object value) {
- if (name == null) throw new NullPointerException("name is null");
- if (!RecipeHelper.isSimpleType(value)) {
- value = new ValueRecipe(value);
- }
- properties.put(name, value);
- }
-
- public void setAllProperties(Map map) {
- if (map == null) throw new NullPointerException("map is null");
- for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String name = (String) entry.getKey();
- Object value = entry.getValue();
- setProperty(name, value);
- }
- }
-
- public Object create() throws ConstructionException {
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- return create(contextClassLoader);
- }
-
- public Object create(ClassLoader classLoader) throws ConstructionException {
- // load the type class
- Class typeClass = null;
- try {
- typeClass = ClassLoading.loadClass(type, classLoader);
- } catch (ClassNotFoundException e) {
- throw new ConstructionException("Type class could not be found: " + type);
- }
-
- // verify that is is a class we can construct
- if (!Modifier.isPublic(typeClass.getModifiers())) {
- throw new ConstructionException("Class is not public: " + ClassLoading.getClassName(typeClass, true));
- }
- if (Modifier.isInterface(typeClass.getModifiers())) {
- throw new ConstructionException("Class is an interface: " + ClassLoading.getClassName(typeClass, true));
- }
- if (Modifier.isAbstract(typeClass.getModifiers())) {
- throw new ConstructionException("Class is abstract: " + ClassLoading.getClassName(typeClass, true));
- }
-
- // get object values for all recipe properties
- Map propertyValues = new LinkedHashMap(properties);
- for (Iterator iterator = propertyValues.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- Object value = entry.getValue();
- if (value instanceof Recipe) {
- Recipe recipe = ((Recipe) value);
- value = recipe.create(classLoader);
- entry.setValue(value);
- }
- }
-
- // create the instance
- Object instance = createInstance(typeClass, propertyValues);
-
- // set remaining properties
- for (Iterator iterator = propertyValues.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String propertyName = (String) entry.getKey();
- Object propertyValue = entry.getValue();
- Method setter = findSetter(typeClass, propertyName, propertyValue);
- try {
- propertyValue = convert(setter.getParameterTypes()[0], propertyValue);
- setter.invoke(instance, new Object[]{propertyValue});
- } catch (Exception e) {
- throw new ConstructionException("Error setting property: " + setter);
- }
- }
- return instance;
- }
-
- private Object[] extractConstructorArgs(Map propertyValues, Class[] constructorArgTypes) {
- Object[] parameters = new Object[constructorArgNames.length];
- for (int i = 0; i < constructorArgNames.length; i++) {
- String name = constructorArgNames[i];
- Class type = constructorArgTypes[i];
-
- Object value;
- if (propertyValues.containsKey(name)) {
- value = propertyValues.remove(name);
- if (!isInstance(type, value) && !isConvertable(type, value)) {
- throw new ConstructionException("Invalid and non-convertable constructor parameter type: " +
- "name=" + name + ", " +
- "index=" + i + ", " +
- "expected=" + ClassLoading.getClassName(type, true) + ", " +
- "actual=" + ClassLoading.getClassName(value, true));
- }
- value = convert(type, value);
- } else {
- value = getDefaultValue(type);
- }
-
-
- parameters[i] = value;
- }
- return parameters;
- }
-
- private static Object convert(Class type, Object value) {
- if (value instanceof String && (type != Object.class)) {
- String stringValue = (String) value;
- value = PropertyEditors.getValue(type, stringValue);
- }
- return value;
- }
-
- private static Object getDefaultValue(Class type) {
- if (type.equals(Boolean.TYPE)) {
- return Boolean.FALSE;
- } else if (type.equals(Character.TYPE)) {
- return new Character((char) 0);
- } else if (type.equals(Byte.TYPE)) {
- return new Byte((byte) 0);
- } else if (type.equals(Short.TYPE)) {
- return new Short((short) 0);
- } else if (type.equals(Integer.TYPE)) {
- return new Integer(0);
- } else if (type.equals(Long.TYPE)) {
- return new Long(0);
- } else if (type.equals(Float.TYPE)) {
- return new Float(0);
- } else if (type.equals(Double.TYPE)) {
- return new Double(0);
- }
- return null;
- }
-
- private Object createInstance(Class typeClass, Map propertyValues) {
- if (factoryMethod != null) {
- Method method = selectFactory(typeClass);
- // get the constructor parameters
- Object[] parameters = extractConstructorArgs(propertyValues, method.getParameterTypes());
-
- try {
- Object object = method.invoke(null, parameters);
- return object;
- } catch (Exception e) {
- Throwable t = e;
- if (e instanceof InvocationTargetException) {
- InvocationTargetException invocationTargetException = (InvocationTargetException) e;
- if (invocationTargetException.getCause() != null) {
- t = invocationTargetException.getCause();
- }
- }
- throw new ConstructionException("Error invoking factory method: " + method, t);
- }
- } else {
- Constructor constructor = selectConstructor(typeClass);
- // get the constructor parameters
- Object[] parameters = extractConstructorArgs(propertyValues, constructor.getParameterTypes());
-
- try {
- Object object = constructor.newInstance(parameters);
- return object;
- } catch (Exception e) {
- Throwable t = e;
- if (e instanceof InvocationTargetException) {
- InvocationTargetException invocationTargetException = (InvocationTargetException) e;
- if (invocationTargetException.getCause() != null) {
- t = invocationTargetException.getCause();
- }
- }
- throw new ConstructionException("Error invoking constructor: " + constructor, t);
- }
- }
- }
-
- private Method selectFactory(Class typeClass) {
- if (constructorArgNames.length > 0 && constructorArgTypes.length == 0) {
- ArrayList matches = new ArrayList();
-
- Method[] methods = typeClass.getMethods();
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- if (method.getName().equals(factoryMethod) && method.getParameterTypes().length == constructorArgNames.length) {
- try {
- checkFactory(method);
- matches.add(method);
- } catch (Exception dontCare) {
- }
- }
- }
-
- if (matches.size() < 1) {
- StringBuffer buffer = new StringBuffer("No parameter types supplied; unable to find a potentially valid factory method: ");
- buffer.append("public static Object ").append(factoryMethod);
- buffer.append(toArgumentList(constructorArgNames));
- throw new ConstructionException(buffer.toString());
- } else if (matches.size() > 1) {
- StringBuffer buffer = new StringBuffer("No parameter types supplied; found too many potentially valid factory methods: ");
- buffer.append("public static Object ").append(factoryMethod);
- buffer.append(toArgumentList(constructorArgNames));
- throw new ConstructionException(buffer.toString());
- }
-
- return (Method) matches.get(0);
- }
-
- try {
- Method method = typeClass.getMethod(factoryMethod, constructorArgTypes);
-
- checkFactory(method);
-
- return method;
- } catch (NoSuchMethodException e) {
- // try to find a matching private method
- Method[] methods = typeClass.getDeclaredMethods();
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- if (method.getName().equals(factoryMethod) && isAssignableFrom(constructorArgTypes, method.getParameterTypes())) {
- if (!Modifier.isPublic(method.getModifiers())) {
- throw new ConstructionException("Factory method is not public: " + method);
- }
- }
- }
-
- StringBuffer buffer = new StringBuffer("Unable to find a valid factory method: ");
- buffer.append("public static Object ").append(ClassLoading.getClassName(typeClass, true)).append(".");
- buffer.append(factoryMethod).append(toParameterList(constructorArgTypes));
- throw new ConstructionException(buffer.toString());
- }
- }
-
- private void checkFactory(Method method) {
- if (!Modifier.isPublic(method.getModifiers())) {
- // this will never occur since private methods are not returned from
- // getMethod, but leave this here anyway, just to be safe
- throw new ConstructionException("Factory method is not public: " + method);
- }
-
- if (!Modifier.isStatic(method.getModifiers())) {
- throw new ConstructionException("Factory method is not static: " + method);
- }
-
- if (method.getReturnType().equals(Void.TYPE)) {
- throw new ConstructionException("Factory method does not return anything: " + method);
- }
-
- if (method.getReturnType().isPrimitive()) {
- throw new ConstructionException("Factory method returns a primitive type: " + method);
- }
- }
-
- private Constructor selectConstructor(Class typeClass) {
- if (constructorArgNames.length > 0 && constructorArgTypes.length == 0) {
- ArrayList matches = new ArrayList();
-
- Constructor[] constructors = typeClass.getConstructors();
- for (int i = 0; i < constructors.length; i++) {
- Constructor constructor = constructors[i];
- if (constructor.getParameterTypes().length == constructorArgNames.length) {
- matches.add(constructor);
- }
- }
-
- if (matches.size() < 1) {
- StringBuffer buffer = new StringBuffer("No parameter types supplied; unable to find a potentially valid constructor: ");
- buffer.append("constructor= public ").append(ClassLoading.getClassName(typeClass, true));
- buffer.append(toArgumentList(constructorArgNames));
- throw new ConstructionException(buffer.toString());
- } else if (matches.size() > 1) {
- StringBuffer buffer = new StringBuffer("No parameter types supplied; found too many potentially valid constructors: ");
- buffer.append("constructor= public ").append(ClassLoading.getClassName(typeClass, true));
- buffer.append(toArgumentList(constructorArgNames));
- throw new ConstructionException(buffer.toString());
- }
-
- return (Constructor) matches.get(0);
- }
-
- try {
- Constructor constructor = typeClass.getConstructor(constructorArgTypes);
-
- if (!Modifier.isPublic(constructor.getModifiers())) {
- // this will never occur since private constructors are not returned from
- // getConstructor, but leave this here anyway, just to be safe
- throw new ConstructionException("Constructor is not public: " + constructor);
- }
-
- return constructor;
- } catch (NoSuchMethodException e) {
- // try to find a matching private method
- Constructor[] constructors = typeClass.getDeclaredConstructors();
- for (int i = 0; i < constructors.length; i++) {
- Constructor constructor = constructors[i];
- if (isAssignableFrom(constructorArgTypes, constructor.getParameterTypes())) {
- if (!Modifier.isPublic(constructor.getModifiers())) {
- throw new ConstructionException("Constructor is not public: " + constructor);
- }
- }
- }
-
- StringBuffer buffer = new StringBuffer("Unable to find a valid constructor: ");
- buffer.append("constructor= public ").append(ClassLoading.getClassName(typeClass, true));
- buffer.append(toParameterList(constructorArgTypes));
- throw new ConstructionException(buffer.toString());
- }
- }
-
- private String toParameterList(Class[] parameterTypes) {
- StringBuffer buffer = new StringBuffer();
- buffer.append("(");
- for (int i = 0; i < parameterTypes.length; i++) {
- Class type = parameterTypes[i];
- if (i > 0) buffer.append(", ");
- buffer.append(ClassLoading.getClassName(type, true));
- }
- buffer.append(")");
- return buffer.toString();
- }
-
- private String toArgumentList(String[] parameterNames) {
- StringBuffer buffer = new StringBuffer();
- buffer.append("(");
- for (int i = 0; i < parameterNames.length; i++) {
- String parameterName = parameterNames[i];
- if (i > 0) buffer.append(", ");
- buffer.append('<').append(parameterName).append('>');
- }
- buffer.append(")");
- return buffer.toString();
- }
-
- public static Method findSetter(Class typeClass, String propertyName, Object propertyValue) {
- if (propertyName == null) throw new NullPointerException("name is null");
- if (propertyName.length() == 0) throw new IllegalArgumentException("name is an empty string");
-
- String setterName = "set" + Character.toUpperCase(propertyName.charAt(0));
- if (propertyName.length() > 0) {
- setterName += propertyName.substring(1);
- }
-
- int matchLevel = 0;
- ConstructionException missException = null;
-
- List methods = new ArrayList(Arrays.asList(typeClass.getMethods()));
- methods.addAll(Arrays.asList(typeClass.getDeclaredMethods()));
- for (Iterator iterator = methods.iterator(); iterator.hasNext();) {
- Method method = (Method) iterator.next();
- if (method.getName().equals(setterName)) {
- if (method.getParameterTypes().length == 0) {
- if (matchLevel < 1) {
- matchLevel = 1;
- missException = new ConstructionException("Setter takes no parameters: " + method);
- }
- continue;
- }
-
- if (method.getParameterTypes().length > 1) {
- if (matchLevel < 1) {
- matchLevel = 1;
- missException = new ConstructionException("Setter takes more then one parameter: " + method);
- }
- continue;
- }
-
- if (method.getReturnType() != Void.TYPE) {
- if (matchLevel < 2) {
- matchLevel = 2;
- missException = new ConstructionException("Setter returns a value: " + method);
- }
- continue;
- }
-
- if (Modifier.isAbstract(method.getModifiers())) {
- if (matchLevel < 3) {
- matchLevel = 3;
- missException = new ConstructionException("Setter is abstract: " + method);
- }
- continue;
- }
-
- if (!Modifier.isPublic(method.getModifiers())) {
- if (matchLevel < 4) {
- matchLevel = 4;
- missException = new ConstructionException("Setter is not public: " + method);
- }
- continue;
- }
-
- if (Modifier.isStatic(method.getModifiers())) {
- if (matchLevel < 4) {
- matchLevel = 4;
- missException = new ConstructionException("Setter is static: " + method);
- }
- continue;
- }
-
- Class methodParameterType = method.getParameterTypes()[0];
- if (methodParameterType.isPrimitive() && propertyValue == null) {
- if (matchLevel < 6) {
- matchLevel = 6;
- missException = new ConstructionException("Null can not be assigned to " +
- ClassLoading.getClassName(methodParameterType, true) + ": " + method);
- }
- continue;
- }
-
-
- if (!isInstance(methodParameterType, propertyValue) && !isConvertable(methodParameterType, propertyValue)) {
- if (matchLevel < 5) {
- matchLevel = 5;
- missException = new ConstructionException(ClassLoading.getClassName(propertyValue, true) + " can not be assigned or converted to " +
- ClassLoading.getClassName(methodParameterType, true) + ": " + method);
- }
- continue;
- }
- return method;
- }
-
- }
-
- if (missException != null) {
- throw missException;
- } else {
- StringBuffer buffer = new StringBuffer("Unable to find a valid setter method: ");
- buffer.append("public void ").append(ClassLoading.getClassName(typeClass, true)).append(".");
- buffer.append(setterName).append("(").append(ClassLoading.getClassName(propertyValue, true)).append(")");
- throw new ConstructionException(buffer.toString());
- }
- }
-
- public static boolean isConvertable(Class methodParameterType, Object propertyValue) {
- return (propertyValue instanceof String && PropertyEditors.canConvert(methodParameterType));
- }
-
- public static boolean isInstance(Class type, Object instance) {
- if (type.isPrimitive()) {
- // for primitives the insance can't be null
- if (instance == null) {
- return false;
- }
-
- // verify instance is the correct wrapper type
- if (type.equals(boolean.class)) {
- return instance instanceof Boolean;
- } else if (type.equals(char.class)) {
- return instance instanceof Character;
- } else if (type.equals(byte.class)) {
- return instance instanceof Byte;
- } else if (type.equals(short.class)) {
- return instance instanceof Short;
- } else if (type.equals(int.class)) {
- return instance instanceof Integer;
- } else if (type.equals(long.class)) {
- return instance instanceof Long;
- } else if (type.equals(float.class)) {
- return instance instanceof Float;
- } else if (type.equals(double.class)) {
- return instance instanceof Double;
- } else {
- throw new AssertionError("Invalid primitve type: " + type);
- }
- }
-
- return instance == null || type.isInstance(instance);
- }
-
- public static boolean isAssignableFrom(Class expected, Class actual) {
- if (expected.isPrimitive()) {
- // verify actual is the correct wrapper type
- if (expected.equals(boolean.class)) {
- return actual.equals(Boolean.class);
- } else if (expected.equals(char.class)) {
- return actual.equals(Character.class);
- } else if (expected.equals(byte.class)) {
- return actual.equals(Byte.class);
- } else if (expected.equals(short.class)) {
- return actual.equals(Short.class);
- } else if (expected.equals(int.class)) {
- return actual.equals(Integer.class);
- } else if (expected.equals(long.class)) {
- return actual.equals(Long.class);
- } else if (expected.equals(float.class)) {
- return actual.equals(Float.class);
- } else if (expected.equals(double.class)) {
- return actual.equals(Double.class);
- } else {
- throw new AssertionError("Invalid primitve type: " + expected);
- }
- }
-
- return expected.isAssignableFrom(actual);
- }
-
- public static boolean isAssignableFrom(Class[] expectedTypes, Class[] actualTypes) {
- if (expectedTypes.length != actualTypes.length) {
- return false;
- }
- for (int i = 0; i < expectedTypes.length; i++) {
- Class expectedType = expectedTypes[i];
- Class actualType = actualTypes[i];
- if (!isAssignableFrom(expectedType, actualType)) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/Recipe.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/Recipe.java
deleted file mode 100644
index 4478433..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/Recipe.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.recipe;
-
-import java.io.Serializable;
-
-/**
- * @version $Rev: 6680 $ $Date: 2005-12-24T04:38:27.427468Z $
- */
-public interface Recipe extends Serializable {
- Object create(ClassLoader classLoader) throws ConstructionException;
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/RecipeHelper.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/RecipeHelper.java
deleted file mode 100644
index c9deeb7..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/RecipeHelper.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.recipe;
-
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Constructor;
-
-/**
- * @version $Rev: 6687 $ $Date: 2005-12-28T21:08:56.733437Z $
- */
-public final class RecipeHelper {
- private RecipeHelper() {
- }
-
- public static boolean hasDefaultConstructor(Class type) {
- if (!Modifier.isPublic(type.getModifiers())) {
- return false;
- }
- Constructor[] constructors = type.getConstructors();
- for (int i = 0; i < constructors.length; i++) {
- Constructor constructor = constructors[i];
- if (Modifier.isPublic(constructor.getModifiers()) &&
- constructor.getParameterTypes().length == 0) {
- return true;
- }
- }
- return false;
- }
-
- public static boolean isSimpleType(Object o) {
- return o == null ||
- o instanceof Boolean ||
- o instanceof Character ||
- o instanceof Byte ||
- o instanceof Short ||
- o instanceof Integer ||
- o instanceof Long ||
- o instanceof Float ||
- o instanceof Double ||
- o instanceof String ||
- o instanceof Recipe;
-
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/StaticRecipe.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/StaticRecipe.java
deleted file mode 100644
index bfbedf1..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/StaticRecipe.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.recipe;
-
-/**
- * @version $Rev$ $Date$
- */
-public class StaticRecipe implements Recipe {
-
- private final Object object;
-
- public StaticRecipe(Object object) {
- this.object = object;
- }
-
- public Object create(ClassLoader classLoader) throws ConstructionException {
- return object;
- }
-}
diff --git a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ValueRecipe.java b/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ValueRecipe.java
deleted file mode 100644
index 993d7f0..0000000
--- a/trunk/xbean-reflect/src/main/java/org/apache/xbean/recipe/ValueRecipe.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.recipe;
-
-import org.apache.xbean.propertyeditor.PropertyEditors;
-import org.apache.xbean.propertyeditor.PropertyEditorException;
-import org.apache.xbean.ClassLoading;
-
-
-/**
- * @version $Rev: 6689 $ $Date: 2006-01-02T06:48:49.815187Z $
- */
-public class ValueRecipe implements Recipe {
- private final String type;
- private final String value;
-
- public ValueRecipe(Class type, String value) {
- if (type == null) throw new NullPointerException("type is null");
- if (!PropertyEditors.canConvert(type)) {
- throw new IllegalArgumentException("No converter available for " + ClassLoading.getClassName(type));
- }
- this.type = type.getName();
- this.value = value;
- }
-
- public ValueRecipe(String type, String value) {
- if (type == null) throw new NullPointerException("type is null");
- this.type = type;
- this.value = value;
- }
-
- public ValueRecipe(Object value) {
- if (value == null) throw new NullPointerException("value is null");
- this.type = value.getClass().getName();
- this.value = PropertyEditors.toString(value);
- }
-
- public ValueRecipe(ValueRecipe valueRecipe) {
- if (valueRecipe == null) throw new NullPointerException("valueRecipe is null");
- this.type = valueRecipe.type;
- this.value = valueRecipe.value;
- }
-
- public String getType() {
- return type;
- }
-
- public String getValue() {
- return value;
- }
-
- public Object create(ClassLoader classLoader) {
- if (value == null) {
- return null;
- }
-
- try {
- return PropertyEditors.getValue(type, value, classLoader);
- } catch (PropertyEditorException e) {
- throw new ConstructionException(e);
- }
- }
-}
diff --git a/trunk/xbean-reflect/src/main/resources/META-INF/LICENSE b/trunk/xbean-reflect/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-reflect/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-reflect/src/main/resources/META-INF/NOTICE b/trunk/xbean-reflect/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-reflect/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/ObjectRecipeTest.java b/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/ObjectRecipeTest.java
deleted file mode 100644
index 927fd50..0000000
--- a/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/ObjectRecipeTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.apache.xbean.recipe;
-/**
- * @version $Rev$ $Date$
- */
-
-import junit.framework.TestCase;
-import org.apache.xbean.propertyeditor.PropertyEditors;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-
-public class ObjectRecipeTest extends TestCase {
-
- protected void setUp() throws Exception {
- PropertyEditors.class.getName();
- }
-
- public void testSetters() throws Exception {
-
- ObjectRecipe objectRecipe = new ObjectRecipe(Person.class);
- doTest(objectRecipe);
- }
-
- public void testConstructor() throws Exception {
-
- ObjectRecipe objectRecipe = new ObjectRecipe(Person.class, new String[]{"name", "age", "homePage"}, new Class[]{String.class, Integer.TYPE, URL.class});
- doTest(objectRecipe);
- }
-
- public void testConstructorWithImpliedTypes() throws Exception {
-
- ObjectRecipe objectRecipe = new ObjectRecipe(Person.class, new String[]{"name", "age", "homePage"}, null);
- doTest(objectRecipe);
- }
-
- public void testFactoryMethodAndSetters() throws Exception {
-
- ObjectRecipe objectRecipe = new ObjectRecipe(Person.class, "newInstance");
- doTest(objectRecipe);
- }
-
- public void testFactoryMethodWithParams() throws Exception {
-
- ObjectRecipe objectRecipe = new ObjectRecipe(Person.class, "newInstance", new String[]{"name", "age", "homePage"}, new Class[]{String.class, Integer.TYPE, URL.class});
- doTest(objectRecipe);
- }
-
- public void testFactoryMethodWithImpliedTypes() throws Exception {
-
- ObjectRecipe objectRecipe = new ObjectRecipe(Person.class, "newInstance", new String[]{"name", "age", "homePage"}, null);
- doTest(objectRecipe);
- }
-
- private void doTest(ObjectRecipe objectRecipe) throws Exception {
- Person expected = new Person("Joe", 21, new URL("http://www.acme.org"));
-
- objectRecipe.setProperty("name", "Joe");
- objectRecipe.setProperty("age", "21");
- objectRecipe.setProperty("homePage", "http://www.acme.org");
-
- Person actual = (Person) objectRecipe.create(Person.class.getClassLoader());
- assertEquals("person", expected, actual);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/Person.java b/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/Person.java
deleted file mode 100644
index 4ad748b..0000000
--- a/trunk/xbean-reflect/src/test/java/org/apache/xbean/recipe/Person.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- *
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.recipe;
-
-import java.net.URL;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Person {
-
- private String name;
- private int age;
- private URL homePage;
-
- public Person() {
- }
-
- public Person(String name, int age, URL homePage) {
- this.name = name;
- this.age = age;
- this.homePage = homePage;
- }
-
- public static Person newInstance(){
- return new Person();
- }
-
- public static Person newInstance(String name, int age, URL homePage){
- return new Person(name, age, homePage);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public URL getHomePage() {
- return homePage;
- }
-
- public void setHomePage(URL homePage) {
- this.homePage = homePage;
- }
-
- public String toString() {
- return super.toString() + " (name=\"" + name + "\", age=\"" + age + "\", homePage=\"" + homePage + "\")";
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof Person) {
- Person that = (Person) obj;
- return this.name.equals(that.name) && this.age == that.age && this.homePage.equals(that.homePage);
- }
- return false;
- }
-}
diff --git a/trunk/xbean-sca/LICENSE.txt b/trunk/xbean-sca/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-sca/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-sca/NOTICE.txt b/trunk/xbean-sca/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-sca/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-sca/README.txt b/trunk/xbean-sca/README.txt
deleted file mode 100644
index 3f33bda..0000000
--- a/trunk/xbean-sca/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-This module contains the Spring additions for XBean which add support for the SCA Annotations for
-
-* lifecycle via @Init and @Destroy
-* dependency injection via @Property and @Reference and @ComponentName
-* custom SCA dependency injection meechanisms like @ComponentMetaData @Component @SessionID
diff --git a/trunk/xbean-sca/pom.xml b/trunk/xbean-sca/pom.xml
deleted file mode 100644
index 5d4144a..0000000
--- a/trunk/xbean-sca/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2005-2006 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://maven.apache.org/POM/4.0.0">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean</artifactId>
- <version>2.4-SNAPSHOT</version>
- </parent>
-
- <artifactId>xbean-sca</artifactId>
- <name>XBean :: SCA</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- </dependency>
- <dependency>
- <groupId>lingo</groupId>
- <artifactId>sca-api</artifactId>
- </dependency>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/IntrospectionSupport.java b/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/IntrospectionSupport.java
deleted file mode 100644
index f693fa4..0000000
--- a/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/IntrospectionSupport.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanInitializationException;
-
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Useful base class for introspection of POJOs
- *
- * @version $Revision$
- */
-public abstract class IntrospectionSupport {
-
- protected static final Object[] EMPTY_ARGUMENTS = {};
-
- protected BeanInfo getBeanInfo(Class type) {
- BeanInfo beanInfo;
- try {
- beanInfo = Introspector.getBeanInfo(type);
- }
- catch (IntrospectionException e) {
- throw new BeanInitializationException("Failed to introspect: " + type.getName() + ". Reason: " + e, e);
- }
- return beanInfo;
- }
-
- protected void invokeMethod(Object bean, Method method, Object[] arguments) {
- try {
- method.invoke(bean, arguments);
- }
- catch (Exception e) {
- throw new BeanInitializationException("Failed to invoke: " + method + ". Reason: " + e, e);
- }
- }
-
- protected void setField(Object bean, Field field, Object value) {
- try {
- if (! field.isAccessible()) {
- field.setAccessible(true);
- }
- field.set(bean, value);
- }
- catch (Exception e) {
- throw new BeanInitializationException("Failed to set field: " + field + " to value: " + value + ". Reason: " + e, e);
- }
- }
-
- protected List findMethodsWithAnnotation(Object bean, Class annotation) {
- List answer = new ArrayList();
- appendMethodsWithAnnotation(bean.getClass(), answer, annotation);
- return answer;
- }
-
- protected void appendMethodsWithAnnotation(Class type, List list, Class annotation) {
- Method[] methods = type.getDeclaredMethods();
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- if (hasAnnotation(method, annotation)) {
- list.add(method);
- }
- }
- if (!type.equals(Object.class)) {
- appendMethodsWithAnnotation(type.getSuperclass(), list, annotation);
- }
- }
-
- /**
- * Returns true if the given method has the annotation
- */
- protected boolean hasAnnotation(Method method, Class annotation) {
- return method.getAnnotation(annotation) != null;
- }
-
- protected boolean hasAnnotation(Field field, Class annotation) {
- return field.getAnnotation(annotation) != null;
- }
-
- protected void invokeVoidMethods(Object bean, List methods) throws BeansException {
- for (Iterator iter = methods.iterator(); iter.hasNext();) {
- Method method = (Method) iter.next();
- Class[] parameterTypes = method.getParameterTypes();
- if (parameterTypes.length == 0) {
- try {
- method.invoke(bean, EMPTY_ARGUMENTS);
- }
- catch (IllegalArgumentException e) {
- throw new BeanInitializationException("Should never happen when calling no-parameter method. " + e, e);
- }
- catch (IllegalAccessException e) {
- throw new BeanInitializationException(e.getMessage(), e);
- }
- catch (InvocationTargetException e) {
- throw new BeanInitializationException(e.getMessage(), e);
- }
- }
- }
- }
-
-}
diff --git a/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/ScaAdapter.java b/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/ScaAdapter.java
deleted file mode 100644
index 0759600..0000000
--- a/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/ScaAdapter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.osoa.sca.ModuleContext;
-import org.osoa.sca.model.Component;
-
-/**
- * A pluggable strategy for connecting XBean to some SCA runtime
- *
- * @version $Revision$
- */
-public interface ScaAdapter {
-
- ModuleContext getComponentContext(Object bean, String beanName);
-
- Component getComponentMetaData(Object bean, String beanName);
-
- Object getBeanSessionID(Object bean, String beanName);
-
-}
diff --git a/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/ScaBeanPostProcessor.java b/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/ScaBeanPostProcessor.java
deleted file mode 100644
index 51b66a1..0000000
--- a/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/ScaBeanPostProcessor.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.osoa.sca.annotations.ComponentMetaData;
-import org.osoa.sca.annotations.ComponentName;
-import org.osoa.sca.annotations.Context;
-import org.osoa.sca.annotations.Destroy;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.SessionID;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.factory.BeanInitializationException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
-import org.apache.xbean.sca.impl.DefaultScaAdapter;
-
-import java.beans.BeanInfo;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.List;
-
-/**
- * Performs SCA based dependency injection rules.
- *
- * @version $Revision$
- */
-public class ScaBeanPostProcessor extends IntrospectionSupport implements DestructionAwareBeanPostProcessor, BeanFactoryPostProcessor {
-
- private ScaAdapter scaAdapter;
-
- public ScaBeanPostProcessor() {
- }
-
- public ScaBeanPostProcessor(ScaAdapter scaAdapter) {
- this.scaAdapter = scaAdapter;
- }
-
- public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
- return bean;
- }
-
- public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
- List methods = findMethodsWithAnnotation(bean, Init.class);
- invokeVoidMethods(bean, methods);
- processFields(bean, beanName);
- processProperties(bean, beanName);
- return bean;
- }
-
- public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
- List methods = findMethodsWithAnnotation(bean, Destroy.class);
- invokeVoidMethods(bean, methods);
- }
-
- public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
- String[] beanNames = beanFactory.getBeanDefinitionNames();
- for (int i = 0; i < beanNames.length; i++) {
- String beanName = beanNames[i];
- BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName);
- postProcessBeanDefinition(beanFactory, beanName, beanDefinition);
- }
- }
-
- // Properties
- // -------------------------------------------------------------------------
-
- public ScaAdapter getScaAdapter() {
- if (scaAdapter == null) {
- scaAdapter = createScaAdapter();
- }
- return scaAdapter;
- }
-
- public void setScaAdapter(ScaAdapter scaAdapter) {
- this.scaAdapter = scaAdapter;
- }
-
- // Implementation methods
- // -------------------------------------------------------------------------
- protected void postProcessBeanDefinition(ConfigurableListableBeanFactory beanFactory, String beanName, BeanDefinition definition) throws BeansException {
- Class type = beanFactory.getType(beanName);
- BeanInfo beanInfo = getBeanInfo(type);
- PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- PropertyDescriptor descriptor = descriptors[i];
- processProperty(beanName, definition, descriptor);
- }
- }
-
- protected void processProperty(String beanName, BeanDefinition definition, PropertyDescriptor descriptor) throws BeansException {
- Method method = descriptor.getWriteMethod();
- if (method != null) {
- // TODO should we handle the property.name() attribute?
- // maybe add this to XBean code generator...
-
- Property property = method.getAnnotation(Property.class);
- if (property != null) {
- if (property.required()) {
- // TODO use property.name()?
- String propertyName = descriptor.getName();
- MutablePropertyValues propertyValues = definition.getPropertyValues();
- if (!propertyValues.contains(propertyName)) {
- throw new BeanInitializationException("Mandatory property: " + propertyName + " not specified on bean: " + beanName);
- }
- }
- }
-
- Reference reference = method.getAnnotation(Reference.class);
- if (reference != null) {
- if (reference.required()) {
- // TODO use reference.name()?
- String propertyName = descriptor.getName();
- MutablePropertyValues propertyValues = definition.getPropertyValues();
- if (!propertyValues.contains(propertyName)) {
- throw new BeanInitializationException("Mandatory reference: " + propertyName + " not specified on bean: " + beanName);
- }
- }
- }
- }
- }
-
- protected void processProperties(Object bean, String beanName) throws BeansException {
- BeanInfo beanInfo = getBeanInfo(bean.getClass());
- PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- PropertyDescriptor descriptor = descriptors[i];
- processProperty(bean, beanName, descriptor);
- }
- }
-
- protected void processProperty(Object bean, String beanName, PropertyDescriptor descriptor) throws BeansException {
- Method method = descriptor.getWriteMethod();
- if (method != null) {
- if (hasAnnotation(method, ComponentName.class)) {
- Object[] arguments = new Object[] { beanName };
- invokeMethod(bean, method, arguments);
- }
- if (hasAnnotation(method, ComponentMetaData.class)) {
- Object[] arguments = new Object[] { getScaAdapter().getComponentMetaData(bean, beanName) };
- invokeMethod(bean, method, arguments);
- }
- if (hasAnnotation(method, Context.class)) {
- Object[] arguments = new Object[] { getScaAdapter().getComponentContext(bean, beanName) };
- invokeMethod(bean, method, arguments);
- }
- if (hasAnnotation(method, SessionID.class)) {
- Object[] arguments = new Object[] { getScaAdapter().getBeanSessionID(bean, beanName) };
- invokeMethod(bean, method, arguments);
- }
- }
- }
-
- protected void processFields(Object bean, String beanName) throws BeansException {
- Class type = bean.getClass();
- while (true) {
- Field[] declaredFields = type.getDeclaredFields();
- for (int i = 0; i < declaredFields.length; i++) {
- Field field = declaredFields[i];
- processField(bean, beanName, field);
- }
- if (type.equals(Object.class)) {
- break;
- }
- else {
- type = type.getSuperclass();
- }
- }
- }
-
- protected void processField(Object bean, String beanName, Field field) {
- if (hasAnnotation(field, ComponentName.class)) {
- setField(bean, field, beanName);
- }
- if (hasAnnotation(field, ComponentMetaData.class)) {
- setField(bean, field, getScaAdapter().getComponentMetaData(bean, beanName));
- }
- if (hasAnnotation(field, Context.class)) {
- setField(bean, field, getScaAdapter().getComponentContext(bean, beanName));
- }
- if (hasAnnotation(field, SessionID.class)) {
- setField(bean, field, getScaAdapter().getBeanSessionID(bean, beanName));
- }
-
- }
-
- protected ScaAdapter createScaAdapter() {
- return new DefaultScaAdapter();
- }
-
-}
diff --git a/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/impl/DefaultComponent.java b/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/impl/DefaultComponent.java
deleted file mode 100644
index 25a3b2e..0000000
--- a/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/impl/DefaultComponent.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca.impl;
-
-import org.osoa.sca.model.*;
-
-/**
- *
- * @version $Revision$
- */
-public abstract class DefaultComponent implements Component {
-
- private String name;
- private Implementation implementation;
- private PropertyValues propertyValues;
- private ReferenceValues referenceValues;
-/*
- private Sequence any;
- private Sequence anyAttribute;
-*/
-
- public Implementation getImplementation() {
- return implementation;
- }
-
- public void setImplementation(Implementation implementation) {
- this.implementation = implementation;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public PropertyValues getPropertyValues() {
- return propertyValues;
- }
-
- public void setPropertyValues(PropertyValues propertyValues) {
- this.propertyValues = propertyValues;
- }
-
- public ReferenceValues getReferenceValues() {
- return referenceValues;
- }
-
- public void setReferenceValues(ReferenceValues referenceValues) {
- this.referenceValues = referenceValues;
- }
-
-/*
- public Sequence getAny() {
- return any;
- }
-
- public void setAny(Sequence any) {
- this.any = any;
- }
-
- public Sequence getAnyAttribute() {
- return anyAttribute;
- }
-
- public void setAnyAttribute(Sequence anyAttribute) {
- this.anyAttribute = anyAttribute;
- }
-*/
-
-}
diff --git a/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/impl/DefaultScaAdapter.java b/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/impl/DefaultScaAdapter.java
deleted file mode 100644
index 1bb9bfa..0000000
--- a/trunk/xbean-sca/src/main/java/org/apache/xbean/sca/impl/DefaultScaAdapter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca.impl;
-
-import org.osoa.sca.ModuleContext;
-import org.osoa.sca.annotations.Context;
-import org.osoa.sca.model.Component;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanInitializationException;
-import org.apache.xbean.sca.ScaAdapter;
-
-/**
- * A simple implementation of {@link ScaAdapter}
- *
- * @version $Revision$
- */
-public class DefaultScaAdapter implements ScaAdapter {
- private ModuleContext moduleContext;
-
- public Component getComponentMetaData(Object bean, String beanName) {
- throw new RuntimeException("TODO: Not Implemented yet");
- }
-
- public ModuleContext getComponentContext(Object bean, String beanName) {
- ModuleContext answer = getModuleContext();
- if (answer == null) {
- throw new BeanInitializationException("No moduleContext property is configured so cannot inject its value into bean: " + beanName);
- }
- return answer;
-
- }
-
- public Object getBeanSessionID(Object bean, String beanName) throws BeansException {
- throw new RuntimeException("TODO: Not Implemented yet");
- }
-
- // Properties
- // -------------------------------------------------------------------------
- public ModuleContext getModuleContext() {
- return moduleContext;
- }
-
- @Context
- public void setModuleContext(ModuleContext moduleContext) {
- this.moduleContext = moduleContext;
- }
-}
diff --git a/trunk/xbean-sca/src/main/resources/META-INF/LICENSE b/trunk/xbean-sca/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-sca/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-sca/src/main/resources/META-INF/NOTICE b/trunk/xbean-sca/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-sca/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/FieldInjectionPojo.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/FieldInjectionPojo.java
deleted file mode 100644
index d760b4f..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/FieldInjectionPojo.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.osoa.sca.annotations.ComponentName;
-
-/**
- *
- * @version $Revision$
- */
-public class FieldInjectionPojo {
-
- @ComponentName
- private String componenetName;
-
- private String sessionID;
-
- public String getComponenetName() {
- return componenetName;
- }
-
- public void setComponenetName(String componenetName) {
- this.componenetName = componenetName;
- }
-
- public String getSessionID() {
- return sessionID;
- }
-
- public void setSessionID(String sessionID) {
- this.sessionID = sessionID;
- }
-
-}
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/FieldInjectionTest.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/FieldInjectionTest.java
deleted file mode 100644
index 566d36b..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/FieldInjectionTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- *
- * @version $Revision$
- */
-public class FieldInjectionTest extends SpringTestSupport {
-
-
- public void testComponentName() throws Exception {
- FieldInjectionPojo pojo = (FieldInjectionPojo) getBean("injection");
- assertEquals("componentName", "injection", pojo.getComponenetName());
- }
-
- protected AbstractApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/sca/field-injection.xml");
- }
-
-}
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/LifecyclePojo.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/LifecyclePojo.java
deleted file mode 100644
index de4fc05..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/LifecyclePojo.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.osoa.sca.annotations.Destroy;
-import org.osoa.sca.annotations.Init;
-
-/**
- *
- * @version $Revision$
- */
-public class LifecyclePojo {
-
- @Init
- public void start() throws Exception {
- LifecycleTest.onInitCalled();
- }
-
- @Destroy
- public void stop() throws Exception {
- LifecycleTest.onDestroyCalled();
- }
-}
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/LifecycleTest.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/LifecycleTest.java
deleted file mode 100644
index ca8be96..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/LifecycleTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- *
- * @version $Revision$
- */
-public class LifecycleTest extends SpringTestSupport {
-
- private static int initCounter;
- private static int destroyCounter;
-
- public void testLifecycle() throws Exception {
- getBean("lifecycle");
-
- assertTrue("Should have invoked the initCounter: " + initCounter, initCounter > 0);
- }
-
- protected AbstractApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/sca/lifecycle.xml");
- }
-
- protected void setUp() throws Exception {
- initCounter = destroyCounter = 0;
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
-
- assertTrue("Should have invoked the destroyCounter: " + destroyCounter, destroyCounter > 0);
- }
-
- public static void onInitCalled() {
- System.out.println("@Init called");
- ++initCounter;
- }
-
- public static void onDestroyCalled() {
- System.out.println("@Destroy called");
- ++destroyCounter;
- }
-}
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MandatoryPropertyPojo.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MandatoryPropertyPojo.java
deleted file mode 100644
index 5dada78..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MandatoryPropertyPojo.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.osoa.sca.annotations.Property;
-
-/**
- *
- * @version $Revision$
- */
-public class MandatoryPropertyPojo {
-
- private String cheese;
- private boolean beer;
-
- public String getCheese() {
- return cheese;
- }
-
- @Property(required = true)
- public void setCheese(String cheese) {
- this.cheese = cheese;
- }
-
- public boolean isBeer() {
- return beer;
- }
-
- @Property(required = false)
- public void setBeer(boolean beer) {
- this.beer = beer;
- }
-
-}
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MandatoryReferencePojo.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MandatoryReferencePojo.java
deleted file mode 100644
index 7c4a57f..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MandatoryReferencePojo.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.osoa.sca.annotations.Reference;
-
-/**
- *
- * @version $Revision$
- */
-public class MandatoryReferencePojo {
-
- private String cheese;
- private boolean beer;
-
- public String getCheese() {
- return cheese;
- }
-
- @Reference(required = true)
- public void setCheese(String cheese) {
- this.cheese = cheese;
- }
-
- public boolean isBeer() {
- return beer;
- }
-
- @Reference(required = false)
- public void setBeer(boolean beer) {
- this.beer = beer;
- }
-
-}
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MissingPropertyTest.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MissingPropertyTest.java
deleted file mode 100644
index 453b883..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MissingPropertyTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.springframework.beans.factory.BeanInitializationException;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- *
- * @version $Revision$
- */
-public class MissingPropertyTest extends SpringTestSupport {
-
- public void testMissingProperty() throws Exception {
- assertTrue("Should not have created a valid context", context == null);
- }
-
- protected AbstractApplicationContext createApplicationContext() {
- try {
- ClassPathXmlApplicationContext answer = new ClassPathXmlApplicationContext("org/apache/xbean/sca/missing-property.xml");
- fail("Should have failed to process the context");
- return answer;
- }
- catch (BeanInitializationException e) {
- System.out.println("Caught expected validation exception: " + e);
- return null;
- }
- }
-
-}
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MissingReferenceTest.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MissingReferenceTest.java
deleted file mode 100644
index d77c55f..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/MissingReferenceTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.springframework.beans.factory.BeanInitializationException;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- *
- * @version $Revision$
- */
-public class MissingReferenceTest extends SpringTestSupport {
-
- public void testMissingResource() throws Exception {
- assertTrue("Should not have created a valid context", context == null);
- }
-
- protected AbstractApplicationContext createApplicationContext() {
- try {
- ClassPathXmlApplicationContext answer = new ClassPathXmlApplicationContext("org/apache/xbean/sca/missing-reference.xml");
- fail("Should have failed to process the context");
- return answer;
- }
- catch (BeanInitializationException e) {
- System.out.println("Caught expected validation exception: " + e);
- return null;
- }
- }
-
-}
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/PropertyInjectionPojo.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/PropertyInjectionPojo.java
deleted file mode 100644
index 66415b6..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/PropertyInjectionPojo.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.osoa.sca.annotations.ComponentName;
-
-/**
- *
- * @version $Revision$
- */
-public class PropertyInjectionPojo {
-
- private String sessionID;
- private String componenetName;
-
- public String getComponenetName() {
- return componenetName;
- }
-
- @ComponentName
- public void setComponenetName(String componenetName) {
- this.componenetName = componenetName;
- }
-
- public String getSessionID() {
- return sessionID;
- }
-
- public void setSessionID(String sessionID) {
- this.sessionID = sessionID;
- }
-
-}
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/PropertyInjectionTest.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/PropertyInjectionTest.java
deleted file mode 100644
index 5c0e90a..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/PropertyInjectionTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- *
- * @version $Revision$
- */
-public class PropertyInjectionTest extends SpringTestSupport {
-
-
- public void testComponentName() throws Exception {
- PropertyInjectionPojo pojo = (PropertyInjectionPojo) getBean("injection");
- assertEquals("componentName", "injection", pojo.getComponenetName());
- }
-
- protected AbstractApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/sca/property-injection.xml");
- }
-
-}
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/PropertyTest.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/PropertyTest.java
deleted file mode 100644
index 3c9f73b..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/PropertyTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- *
- * @version $Revision$
- */
-public class PropertyTest extends SpringTestSupport {
-
- public void testProperties() throws Exception {
- MandatoryPropertyPojo pojo = (MandatoryPropertyPojo) getBean("pojo");
- assertEquals("getCheese()", "Edam", pojo.getCheese());
- assertEquals("isBeer()",true, pojo.isBeer());
- }
-
- protected AbstractApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/sca/property.xml");
- }
-
-}
diff --git a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/SpringTestSupport.java b/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/SpringTestSupport.java
deleted file mode 100644
index 1300b19..0000000
--- a/trunk/xbean-sca/src/test/java/org/apache/xbean/sca/SpringTestSupport.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.sca;
-
-import org.springframework.context.support.AbstractApplicationContext;
-
-import junit.framework.TestCase;
-
-/**
- *
- * @version $Revision$
- */
-public abstract class SpringTestSupport extends TestCase {
-
- protected AbstractApplicationContext context;
-
- protected void setUp() throws Exception {
- super.setUp();
- context = createApplicationContext();
- }
-
- protected abstract AbstractApplicationContext createApplicationContext();
-
- protected void tearDown() throws Exception {
- if (context != null) {
- context.destroy();
- context = null;
- }
- super.tearDown();
- }
-
- protected Object getBean(String beanName) throws Exception {
- assertTrue("ApplicationContext should contain bean: " + beanName, context.containsBean(beanName));
- Object answer = context.getBean(beanName);
- return answer;
- }
-
-}
diff --git a/trunk/xbean-sca/src/test/resources/log4j.properties b/trunk/xbean-sca/src/test/resources/log4j.properties
deleted file mode 100755
index 47e7ad3..0000000
--- a/trunk/xbean-sca/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, out
-
-log4j.logger.org.activemq.spring=WARN
-
-# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.out.file=target/test-run.log
-log4j.appender.out.append=true
diff --git a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/field-injection.xml b/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/field-injection.xml
deleted file mode 100644
index 398c51f..0000000
--- a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/field-injection.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-
-<beans>
- <!-- START SNIPPET: sca -->
- <bean id="sca" class="org.apache.xbean.sca.ScaBeanPostProcessor" />
- <!-- END SNIPPET: sca -->
-
- <!-- test case -->
- <bean id="injection" class="org.apache.xbean.sca.FieldInjectionPojo" />
-</beans>
-
diff --git a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/lifecycle.xml b/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/lifecycle.xml
deleted file mode 100644
index 86aafd8..0000000
--- a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/lifecycle.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-
-<beans>
- <!-- START SNIPPET: sca -->
- <bean id="sca" class="org.apache.xbean.sca.ScaBeanPostProcessor" />
- <!-- END SNIPPET: sca -->
-
- <!-- test case -->
- <bean id="lifecycle" class="org.apache.xbean.sca.LifecyclePojo" />
-</beans>
-
diff --git a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/missing-property.xml b/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/missing-property.xml
deleted file mode 100644
index f6d6f2b..0000000
--- a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/missing-property.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-
-<beans>
- <!-- START SNIPPET: sca -->
- <bean id="sca" class="org.apache.xbean.sca.ScaBeanPostProcessor" />
- <!-- END SNIPPET: sca -->
-
- <!-- test case -->
- <bean id="pojo" class="org.apache.xbean.sca.MandatoryPropertyPojo" />
-</beans>
-
diff --git a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/missing-reference.xml b/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/missing-reference.xml
deleted file mode 100644
index f35c368..0000000
--- a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/missing-reference.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-
-<beans>
- <!-- START SNIPPET: sca -->
- <bean id="sca" class="org.apache.xbean.sca.ScaBeanPostProcessor" />
- <!-- END SNIPPET: sca -->
-
- <!-- test case -->
- <bean id="pojo" class="org.apache.xbean.sca.MandatoryReferencePojo" />
-</beans>
-
diff --git a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/property-injection.xml b/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/property-injection.xml
deleted file mode 100644
index 66395c6..0000000
--- a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/property-injection.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-
-<beans>
- <!-- START SNIPPET: sca -->
- <bean id="sca" class="org.apache.xbean.sca.ScaBeanPostProcessor" />
- <!-- END SNIPPET: sca -->
-
- <!-- test case -->
- <bean id="injection" class="org.apache.xbean.sca.PropertyInjectionPojo" />
-</beans>
-
diff --git a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/property.xml b/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/property.xml
deleted file mode 100644
index a7dc53f..0000000
--- a/trunk/xbean-sca/src/test/resources/org/apache/xbean/sca/property.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-
-<beans>
- <!-- START SNIPPET: sca -->
- <bean id="sca" class="org.apache.xbean.sca.ScaBeanPostProcessor" />
- <!-- END SNIPPET: sca -->
-
- <!-- test case -->
- <bean id="pojo" class="org.apache.xbean.sca.MandatoryPropertyPojo">
- <property name="cheese" value="Edam"/>
- <property name="beer" value="true"/>
- </bean>
-</beans>
-
diff --git a/trunk/xbean-server/LICENSE.txt b/trunk/xbean-server/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-server/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-server/NOTICE.txt b/trunk/xbean-server/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-server/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-server/pom.xml b/trunk/xbean-server/pom.xml
deleted file mode 100644
index 4282c07..0000000
--- a/trunk/xbean-server/pom.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-server</artifactId>
- <name>XBean :: Server</name>
- <version>2.4-SNAPSHOT</version>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/SpringLoaderTest.*</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.xbean</groupId>
- <artifactId>maven-xbean-plugin</artifactId>
- <version>${pom.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>mapping</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <namespace>http://xbean.apache.org/schemas/server</namespace>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j</artifactId>
- <optional>true</optional>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/ClassLoaderUtil.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/ClassLoaderUtil.java
deleted file mode 100644
index 20d1f3c..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/ClassLoaderUtil.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.classloader;
-
-import java.util.Map;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-
-/**
- * Utility methods for class loader manipulation in a server environment.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public final class ClassLoaderUtil {
- private ClassLoaderUtil() {
- }
-
- /**
- * Cleans well known class loader leaks in VMs and libraries. There is a lot of bad code out there and this method
- * will clear up the know problems. This method should only be called when the class loader will no longer be used.
- * It this method is called two often it can have a serious impact on preformance.
- * @param classLoader the class loader to destroy
- */
- public static void destroy(ClassLoader classLoader) {
- releaseCommonsLoggingCache(classLoader);
- clearSunSoftCache(ObjectInputStream.class, "subclassAudits");
- clearSunSoftCache(ObjectOutputStream.class, "subclassAudits");
- clearSunSoftCache(ObjectStreamClass.class, "localDescs");
- clearSunSoftCache(ObjectStreamClass.class, "reflectors");
- }
-
- /**
- * Clears the caches maintained by the SunVM object stream implementation. This method uses reflection and
- * setAccessable to obtain access to the Sun cache. The cache is locked with a synchronize monitor and cleared.
- * This method completely clears the class loader cache which will impact preformance of object serialization.
- * @param clazz the name of the class containing the cache field
- * @param fieldName the name of the cache field
- */
- public static void clearSunSoftCache(Class clazz, String fieldName) {
- Map cache = null;
- try {
- Field field = clazz.getDeclaredField(fieldName);
- field.setAccessible(true);
- cache = (Map) field.get(null);
- } catch (Throwable ignored) {
- // there is nothing a user could do about this anyway
- }
-
- if (cache != null) {
- synchronized (cache) {
- cache.clear();
- }
- }
- }
-
- /**
- * Releases the specified classloader from the Apache Jakarta Commons Logging class loader cache using reflection.
- * @param classLoader the class loader to release
- */
- public static void releaseCommonsLoggingCache(ClassLoader classLoader) {
- try {
- Class logFactory = classLoader.loadClass("org.apache.commons.logging.LogFactory");
- Method release = logFactory.getMethod("release", new Class[] {ClassLoader.class});
- release.invoke(null, new Object[] {classLoader});
- } catch (Throwable ignored) {
- // there is nothing a user could do about this anyway
- }
- }
-
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/DestroyableClassLoader.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/DestroyableClassLoader.java
deleted file mode 100644
index 7927aa5..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/DestroyableClassLoader.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.classloader;
-
-/**
- * DestroyableClassLoader is a mixin interface for a ClassLoader that add a destroy method to propertly cleanup a
- * classloader then dereferenced by the server.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface DestroyableClassLoader {
- /**
- * Destroys the clasloader releasing all resources. After this mehtod is called, the class loader will no longer
- * load any classes or resources.
- */
- void destroy();
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/JarFileClassLoader.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/JarFileClassLoader.java
deleted file mode 100644
index dd2e654..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/JarFileClassLoader.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.classloader;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLStreamHandlerFactory;
-import java.security.CodeSource;
-import java.security.cert.Certificate;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-/**
- * The JarFileClassLoader that loads classes and resources from a list of JarFiles. This method is simmilar to URLClassLoader
- * except it properly closes JarFiles when the classloader is destroyed so that the file read lock will be released, and
- * the jar file can be modified and deleted.
- * <p>
- * Note: This implementation currently does not work reliably on windows, since the jar URL handler included with the Sun JavaVM
- * holds a read lock on the JarFile, and this lock is not released when the jar url is dereferenced. To fix this a
- * replacement for the jar url handler must be written.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class JarFileClassLoader extends MultiParentClassLoader {
- private static final URL[] EMPTY_URLS = new URL[0];
- private final Object lock = new Object();
- private final LinkedHashMap classPath = new LinkedHashMap();
- private boolean destroyed = false;
-
- /**
- * Creates a JarFileClassLoader that is a child of the system class loader.
- * @param name the name of this class loader
- * @param urls a list of URLs from which classes and resources should be loaded
- */
- public JarFileClassLoader(String name, URL[] urls) {
- super(name, EMPTY_URLS);
- addURLs(urls);
- }
-
- /**
- * Creates a JarFileClassLoader that is a child of the specified class loader.
- * @param name the name of this class loader
- * @param urls a list of URLs from which classes and resources should be loaded
- * @param parent the parent of this class loader
- */
- public JarFileClassLoader(String name, URL[] urls, ClassLoader parent) {
- this(name, urls, new ClassLoader[] {parent});
- }
-
- /**
- * Creates a named class loader as a child of the specified parent and using the specified URLStreamHandlerFactory
- * for accessing the urls..
- * @param name the name of this class loader
- * @param urls the urls from which this class loader will classes and resources
- * @param parent the parent of this class loader
- * @param factory the URLStreamHandlerFactory used to access the urls
- */
- public JarFileClassLoader(String name, URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) {
- this(name, urls, new ClassLoader[] {parent}, factory);
- }
-
- /**
- * Creates a named class loader as a child of the specified parents.
- * @param name the name of this class loader
- * @param urls the urls from which this class loader will classes and resources
- * @param parents the parents of this class loader
- */
- public JarFileClassLoader(String name, URL[] urls, ClassLoader[] parents) {
- super(name, EMPTY_URLS, parents);
- addURLs(urls);
- }
-
- /**
- * Creates a named class loader as a child of the specified parents and using the specified URLStreamHandlerFactory
- * for accessing the urls..
- * @param name the name of this class loader
- * @param urls the urls from which this class loader will classes and resources
- * @param parents the parents of this class loader
- * @param factory the URLStreamHandlerFactory used to access the urls
- */
- public JarFileClassLoader(String name, URL[] urls, ClassLoader[] parents, URLStreamHandlerFactory factory) {
- super(name, EMPTY_URLS, parents, factory);
- addURLs(urls);
- }
-
- /**
- * {@inheritDoc}
- */
- public URL[] getURLs() {
- return (URL[]) classPath.keySet().toArray(new URL[classPath.keySet().size()]);
- }
-
- /**
- * {@inheritDoc}
- */
- protected void addURL(URL url) {
- addURLs(Collections.singletonList(url));
- }
-
- /**
- * Adds an array of urls to the end of this class loader.
- * @param urls the URLs to add
- */
- protected void addURLs(URL[] urls) {
- addURLs(Arrays.asList(urls));
- }
-
- /**
- * Adds a list of urls to the end of this class loader.
- * @param urls the URLs to add
- */
- protected void addURLs(List urls) {
- LinkedList locationStack = new LinkedList(urls);
- try {
- while (!locationStack.isEmpty()) {
- URL url = (URL) locationStack.removeFirst();
-
- if (!"file".equals(url.getProtocol())) {
- // download the jar
- throw new Error("Only local file jars are supported " + url);
- }
-
- String path = url.getPath();
- if (classPath.containsKey(path)) {
- continue;
- }
-
- File file = new File(path);
- if (!file.canRead()) {
- // can't read file...
- continue;
- }
-
- // open the jar file
- JarFile jarFile;
- try {
- jarFile = new JarFile(file);
- } catch (IOException e) {
- // can't seem to open the file
- continue;
- }
- classPath.put(url, jarFile);
-
- // push the manifest classpath on the stack (make sure to maintain the order)
- Manifest manifest = null;
- try {
- manifest = jarFile.getManifest();
- } catch (IOException ignored) {
- }
-
- if (manifest != null) {
- Attributes mainAttributes = manifest.getMainAttributes();
- String manifestClassPath = mainAttributes.getValue(Attributes.Name.CLASS_PATH);
- if (manifestClassPath != null) {
- LinkedList classPathUrls = new LinkedList();
- for (StringTokenizer tokenizer = new StringTokenizer(manifestClassPath, " "); tokenizer.hasMoreTokens();) {
- String entry = tokenizer.nextToken();
- File parentDir = file.getParentFile();
- File entryFile = new File(parentDir, entry);
- // manifest entries are optional... if they aren't there it is ok
- if (entryFile.canRead()) {
- classPathUrls.addLast(entryFile.getAbsolutePath());
- }
- }
- locationStack.addAll(0, classPathUrls);
- }
- }
- }
- } catch (Error e) {
- destroy();
- throw e;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void destroy() {
- synchronized (lock) {
- if (destroyed) {
- return;
- }
- destroyed = true;
- for (Iterator iterator = classPath.values().iterator(); iterator.hasNext();) {
- JarFile jarFile = (JarFile) iterator.next();
- try {
- jarFile.close();
- } catch (IOException ignored) {
- }
- }
- classPath.clear();
- }
- super.destroy();
- }
-
- /**
- * {@inheritDoc}
- */
- public URL findResource(String resourceName) {
- URL jarUrl = null;
- synchronized (lock) {
- if (destroyed) {
- return null;
- }
- for (Iterator iterator = classPath.entrySet().iterator(); iterator.hasNext() && jarUrl == null;) {
- Map.Entry entry = (Map.Entry) iterator.next();
- JarFile jarFile = (JarFile) entry.getValue();
- JarEntry jarEntry = jarFile.getJarEntry(resourceName);
- if (jarEntry != null && !jarEntry.isDirectory()) {
- jarUrl = (URL) entry.getKey();
- }
- }
- }
-
-
- try {
- String urlString = "jar:" + jarUrl + "!/" + resourceName;
- return new URL(jarUrl, urlString);
- } catch (MalformedURLException e) {
- return null;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public Enumeration findResources(String resourceName) throws IOException {
- List resources = new ArrayList();
- List superResources = Collections.list(super.findResources(resourceName));
- resources.addAll(superResources);
-
- synchronized (lock) {
- if (destroyed) {
- return Collections.enumeration(Collections.EMPTY_LIST);
- }
- for (Iterator iterator = classPath.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- JarFile jarFile = (JarFile) entry.getValue();
- JarEntry jarEntry = jarFile.getJarEntry(resourceName);
- if (jarEntry != null && !jarEntry.isDirectory()) {
- try {
- URL url = (URL) entry.getKey();
- String urlString = "jar:" + url + "!/" + resourceName;
- resources.add(new URL(url, urlString));
- } catch (MalformedURLException e) {
- }
- }
- }
- }
-
- return Collections.enumeration(resources);
- }
-
- /**
- * {@inheritDoc}
- */
- protected Class findClass(String className) throws ClassNotFoundException {
- SecurityManager securityManager = System.getSecurityManager();
- if (securityManager != null) {
- String packageName;
- int packageEnd = className.lastIndexOf('.');
- if (packageEnd >= 0) {
- packageName = className.substring(0, packageEnd);
- securityManager.checkPackageDefinition(packageName);
- }
- }
-
- Certificate[] certificates = null;
- URL jarUrl = null;
- Manifest manifest = null;
- byte[] bytes;
- synchronized (lock) {
- if (destroyed) {
- throw new ClassNotFoundException("Class loader has been destroyed: " + className);
- }
-
- try {
- String entryName = className.replace('.', '/') + ".class";
- InputStream inputStream = null;
- for (Iterator iterator = classPath.entrySet().iterator(); iterator.hasNext() && inputStream == null;) {
- Map.Entry entry = (Map.Entry) iterator.next();
- jarUrl = (URL) entry.getKey();
- JarFile jarFile = (JarFile) entry.getValue();
- JarEntry jarEntry = jarFile.getJarEntry(entryName);
- if (jarEntry != null && !jarEntry.isDirectory()) {
- inputStream = jarFile.getInputStream(jarEntry);
- certificates = jarEntry.getCertificates();
- manifest = jarFile.getManifest();
- }
- }
- if (inputStream == null) {
- throw new ClassNotFoundException(className);
- }
-
- try {
- byte[] buffer = new byte[4096];
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- for (int count = inputStream.read(buffer); count >= 0; count = inputStream.read(buffer)) {
- out.write(buffer, 0, count);
- }
- bytes = out.toByteArray();
- } finally {
- inputStream.close();
- }
- } catch (IOException e) {
- throw new ClassNotFoundException(className, e);
- }
- }
-
- definePackage(className, jarUrl, manifest);
- CodeSource codeSource = new CodeSource(jarUrl, certificates);
- Class clazz = defineClass(className, bytes, 0, bytes.length, codeSource);
- return clazz;
- }
-
- private void definePackage(String className, URL jarUrl, Manifest manifest) {
- int packageEnd = className.lastIndexOf('.');
- if (packageEnd < 0) {
- return;
- }
-
- String packageName = className.substring(0, packageEnd);
- String packagePath = packageName.replace('.', '/') + "/";
-
- Attributes packageAttributes = null;
- Attributes mainAttributes = null;
- if (manifest != null) {
- packageAttributes = manifest.getAttributes(packagePath);
- mainAttributes = manifest.getMainAttributes();
- }
- Package pkg = getPackage(packageName);
- if (pkg != null) {
- if (pkg.isSealed()) {
- if (!pkg.isSealed(jarUrl)) {
- throw new SecurityException("Package was already sealed with another URL: package=" + packageName + ", url=" + jarUrl);
- }
- } else {
- if (isSealed(packageAttributes, mainAttributes)) {
- throw new SecurityException("Package was already been loaded and not sealed: package=" + packageName + ", url=" + jarUrl);
- }
- }
- } else {
- String specTitle = getAttribute(Attributes.Name.SPECIFICATION_TITLE, packageAttributes, mainAttributes);
- String specVendor = getAttribute(Attributes.Name.SPECIFICATION_VENDOR, packageAttributes, mainAttributes);
- String specVersion = getAttribute(Attributes.Name.SPECIFICATION_VERSION, packageAttributes, mainAttributes);
- String implTitle = getAttribute(Attributes.Name.IMPLEMENTATION_TITLE, packageAttributes, mainAttributes);
- String implVendor = getAttribute(Attributes.Name.IMPLEMENTATION_VENDOR, packageAttributes, mainAttributes);
- String implVersion = getAttribute(Attributes.Name.IMPLEMENTATION_VERSION, packageAttributes, mainAttributes);
-
- URL sealBase = null;
- if (isSealed(packageAttributes, mainAttributes)) {
- sealBase = jarUrl;
- }
-
- definePackage(packageName, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase);
- }
- }
-
- private String getAttribute(Attributes.Name name, Attributes packageAttributes, Attributes mainAttributes) {
- if (packageAttributes != null) {
- String value = packageAttributes.getValue(name);
- if (value != null) {
- return value;
- }
- }
- if (mainAttributes != null) {
- return mainAttributes.getValue(name);
- }
- return null;
- }
-
- private boolean isSealed(Attributes packageAttributes, Attributes mainAttributes) {
- String sealed = getAttribute(Attributes.Name.SEALED, packageAttributes, mainAttributes);
- if (sealed == null) {
- return false;
- }
- return "true".equalsIgnoreCase(sealed);
- }
-}
\ No newline at end of file
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/MultiParentClassLoader.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/MultiParentClassLoader.java
deleted file mode 100644
index 5fa35b5..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/MultiParentClassLoader.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.classloader;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLStreamHandlerFactory;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-
-/**
- * A MultiParentClassLoader is a simple extension of the URLClassLoader that simply changes the single parent class
- * loader model to support a list of parent class loaders. Each operation that accesses a parent, has been replaced
- * with a operation that checks each parent in order. This getParent method of this class will always return null,
- * which may be interperated by the calling code to mean that this class loader is a direct child of the system class
- * loader.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class MultiParentClassLoader extends NamedClassLoader {
- private final ClassLoader[] parents;
-
- /**
- * Creates a named class loader with no parents.
- * @param name the name of this class loader
- * @param urls the urls from which this class loader will classes and resources
- */
- public MultiParentClassLoader(String name, URL[] urls) {
- super(name, urls);
- parents = new ClassLoader[0];
- }
-
- /**
- * Creates a named class loader as a child of the specified parent.
- * @param name the name of this class loader
- * @param urls the urls from which this class loader will classes and resources
- * @param parent the parent of this class loader
- */
- public MultiParentClassLoader(String name, URL[] urls, ClassLoader parent) {
- this(name, urls, new ClassLoader[] {parent});
- }
-
- /**
- * Creates a named class loader as a child of the specified parent and using the specified URLStreamHandlerFactory
- * for accessing the urls..
- * @param name the name of this class loader
- * @param urls the urls from which this class loader will classes and resources
- * @param parent the parent of this class loader
- * @param factory the URLStreamHandlerFactory used to access the urls
- */
- public MultiParentClassLoader(String name, URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) {
- this(name, urls, new ClassLoader[] {parent}, factory);
- }
-
- /**
- * Creates a named class loader as a child of the specified parents.
- * @param name the name of this class loader
- * @param urls the urls from which this class loader will classes and resources
- * @param parents the parents of this class loader
- */
- public MultiParentClassLoader(String name, URL[] urls, ClassLoader[] parents) {
- super(name, urls);
- this.parents = copyParents(parents);
- }
-
- /**
- * Creates a named class loader as a child of the specified parents and using the specified URLStreamHandlerFactory
- * for accessing the urls..
- * @param name the name of this class loader
- * @param urls the urls from which this class loader will classes and resources
- * @param parents the parents of this class loader
- * @param factory the URLStreamHandlerFactory used to access the urls
- */
- public MultiParentClassLoader(String name, URL[] urls, ClassLoader[] parents, URLStreamHandlerFactory factory) {
- super(name, urls, null, factory);
- this.parents = copyParents(parents);
- }
-
- private static ClassLoader[] copyParents(ClassLoader[] parents) {
- ClassLoader[] newParentsArray = new ClassLoader[parents.length];
- for (int i = 0; i < parents.length; i++) {
- ClassLoader parent = parents[i];
- if (parent == null) {
- throw new NullPointerException("parent[" + i + "] is null");
- }
- newParentsArray[i] = parent;
- }
- return newParentsArray;
- }
-
- /**
- * Gets the parents of this class loader.
- * @return the parents of this class loader
- */
- public ClassLoader[] getParents() {
- return parents;
- }
-
- /**
- * {@inheritDoc}
- */
- protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
- Class clazz = findLoadedClass(name);
- for (int i = 0; i < parents.length && clazz == null; i++) {
- ClassLoader parent = parents[i];
- try {
- clazz = parent.loadClass(name);
- } catch (ClassNotFoundException ignored) {
- // this parent didn't have the class; try the next one
- }
- }
-
- if (clazz == null) {
- // parents didn't have the class; attempt to load from my urls
- return super.loadClass(name, resolve);
- } else {
- // we found the class; resolve it if requested
- if (resolve) {
- resolveClass(clazz);
- }
- return clazz;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public URL getResource(String name) {
- URL url = null;
- for (int i = 0; i < parents.length && url == null; i++) {
- ClassLoader parent = parents[i];
- url = parent.getResource(name);
- }
-
- if (url == null) {
- // parents didn't have the resource; attempt to load it from my urls
- return super.getResource(name);
- } else {
- return url;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public Enumeration findResources(String name) throws IOException {
- List resources = new ArrayList();
-
- // Add resources from all parents
- for (int i = 0; i < parents.length; i++) {
- ClassLoader parent = parents[i];
- List parentResources = Collections.list(parent.getResources(name));
- resources.addAll(parentResources);
- }
-
- // Add the resources from my urls
- List myResources = Collections.list(super.findResources(name));
- resources.addAll(myResources);
-
- // return an enumeration over the list
- return Collections.enumeration(resources);
- }
-
- /**
- * {@inheritDoc}
- */
- public String toString() {
- return "[" + getClass().getName() + ":" +
- " name=" + getName() +
- " urls=" + Arrays.asList(getURLs()) +
- " parents=" + Arrays.asList(parents) +
- "]";
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/NamedClassLoader.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/NamedClassLoader.java
deleted file mode 100644
index 5a26bb3..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/NamedClassLoader.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.classloader;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.URLStreamHandlerFactory;
-import java.util.Arrays;
-
-
-/**
- * The NamedClassLoader is a simple extension to URLClassLoader that adds a name and a destroy method that cleans up
- * the commons logging and JavaVM caches of the classloader.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class NamedClassLoader extends URLClassLoader implements DestroyableClassLoader {
- private final String name;
-
- /**
- * Creates a named class loader with no parents.
- * @param name the name of this class loader
- * @param urls the urls from which this class loader will classes and resources
- */
- public NamedClassLoader(String name, URL[] urls) {
- super(urls);
- this.name = name;
- }
-
- /**
- * Creates a named class loader as a child of the specified parent.
- * @param name the name of this class loader
- * @param urls the urls from which this class loader will classes and resources
- * @param parent the parent of this class loader
- */
- public NamedClassLoader(String name, URL[] urls, ClassLoader parent) {
- super(urls, parent);
- this.name = name;
- }
-
- /**
- * Creates a named class loader as a child of the specified parent and using the specified URLStreamHandlerFactory
- * for accessing the urls..
- * @param name the name of this class loader
- * @param urls the urls from which this class loader will classes and resources
- * @param parent the parent of this class loader
- * @param factory the URLStreamHandlerFactory used to access the urls
- */
- public NamedClassLoader(String name, URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) {
- super(urls, parent, factory);
- this.name = name;
- }
-
- /**
- * {@inheritDoc}
- */
- public void destroy() {
- ClassLoaderUtil.destroy(this);
- }
-
- /**
- * Gets the name of this class loader.
- * @return the name of this class loader
- */
- public String getName() {
- return name;
- }
-
- /**
- * {@inheritDoc}
- */
- public String toString() {
- return "[" + getClass().getName() + ":" +
- " name=" + getName() +
- " urls=" + Arrays.asList(getURLs()) +
- "]";
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/ThreadContextClassLoaderFactoryBean.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/ThreadContextClassLoaderFactoryBean.java
deleted file mode 100644
index fd6ca4f..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/classloader/ThreadContextClassLoaderFactoryBean.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.classloader;
-
-import org.springframework.beans.factory.FactoryBean;
-
-/**
- * A factory bean to expose the current thread context class loader.
- *
- * * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/server"
- * element="threadContextClassLoader" description="References the ClassLoader of the current thread context"
- * @version $Revision$
- */
-public class ThreadContextClassLoaderFactoryBean implements FactoryBean {
-
- public Object getObject() throws Exception {
- return Thread.currentThread().getContextClassLoader();
- }
-
- public Class getObjectType() {
- return ClassLoader.class;
- }
-
- public boolean isSingleton() {
- return true;
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/deployer/FileDeployer.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/deployer/FileDeployer.java
deleted file mode 100644
index 5be1b28..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/deployer/FileDeployer.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.deployer;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.ServiceAlreadyExistsException;
-import org.apache.xbean.kernel.ServiceFactory;
-import org.apache.xbean.kernel.ServiceRegistrationException;
-import org.apache.xbean.kernel.StringServiceName;
-import org.apache.xbean.server.classloader.NamedClassLoader;
-import org.apache.xbean.server.spring.configuration.SpringConfigurationServiceFactory;
-import org.apache.xbean.spring.context.ResourceXmlApplicationContext;
-import org.apache.xbean.spring.context.SpringApplicationContext;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.core.io.FileSystemResource;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-/**
- * A service which auto-deploys services within a recursive file system.
- *
- * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/server"
- * element="file-deployer" description="Deploys services in a file system"
- * @version $Revision$
- */
-public class FileDeployer implements Runnable, InitializingBean, ApplicationContextAware {
-
- private static final Log log = LogFactory.getLog(FileDeployer.class);
-
- private File baseDir;
- private Kernel kernel;
- private ClassLoader classLoader;
- private boolean verbose;
- private String[] jarDirectoryNames = { "lib", "classes" };
- private List beanFactoryPostProcessors = Collections.EMPTY_LIST;
- private List xmlPreprocessors = Collections.EMPTY_LIST;
- private ApplicationContext applicationContext;
- private boolean showIgnoredFiles;
-
- public void afterPropertiesSet() throws Exception {
- if (classLoader == null) {
- classLoader = Thread.currentThread().getContextClassLoader();
- }
- if (classLoader == null) {
- classLoader = getClass().getClassLoader();
- }
- if (baseDir == null) {
- log.warn("No directory specified so using current directory");
- baseDir = new File(".");
- }
- baseDir = baseDir.getAbsoluteFile();
- log.info("Starting to load components from: " + baseDir);
-
- // lets load the deployment
- processDirectory("", classLoader, applicationContext, baseDir);
-
- log.info("Loading completed");
- }
-
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.applicationContext = applicationContext;
- }
-
- public void run() {
- try {
- String name = "";
- if (applicationContext != null) {
- name = applicationContext.getDisplayName();
- }
- processDirectory(name, classLoader, applicationContext, baseDir);
- }
- catch (Exception e) {
- log.error("Failed to deploy services: " + e, e);
- }
- }
-
- // Properties
- // -------------------------------------------------------------------------
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-
- public void setClassLoader(ClassLoader classLoader) {
- this.classLoader = classLoader;
- }
-
- /**
- * Sets the kernel in which configurations are loaded.
- *
- * @param kernel
- * the kernel in which configurations are loaded
- */
- public void setKernel(Kernel kernel) {
- this.kernel = kernel;
- }
-
- /**
- * Gets the base directory from which configuration locations are resolved.
- *
- * @return the base directory from which configuration locations are
- * resolved
- */
- public File getBaseDir() {
- return baseDir;
- }
-
- /**
- * Sets the base directory from which configuration locations are resolved.
- *
- * @param baseDir
- * the base directory from which configuration locations are
- * resolved
- */
- public void setBaseDir(File baseDir) {
- this.baseDir = baseDir;
- }
-
- /**
- * Gets the SpringXmlPreprocessors applied to the configuration.
- *
- * @return the SpringXmlPreprocessors applied to the configuration
- */
- public List getXmlPreprocessors() {
- return xmlPreprocessors;
- }
-
- /**
- * Sets the SpringXmlPreprocessors applied to the configuration.
- *
- * @param xmlPreprocessors
- * the SpringXmlPreprocessors applied to the configuration
- */
- public void setXmlPreprocessors(List xmlPreprocessors) {
- this.xmlPreprocessors = xmlPreprocessors;
- }
-
- /**
- * Gets the BeanFactoryPostProcessors to apply to the configuration.
- *
- * @return the BeanFactoryPostProcessors to apply to the configuration
- */
- public List getBeanFactoryPostProcessors() {
- return beanFactoryPostProcessors;
- }
-
- /**
- * Sets the BeanFactoryPostProcessors to apply to the configuration.
- *
- * @param beanFactoryPostProcessors
- * the BeanFactoryPostProcessors to apply to the configuration
- */
- public void setBeanFactoryPostProcessors(List beanFactoryPostProcessors) {
- this.beanFactoryPostProcessors = beanFactoryPostProcessors;
- }
-
- public boolean isVerbose() {
- return verbose;
- }
-
- /**
- * Allows verbose logging to show what classpaths are being created
- */
- public void setVerbose(boolean verbose) {
- this.verbose = verbose;
- }
-
- public boolean isShowIgnoredFiles() {
- return showIgnoredFiles;
- }
-
- /**
- * Sets whether or not ignored files should be logged as they are
- * encountered. This can sometimes be useful to catch typeos.
- */
- public void setShowIgnoredFiles(boolean showIgnoredFiles) {
- this.showIgnoredFiles = showIgnoredFiles;
- }
-
- public String[] getJarDirectoryNames() {
- return jarDirectoryNames;
- }
-
- /**
- * Sets the names of the directories to be treated as folders of jars or
- * class loader files. Defaults to "lib", "classes". If you wish to disable
- * the use of lib and classes as being special folders containing jars or
- * config files then just set this property to null or an empty array.
- */
- public void setJarDirectoryNames(String[] jarDirectoryNames) {
- this.jarDirectoryNames = jarDirectoryNames;
- }
-
- // Implementation methods
- // -------------------------------------------------------------------------
- protected void processDirectory(String parentName, ClassLoader classLoader, ApplicationContext parentContext, File directory)
- throws ServiceAlreadyExistsException, ServiceRegistrationException, BeansException, IOException {
- log.debug("Processing directory: " + directory);
- File[] files = directory.listFiles();
- if (files == null) {
- return;
- }
-
- // lets create a new classloader...
- Properties properties = new Properties();
- Map fileMap = new LinkedHashMap();
- Map directoryMap = new LinkedHashMap();
- for (int i = 0; i < files.length; i++) {
- File file = files[i];
- if (isClassLoaderDirectory(file)) {
- classLoader = createChildClassLoader(parentName, file, classLoader);
- log.debug("Created class loader: " + classLoader);
- }
- else if (isXBeansPropertyFile(file)) {
- properties.load(new FileInputStream(file));
- }
- else {
- if (file.isDirectory()) {
- directoryMap.put(file.getName(), file);
- }
- else {
- fileMap.put(file.getName(), file);
- }
- }
- }
-
- String[] names = getFileNameOrder(properties);
-
- // Lets process the files first
-
- // process ordered files first in order
- for (int i = 0; i < names.length; i++) {
- String orderName = names[i];
- File file = (File) fileMap.remove(orderName);
- if (file != null) {
- String name = getChildName(parentName, file);
- createServiceForFile(name, file, classLoader, parentContext);
- }
- }
-
- // now lets process whats left
- for (Iterator iter = fileMap.values().iterator(); iter.hasNext();) {
- File file = (File) iter.next();
- String name = getChildName(parentName, file);
- createServiceForFile(name, file, classLoader, parentContext);
- }
-
- // now lets process the child directories
-
- // process ordered files first in order
- for (int i = 0; i < names.length; i++) {
- String orderName = names[i];
- File file = (File) directoryMap.remove(orderName);
- if (file != null) {
- String name = getChildName(parentName, file);
- processDirectory(name, classLoader, parentContext, file);
- }
- }
-
- // now lets process whats left
- for (Iterator iter = directoryMap.values().iterator(); iter.hasNext();) {
- File file = (File) iter.next();
- String name = getChildName(parentName, file);
- processDirectory(name, classLoader, parentContext, file);
- }
- }
-
- protected ClassLoader createChildClassLoader(String name, File dir, ClassLoader parentClassLoader) throws MalformedURLException {
- List urls = new ArrayList();
- if (verbose) {
- try {
- log.info("Adding to classpath: " + dir.getCanonicalPath());
- }
- catch (Exception e) {
- }
- }
- File[] files = dir.listFiles();
- if (files != null) {
- for (int j = 0; j < files.length; j++) {
- if (files[j].getName().endsWith(".zip") || files[j].getName().endsWith(".jar")) {
- if (verbose) {
- try {
- log.info("Adding to classpath: " + name + " jar: " + files[j].getCanonicalPath());
- }
- catch (Exception e) {
- }
- }
- urls.add(files[j].toURL());
- }
- }
- }
- URL u[] = new URL[urls.size()];
- urls.toArray(u);
- return new NamedClassLoader(name + ".ClassLoader", u, parentClassLoader);
- }
-
- protected void createServiceForFile(String name, File file, ClassLoader classLoader, ApplicationContext parentContext)
- throws ServiceAlreadyExistsException, ServiceRegistrationException, BeansException, IOException {
- if (isSpringConfigFile(file)) {
- // make the current directory available to spring files
- System.setProperty("xbean.current.file", file.getAbsolutePath());
- System.setProperty("xbean.current.dir", file.getParent());
-
- // we have to set the context class loader while loading the spring
- // file
- // so we can auto-discover xbean configurations
- // and perform introspection
- ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(classLoader);
- log.debug("Loading file: " + file + " using classLoader: " + classLoader);
- try {
- SpringApplicationContext applicationContext = new ResourceXmlApplicationContext(new FileSystemResource(file), xmlPreprocessors, parentContext, beanFactoryPostProcessors);
- applicationContext.setDisplayName(name);
-
- ServiceFactory serviceFactory = new SpringConfigurationServiceFactory(applicationContext);
-
- log.info("Registering spring services service: " + name + " from: " + file.getAbsolutePath() + " into the Kernel");
-
- // TODO should we use the classLaoder we used to load the
- // context
- // or, if the XBean config file defined a new classloader,
- // should we use the one
- // from the ApplicationContext?
- // classLoader = applicationContext.getClassLoader();
-
- kernel.registerService(new StringServiceName(name), serviceFactory, classLoader);
- }
- finally {
- Thread.currentThread().setContextClassLoader(oldClassLoader);
- }
- }
- else {
- if (showIgnoredFiles) {
- log.info("Ignoring file: " + file.getName() + " in directory: " + file.getParent());
- }
- }
- }
-
- protected boolean isClassLoaderDirectory(File file) {
- if (jarDirectoryNames != null) {
- for (int i = 0; i < jarDirectoryNames.length; i++) {
- String name = jarDirectoryNames[i];
- if (file.getName().equalsIgnoreCase(name)) {
- return true;
- }
- }
- }
- return false;
- }
-
- protected boolean isSpringConfigFile(File file) {
- String fileName = file.getName();
- return fileName.endsWith("spring.xml") || fileName.endsWith("xbean.xml");
- }
-
- private boolean isXBeansPropertyFile(File file) {
- String fileName = file.getName();
- return fileName.equalsIgnoreCase("xbean.properties");
- }
-
- /**
- * Extracts the file names from the properties file for the order in which
- * things should be deployed
- */
- protected String[] getFileNameOrder(Properties properties) {
- String order = properties.getProperty("order", "");
- List list = new ArrayList();
- StringTokenizer iter = new StringTokenizer(order, ",");
- while (iter.hasMoreTokens()) {
- list.add(iter.nextToken());
- }
- String[] answer = new String[list.size()];
- list.toArray(answer);
- return answer;
- }
-
- protected String getChildName(String parentName, File file) {
- StringBuffer buffer = new StringBuffer(parentName);
- if (parentName.length() > 0) {
- buffer.append("/");
- }
- buffer.append(file.getName());
- return buffer.toString();
- }
-
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/loader/LoadAllMain.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/loader/LoadAllMain.java
deleted file mode 100644
index 527137e..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/loader/LoadAllMain.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.loader;
-
-import java.util.List;
-import java.util.Iterator;
-
-import org.apache.xbean.server.main.Main;
-import org.apache.xbean.server.main.FatalStartupError;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.ServiceName;
-
-/**
- * LoadAllMain loads all configurations specified in the arguments passed to main.
- *
- * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/server" element="load-all-main"
- * description="Loads all configurations specified in the arguments passed to main"
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class LoadAllMain implements Main {
- private Kernel kernel;
- private Main next;
-
- /**
- * Gets the kernel in which configurations are loaded.
- * @return the kernel in which configurations are loaded
- */
- public Kernel getKernel() {
- return kernel;
- }
-
- /**
- * Sets the kernel in which configurations are loaded.
- * @param kernel the kernel in which configurations are loaded
- */
- public void setKernel(Kernel kernel) {
- this.kernel = kernel;
- }
-
- /**
- * Gets the next main instance to call.
- * @return the next main instance to call
- */
- public Main getNext() {
- return next;
- }
-
- /**
- * Sets the next main instance to call.
- * @param next the next main instance to call
- */
- public void setNext(Main next) {
- this.next = next;
- }
-
- /**
- * Loads all configurations specified in the args and call the next main instance with no arguments.
- * @param args the configurations to load
- */
- public void main(String[] args) {
- for (int i = 0; i < args.length; i++) {
- String location = args[i];
- load(location);
- }
-
- if (next != null) {
- next.main(new String[0]);
- }
- }
-
- private void load(String location) {
- List loaders = kernel.getServices(Loader.class);
- for (Iterator iterator = loaders.iterator(); iterator.hasNext();) {
- Loader loader = (Loader) iterator.next();
- try {
- ServiceName configurationName = loader.load(location);
- if (configurationName != null) {
- kernel.startServiceRecursive(configurationName);
- return;
- }
- } catch (Exception e) {
- throw new FatalStartupError("Error loading '" + location + "' with " + loader, e);
- }
- }
- String message = "No loaders were able to load '" + location + "' : Available loaders ";
- for (Iterator iterator = loaders.iterator(); iterator.hasNext();) {
- message += iterator.next();
- if (iterator.hasNext()) {
- message += ", ";
- }
- }
- throw new FatalStartupError(message);
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/loader/Loader.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/loader/Loader.java
deleted file mode 100644
index 9232a8e..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/loader/Loader.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.loader;
-
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.Kernel;
-
-/**
- * Loaders load configurations into a Kernel.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface Loader {
- /**
- * Gets the kernel in which configuraitons are loaded.
- * @return the kernel in which configurations are loaded
- */
- Kernel getKernel();
-
- /**
- * Loads the specified configuration into the kernel. The location passed to this method is specific loader
- * implementation. It is important to remember that a loader only loads the configuration into the kernel and
- * does not start the configuration.
- *
- * @param location the location of the configuration
- * @return the service name of the configuration added to the kernel
- * @throws Exception if a problem occurs while loading the configuration
- */
- ServiceName load(String location) throws Exception;
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/main/FatalStartupError.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/main/FatalStartupError.java
deleted file mode 100644
index 2a4cd96..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/main/FatalStartupError.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.main;
-
-/**
- * Indicates that a fatal error occured while starting the server.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class FatalStartupError extends Error {
- /**
- * The default exit code assigned to new exception if an exit code is not provided.
- */
- public static final int DEFAULT_EXIT_CODE = 3;
-
- private final int exitCode;
-
- /**
- * Creates a FatalStartupError containing the specified message and the DEFAULT_EXIT_CODE.
- * @param message a descrption of the cause of the error
- */
- public FatalStartupError(String message) {
- this(message, DEFAULT_EXIT_CODE);
- }
-
- /**
- * Creates a FatalStartupError containing the specified message and exit code.
- * @param message a descrption of the cause of the error
- * @param exitCode the exit code that should be passed to System.exit(int)
- */
- public FatalStartupError(String message, int exitCode) {
- super(message);
- this.exitCode = exitCode;
- }
-
- /**
- * Creates a FatalStartupError containing the specified message, cause by exception, and the DEFAULT_EXIT_CODE.
- * @param message a descrption of the cause of the error
- * @param cause the cause of this exception
- */
- public FatalStartupError(String message, Throwable cause) {
- this(message, DEFAULT_EXIT_CODE, cause);
- }
-
- /**
- * Creates a FatalStartupError containing the specified message, cause by exception, and the specified exit code.
- * @param message a descrption of the cause of the error
- * @param exitCode the exit code that should be passed to System.exit(int)
- * @param cause the cause of this exception
- */
- public FatalStartupError(String message, int exitCode, Throwable cause) {
- super(message, cause);
- this.exitCode = exitCode;
- }
-
- /**
- * Gets the number that should be passed to System.exit(int) when the virtual machine is halted.
- * @return the exit code that should be passed to System.exit(int)
- */
- public int getExitCode() {
- return exitCode;
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/main/KernelMain.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/main/KernelMain.java
deleted file mode 100644
index 9189206..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/main/KernelMain.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.main;
-
-import java.util.Map;
-import java.util.Collections;
-import java.util.Iterator;
-
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.KernelFactory;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.StringServiceName;
-import org.apache.xbean.kernel.StaticServiceFactory;
-
-/**
- * KernelMain is the standard entry point class used for a server. It will initalize a kernel with a set of services
- * and can optional hold the thread of execution until the kernel or virtual machine is destroyed.
- *
- * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/server" element="kernel-main"
- * description="Standard entry point for a kernel based server."
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class KernelMain implements Main {
- private static final String DEFAULT_KERNEL_NAME = "xbean";
-
- private Kernel kernel;
- private ClassLoader classLoader;
- private Map services = Collections.EMPTY_MAP;
- private boolean daemon = true;
- private Main next;
-
- /**
- * Gets the kernel that will be initialized in the main method. If the kernel is null, a new kernel will be created
- * and initialized in the main method.
- * @return the kernel that will be initialized in the main method
- */
- public Kernel getKernel() {
- return kernel;
- }
-
- /**
- * Sets the kernel to be initialized in the main method.
- * @param kernel the kernel to initialize in the main method
- */
- public void setKernel(Kernel kernel) {
- this.kernel = kernel;
- }
-
- /**
- * Gets the class loader which is used as the thread context class loader during the main method.
- * @return the class loader which is used as the thread context class loader during the main method
- */
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-
- /**
- * Sets the class loader to use as the thread context class loader during the main method.
- * @param classLoader the class loader to use as the thread context class loader during the main method
- */
- public void setClassLoader(ClassLoader classLoader) {
- this.classLoader = classLoader;
- }
-
- /**
- * Gets the services to be registered with the kernel during the main method.
- * @return the services to be mounted added to the kernel during the main method
- */
- public Map getServices() {
- return services;
- }
-
- /**
- * Sets the services to be registered with the kernel during the main method.
- * @param services the services to be registered with the kernel during the main method
- */
- public void setServices(Map services) {
- this.services = services;
- }
-
- /**
- * Determines if the main method should hold the thread until the kernel is destroyed.
- * @return true if the main method should hold the thread until the kernel is destroyed; false otherwise
- */
- public boolean isDaemon() {
- return daemon;
- }
-
- /**
- * Sets the main method to hold the thread until the kernel is destroyed.
- * @param daemon true if the main method should hold the thread until the kernel is destroyed
- */
- public void setDaemon(boolean daemon) {
- this.daemon = daemon;
- }
-
- /**
- * Gets the next main to call after the kernel has been initialized, but before destroying the kernel.
- * @return the next main to call after the kernel has been initialized
- */
- public Main getNext() {
- return next;
- }
-
- /**
- * Sets the next main to call after the kernel has been initialized.
- * @param next the next main to call after the kernel has been initialized
- */
- public void setNext(Main next) {
- this.next = next;
- }
-
- /**
- * Registers the services with the kernel, calls the next main, optionally holds the thread until the kernel is
- * destroyed, and then destroys the kernel.
- * @param args the arguments passed the next main
- */
- public void main(String[] args) {
- if (classLoader == null) {
- classLoader = Thread.currentThread().getContextClassLoader();
- }
-
- ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(classLoader);
- try {
- // create a default kernel if necessary
- if (kernel == null) {
- kernel = KernelFactory.newInstance().createKernel(DEFAULT_KERNEL_NAME);
- }
-
- boolean failed = false;
- try {
- // bind the bootstrap services
- for (Iterator iterator = services.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String name = (String) entry.getKey();
- Object service = entry.getValue();
-
- try {
- ServiceName serviceName = new StringServiceName(name);
- kernel.registerService(serviceName, new StaticServiceFactory(service), classLoader);
- kernel.startService(serviceName);
- } catch (Exception e) {
- throw new FatalStartupError("Unable to bind bootstrap service '" + name + "' into the kernel", e);
- }
- }
-
- // if we have a child main class call it
- if (next != null) {
- next.main(args);
- }
-
- // if we are a daemon we wait here until the server stops
- if (daemon) {
- // add our shutdown hook
- Runtime.getRuntime().addShutdownHook(new DestroyKernelThread(kernel));
-
- // wait for the kernel to be destroyed
- kernel.waitForDestruction();
- }
- } catch (RuntimeException e) {
- failed = true;
- throw e;
- } catch (Error e) {
- failed = true;
- throw e;
- } finally {
- try {
- kernel.destroy();
- } catch (Exception e) {
- // if we are not alredy throwing an exception, throw a new exception
- if (!failed) {
- throw new FatalStartupError("Exception while shutting down kernel", e);
- }
- }
- }
- } finally {
- Thread.currentThread().setContextClassLoader(oldClassLoader);
- }
- }
-
- public void destroy() {
- if( kernel!=null ) {
- kernel.destroy();
- }
- }
-
- private static class DestroyKernelThread extends Thread {
- private final Kernel kernel;
-
- private DestroyKernelThread(Kernel kernel) {
- super("Destroy Kernel Shutdown Hook");
- this.kernel = kernel;
- }
-
- public void run() {
- kernel.destroy();
- }
- }
-
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/main/Main.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/main/Main.java
deleted file mode 100644
index 5de677b..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/main/Main.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.main;
-
-/**
- * Main is centeral entry point for the server. This should used instead of public static void Main(String[] args).
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface Main {
- /**
- * The main entry point method.
- * @param args arguments to the main entry point
- */
- void main(String[] args);
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/propertyeditor/InetAddressEditor.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/propertyeditor/InetAddressEditor.java
deleted file mode 100644
index c1f5228..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/propertyeditor/InetAddressEditor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.propertyeditor;
-
-import java.beans.PropertyEditorSupport;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-/**
- * InetAddressEditor is a java beans property editor that can convert an InetAddreass to and from a String.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class InetAddressEditor extends PropertyEditorSupport {
- /**
- * Converts the specified string value into an InetAddress and stores the value in this instance.
- * @param value the string to convert into an InetAddress
- * @throws IllegalArgumentException if the specified string value is not a valid InetAddress
- */
- public void setAsText(String value) throws IllegalArgumentException {
- try {
- setValue(InetAddress.getByName(value));
- } catch (UnknownHostException e) {
- throw (IllegalArgumentException) new IllegalArgumentException().initCause(e);
- }
- }
-
- /**
- * Converts the stored InetAddress value into a String.
- * @return the string form of the current InetAddress value
- * @throws NullPointerException if the current InetAddress is null
- */
- public String getAsText() throws NullPointerException {
- InetAddress inetAddress = (InetAddress) getValue();
- if (inetAddress == null) {
- throw new NullPointerException("Current InetAddress value is null");
- }
- String text = inetAddress.toString();
- return text;
- }
-}
\ No newline at end of file
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/propertyeditor/ObjectNameEditor.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/propertyeditor/ObjectNameEditor.java
deleted file mode 100644
index ecb306f..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/propertyeditor/ObjectNameEditor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.propertyeditor;
-
-import java.beans.PropertyEditorSupport;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-/**
- * ObjectNameEditor is a java beans property editor that can convert an ObjectName to and from a String.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ObjectNameEditor extends PropertyEditorSupport {
- /**
- * Converts the specified string value into an ObjectName and stores the value in this instance.
- * @param value the string to convert into an ObjectName
- * @throws IllegalArgumentException if the specified string value is not a valid ObjectName
- */
- public void setAsText(String value) throws IllegalArgumentException {
- try {
- setValue(new ObjectName(value));
- } catch (MalformedObjectNameException e) {
- throw (IllegalArgumentException) new IllegalArgumentException().initCause(e);
- }
- }
-
- /**
- * Converts the stored ObjectName value into a String.
- * @return the canonical string form of the current ObjectName value
- * @throws NullPointerException if the current ObjectName is null
- */
- public String getAsText() {
- ObjectName objectName = (ObjectName) getValue();
- if (objectName == null) {
- throw new NullPointerException("Current ObjectName value is null");
- }
- String text = objectName.getCanonicalName();
- return text;
- }
-}
\ No newline at end of file
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/propertyeditor/URIEditor.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/propertyeditor/URIEditor.java
deleted file mode 100644
index 9dff7ee..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/propertyeditor/URIEditor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.propertyeditor;
-
-import java.beans.PropertyEditorSupport;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * URIEditor is a java beans property editor that can convert an URI to and from a String.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class URIEditor extends PropertyEditorSupport {
- /**
- * Converts the specified string value into an URI and stores the value in this instance.
- * @param value the string to convert into an URI
- * @throws IllegalArgumentException if the specified string value is not a valid URI
- */
- public void setAsText(String value) throws IllegalArgumentException {
- try {
- setValue(new URI(value));
- } catch (URISyntaxException e) {
- throw (IllegalArgumentException) new IllegalArgumentException().initCause(e);
- }
- }
-
- /**
- * Converts the stored URI value into a String.
- * @return the string form of the current URI value
- * @throws NullPointerException if the current URI is null
- */
- public String getAsText() {
- URI uri = (URI) getValue();
- if (uri == null) {
- throw new NullPointerException("Current URI value is null");
- }
- String text = uri.toString();
- return text;
- }
-}
\ No newline at end of file
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/repository/FileSystemRepository.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/repository/FileSystemRepository.java
deleted file mode 100644
index 7a1a1dc..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/repository/FileSystemRepository.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.repository;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-
-/**
- * FileSystemRepository maps resource ids to a directory on the local file system.
- *
- * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/server" element="file-system-repository"
- * description="Maps resource ids to a directory on the local file system."
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class FileSystemRepository implements Repository {
- private File root;
-
- /**
- * Creates a new repository without a specified root directory. This repository is not usable until the root
- * directory is specified.
- */
- public FileSystemRepository() {
- }
-
- /**
- * Creates a new repository using the specified root directory.
- * @param root the root directory from which resources are resolved
- */
- public FileSystemRepository(File root) {
- this.root = root;
- }
-
- /**
- * Gets the root directory from which resources are resolved.
- * @return the root directory of this repository
- */
- public File getRoot() {
- return root;
- }
-
- /**
- * Sets the root directory of this repository.
- * Note: the setting of the root directory is not synchronized and is expected to be called immediately after the
- * default constructor in the same thread.
- * @param root the new root directory from which resources are to be resolved
- */
- public void setRoot(File root) {
- this.root = root;
- }
-
- /**
- * Gets location of the resource realitive to the root directory. This method simply resolves the location against
- * the root directory using root.toURI().resolve(location).
- * @param location the location of the resource
- * @return the absolute location of the resource or null if the root directory does not contain a readable file at
- * the specified location
- */
- public URL getResource(String location) {
- File root = this.root;
- if (root == null) {
- throw new NullPointerException("root directory is null");
- }
-
- URI uri = root.toURI().resolve(location);
- File file = new File(uri);
-
- if (!file.canRead()) {
- return null;
- }
-
- try {
- return file.toURL();
- } catch (MalformedURLException e) {
- throw new IllegalArgumentException("Malformed resource " + uri);
- }
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/repository/Repository.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/repository/Repository.java
deleted file mode 100644
index fa7db52..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/repository/Repository.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.repository;
-
-import java.net.URL;
-
-/**
- * Repository is used to locate resources by id.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface Repository {
- /**
- * Gets a URL to the specified resource.
- * @param id the id of the resource
- * @return the location of the resource or null if the repository does not contain the resource
- */
- URL getResource(String id);
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/ClassLoaderXmlPreprocessor.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/ClassLoaderXmlPreprocessor.java
deleted file mode 100644
index dbc39df..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/ClassLoaderXmlPreprocessor.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.spring.configuration;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.apache.xbean.server.classloader.MultiParentClassLoader;
-import org.apache.xbean.server.repository.Repository;
-import org.apache.xbean.server.spring.loader.SpringLoader;
-import org.apache.xbean.spring.context.SpringXmlPreprocessor;
-import org.apache.xbean.spring.context.SpringApplicationContext;
-import org.springframework.beans.FatalBeanException;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-
-/**
- * ClassLoaderXmlPreprocessor extracts a ClassLoader definition from the xml document, builds a class loader, assigns
- * the class loader to the application context and xml reader, and removes the classpath element from document.
- *
- * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/server" element="class-loader-xml-preprocessor"
- * description="Extracts a ClassLoader definition from the xml document."
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ClassLoaderXmlPreprocessor implements SpringXmlPreprocessor {
- private final Repository repository;
-
- /**
- * Creates a ClassLoaderXmlPreprocessor that uses the specified repository to resolve the class path locations.
- * @param repository the repository used to resolve the class path locations
- */
- public ClassLoaderXmlPreprocessor(Repository repository) {
- this.repository = repository;
- }
-
- /**
- * Extracts a ClassLoader definition from the xml document, builds a class loader, assigns
- * the class loader to the application context and xml reader, and removes the classpath element from document.
- *
- * @param applicationContext the application context on which the class loader will be set
- * @param reader the xml reader on which the class loader will be set
- * @param document the xml document to inspect
- */
- public void preprocess(SpringApplicationContext applicationContext, XmlBeanDefinitionReader reader, Document document) {
- // determine the classLoader
- ClassLoader classLoader;
- NodeList classpathElements = document.getDocumentElement().getElementsByTagName("classpath");
- if (classpathElements.getLength() < 1) {
- classLoader = getClassLoader(applicationContext);
- } else if (classpathElements.getLength() > 1) {
- throw new FatalBeanException("Expected only classpath element but found " + classpathElements.getLength());
- } else {
- Element classpathElement = (Element) classpathElements.item(0);
-
- // build the classpath
- List classpath = new ArrayList();
- NodeList locations = classpathElement.getElementsByTagName("location");
- for (int i = 0; i < locations.getLength(); i++) {
- Element locationElement = (Element) locations.item(i);
-
- String location = ((Text) locationElement.getFirstChild()).getData().trim();
- classpath.add(location);
- }
-
- // convert the paths to URLS
- URL[] urls = new URL[classpath.size()];
- for (ListIterator iterator = classpath.listIterator(); iterator.hasNext();) {
- String location = (String) iterator.next();
- URL url = repository.getResource(location);
- if (url == null) {
- throw new FatalBeanException("Unable to resolve classpath location " + location);
- }
- urls[iterator.previousIndex()] = url;
- }
-
- // create the classloader
- ClassLoader parentLoader = getClassLoader(applicationContext);
- classLoader = new MultiParentClassLoader(applicationContext.getDisplayName(), urls, parentLoader);
-
- // remove the classpath element so Spring doesn't get confused
- document.getDocumentElement().removeChild(classpathElement);
- }
-
- // assign the class loader to the xml reader and the application context
- reader.setBeanClassLoader(classLoader);
- applicationContext.setClassLoader(classLoader);
- Thread.currentThread().setContextClassLoader(classLoader);
- }
-
- private static ClassLoader getClassLoader(SpringApplicationContext applicationContext) {
- ClassLoader classLoader = applicationContext.getClassLoader();
- if (classLoader == null) {
- classLoader = Thread.currentThread().getContextClassLoader();
- }
- if (classLoader == null) {
- classLoader = SpringLoader.class.getClassLoader();
- }
- return classLoader;
- }
-
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/SpringConfiguration.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/SpringConfiguration.java
deleted file mode 100644
index 07158f8..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/SpringConfiguration.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.spring.configuration;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.ServiceAlreadyExistsException;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.ServiceNotFoundException;
-import org.apache.xbean.kernel.ServiceRegistrationException;
-import org.apache.xbean.kernel.StaticServiceFactory;
-import org.apache.xbean.kernel.StringServiceName;
-import org.apache.xbean.spring.context.SpringApplicationContext;
-import org.apache.xbean.server.spring.loader.SpringLoader;
-
-/**
- * SpringConfiguration that registers and unregisters services that have been defined in a SpringApplicationContext.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class SpringConfiguration {
- private final SpringApplicationContext applicationContext;
- private final Map serviceFactories;
- private final Kernel kernel;
-
- /**
- * Creates a SpringConfiguration that registers and unregisters services that have been defined in a Spring ApplicationContext.
- * @param applicationContext the application context from which services are registered
- * @param kernel the kernel in which services are registered and unregistered
- * @throws Exception if a problem occurs while registering the services from the application context
- */
- public SpringConfiguration(SpringApplicationContext applicationContext, Kernel kernel) throws Exception {
- this.applicationContext = applicationContext;
- this.kernel = kernel;
-
- ClassLoader classLoader = getClassLoader(applicationContext);
- ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(classLoader);
-
- // read the configuration file from source
- applicationContext.refresh();
-
- try {
-
- // build a map from bean name to service name
- Map serviceNameIndex = buildServiceNameIndex(applicationContext);
-
- // Use Spring to create all of the beans
- Map factories = new HashMap(serviceNameIndex.size());
- for (Iterator iterator = serviceNameIndex.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String beanName = (String) entry.getKey();
- ServiceName serviceName = (ServiceName) entry.getValue();
-
- Object bean = applicationContext.getBean(beanName);
- StaticServiceFactory serviceFactory = new StaticServiceFactory(bean);
- factories.put(serviceName, serviceFactory);
- }
- serviceFactories = Collections.unmodifiableMap(factories);
-
- // register each bean with the kernel
- for (Iterator iterator = serviceFactories.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- ServiceName serviceName = (ServiceName) entry.getKey();
- StaticServiceFactory serviceFactory = (StaticServiceFactory) entry.getValue();
- kernel.registerService(serviceName, serviceFactory, classLoader);
- }
-
- } catch (ServiceAlreadyExistsException e) {
- destroy();
- throw e;
- } catch (ServiceRegistrationException e) {
- destroy();
- throw e;
- } finally {
- Thread.currentThread().setContextClassLoader(oldClassLoader);
- }
- }
-
- /**
- * Gets the unique identifier of this configuration.
- * @return the unique identifier of this configuration
- */
- public String getId() {
- return applicationContext.getDisplayName();
- }
-
- /**
- * Gets the service factories for the services defined in this configuration by ServiceName.
- * @return the service factories for the services defined in this configuration by ServiceName
- */
- public Map getServiceFactories() {
- return serviceFactories;
- }
-
- /**
- * Unregisters all of the services registered with the kernel in the constructor.
- */
- public void destroy() {
- ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClassLoader(applicationContext));
- try {
- for (Iterator iterator = serviceFactories.keySet().iterator(); iterator.hasNext();) {
- ServiceName serviceName = (ServiceName) iterator.next();
- try {
- kernel.unregisterService(serviceName);
- } catch (ServiceNotFoundException e) {
- // Doesn't matter
- } catch (ServiceRegistrationException e) {
- // todo ignored...
- }
- }
-
- applicationContext.close();
- } finally {
- Thread.currentThread().setContextClassLoader(oldClassLoader);
- }
- }
-
- private static Map buildServiceNameIndex(SpringApplicationContext applicationContext) {
- String[] beanNames = applicationContext.getBeanDefinitionNames();
- Map serviceNameIndex = new HashMap(beanNames.length);
- for (int i = 0; i < beanNames.length; i++) {
- String beanName = beanNames[i];
- ServiceName serviceName = new StringServiceName(beanName);
- serviceNameIndex.put(beanName, serviceName);
- }
- return serviceNameIndex;
- }
-
- private static ClassLoader getClassLoader(SpringApplicationContext applicationContext) {
- ClassLoader classLoader = applicationContext.getClassLoader();
- if (classLoader == null) {
- classLoader = Thread.currentThread().getContextClassLoader();
- }
- if (classLoader == null) {
- classLoader = SpringLoader.class.getClassLoader();
- }
- return classLoader;
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/SpringConfigurationServiceFactory.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/SpringConfigurationServiceFactory.java
deleted file mode 100644
index 0f9bbbe..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/configuration/SpringConfigurationServiceFactory.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.spring.configuration;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
-
-import org.apache.xbean.kernel.AbstractServiceFactory;
-import org.apache.xbean.kernel.ServiceCondition;
-import org.apache.xbean.kernel.ServiceConditionContext;
-import org.apache.xbean.kernel.ServiceContext;
-import org.apache.xbean.kernel.ServiceFactory;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.spring.context.SpringApplicationContext;
-
-/**
- * SpringConfigurationServiceFactory is manages the creation and destruction of a SpringConfiguration.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class SpringConfigurationServiceFactory extends AbstractServiceFactory {
- private final SpringApplicationContext applicationContext;
- private final ConfigurationStopCondition configurationStopCondition;
- private SpringConfiguration springConfiguration;
-
- /**
- * Creates a SpringConfigurationServiceFactory that wraps the specified application context.
- * @param applicationContext the application context for this configuration
- */
- public SpringConfigurationServiceFactory(SpringApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- configurationStopCondition = new ConfigurationStopCondition();
- addStopCondition(configurationStopCondition);
- }
-
- /**
- * Gets the unique id if this configuration.
- * @return the unique id if this configuration
- */
- public String getId() {
- return applicationContext.getDisplayName();
- }
-
- /**
- * Gets the application context wrapped by this configuration. Use caution when modifiying this context as it can
- * effect the running state of services.
- * @return the application context wrapped by this configuration
- */
- public SpringApplicationContext getApplicationContext() {
- return applicationContext;
- }
-
- /**
- * {@inheritDoc}
- */
- public Class[] getTypes() {
- return new Class[]{SpringConfiguration.class};
- }
-
- /**
- * SpringConfigurationServiceFactory is restartable so this method always returns true.
- * @return true
- */
- public boolean isRestartable() {
- return false;
- }
-
- /**
- * Gets the ServiceNames of the services defined in the application context if the configuration has been started,
- * otherwise this method returns an empty set.
- *
- * @return the ServiceNames of the services defined in the application context if the configuration has been started
- */
- public Set getOwnedServices() {
- if (springConfiguration != null) {
- return new HashSet(springConfiguration.getServiceFactories().keySet());
- }
- return Collections.EMPTY_SET;
- }
-
- /**
- * {@inheritDoc}
- */
- public Object createService(ServiceContext serviceContext) throws Exception {
- springConfiguration = new SpringConfiguration(applicationContext, serviceContext.getKernel());
-
- // add owned service stop conditions
- Set ownedServices = springConfiguration.getServiceFactories().keySet();
- for (Iterator iterator = springConfiguration.getServiceFactories().entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- ServiceName serviceName = (ServiceName) entry.getKey();
- ServiceFactory serviceFactory = (ServiceFactory) entry.getValue();
- if (ownedServices.contains(serviceName)) {
- serviceFactory.addStopCondition(configurationStopCondition.createOwnedServiceStopCondition());
- }
- }
-
- return springConfiguration;
- }
-
- /**
- * {@inheritDoc}
- */
- public void destroyService(ServiceContext serviceContext) {
- if (springConfiguration != null) {
- springConfiguration.destroy();
- springConfiguration = null;
- }
- applicationContext.close();
- }
-
- private static class ConfigurationStopCondition implements ServiceCondition {
- private final List ownedServiceConditions = new ArrayList();
-
- public synchronized void initialize(ServiceConditionContext context) {
- for (Iterator iterator = ownedServiceConditions.iterator(); iterator.hasNext();) {
- OwnedServiceCondition ownedServiceCondition = (OwnedServiceCondition) iterator.next();
- ownedServiceCondition.setSatisfied();
- }
- }
-
- public boolean isSatisfied() {
- return true;
- }
-
- public synchronized void destroy() {
- for (Iterator iterator = ownedServiceConditions.iterator(); iterator.hasNext();) {
- OwnedServiceCondition ownedServiceCondition = (OwnedServiceCondition) iterator.next();
- ownedServiceCondition.setSatisfied();
- }
- }
-
- public ServiceCondition createOwnedServiceStopCondition() {
- ServiceCondition ownedServiceCondition = new OwnedServiceCondition();
- ownedServiceConditions.add(ownedServiceCondition);
- return ownedServiceCondition;
- }
-
- private static class OwnedServiceCondition implements ServiceCondition {
- private boolean satisfied = false;
- private ServiceConditionContext context;
-
- public synchronized void initialize(ServiceConditionContext context) {
- this.context = context;
- }
-
- public synchronized boolean isSatisfied() {
- return satisfied;
- }
-
- private void setSatisfied() {
- this.satisfied = true;
- if (context != null) {
- context.setSatisfied();
- }
- }
-
- public synchronized void destroy() {
- context = null;
- }
- }
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/jmx/ConnectorServerFactoryBean.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/jmx/ConnectorServerFactoryBean.java
deleted file mode 100644
index f4e501e..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/jmx/ConnectorServerFactoryBean.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.spring.jmx;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.management.JMException;
-
-import java.io.IOException;
-
-/**
- * A helper class which logs a useful startup message.
- *
- * @version $Revision$
- */
-public class ConnectorServerFactoryBean extends org.springframework.jmx.support.ConnectorServerFactoryBean {
-
- private static final Log log = LogFactory.getLog(ConnectorServerFactoryBean.class);
-
- private String serviceUrl;
-
- public void setServiceUrl(String serviceUrl) {
- super.setServiceUrl(serviceUrl);
- this.serviceUrl = serviceUrl;
- }
-
- public void afterPropertiesSet() throws JMException, IOException {
- super.afterPropertiesSet();
-
- log.info("Started remote JMX connector. Point your JMX console to: " + serviceUrl);
- }
-
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/jmx/MBeanServerFactoryBean.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/jmx/MBeanServerFactoryBean.java
deleted file mode 100644
index 2ab9b3e..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/jmx/MBeanServerFactoryBean.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.spring.jmx;
-
-import javax.management.MBeanServer;
-
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.InitializingBean;
-
-/**
- * A FactoryBean that uses the xbean.tiger MBeanServerFactoryBean if it can be loaded or, uses
- * the spring MBeanServerFactoryBean otherwise.
- *
- * @version $Revision$
- */
-public class MBeanServerFactoryBean implements FactoryBean {
-
- public Object getObject() throws Exception {
-
- ClassLoader classLoader = MBeanServerFactoryBean.class.getClassLoader();
- try {
-
- // Try to use the xbean tiger version first...
- FactoryBean fb = (FactoryBean) classLoader.loadClass("org.apache.xbean.tiger.MBeanServerFactoryBean").newInstance();
- return fb.getObject();
-
- } catch (Throwable e) {
-
- // Fallback to using the spring factory bean then
- FactoryBean fb = (FactoryBean) classLoader.loadClass("org.springframework.jmx.support.MBeanServerFactoryBean").newInstance();
- ((InitializingBean)fb).afterPropertiesSet();
- return fb.getObject();
-
- }
- }
-
- public Class getObjectType() {
- return MBeanServer.class;
- }
-
- public boolean isSingleton() {
- return true;
- }
-
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/loader/SpringLoader.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/loader/SpringLoader.java
deleted file mode 100644
index 4ee5075..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/loader/SpringLoader.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.spring.loader;
-
-import java.io.File;
-import java.util.List;
-import java.util.Collections;
-
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.ServiceFactory;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.StringServiceName;
-import org.apache.xbean.server.loader.Loader;
-import org.apache.xbean.server.spring.configuration.SpringConfigurationServiceFactory;
-import org.apache.xbean.spring.context.FileSystemXmlApplicationContext;
-import org.apache.xbean.spring.context.SpringApplicationContext;
-
-
-/**
- * SpringLoader loads Spring xml configurations into a Kernel. This service uses the XBean version of
- * FileSystemXmlApplicationContext so custom XML extensions are available. This loader also support the specification
- * of SpringXmlPreprocessors and BeanFactoryPostProcessors to apply to the configuration.
- *
- * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/server" element="spring-loader"
- * description="Loads Spring xml configurations into a Kernel"
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class SpringLoader implements Loader {
- private Kernel kernel;
- private File baseDir = new File(".").getAbsoluteFile();
- private List beanFactoryPostProcessors = Collections.EMPTY_LIST;
- private List xmlPreprocessors = Collections.EMPTY_LIST;
-
- /**
- * Creates an empty SpringLoader. Note this loader is not usable until a kernel is specified.
- */
- public SpringLoader() {
- }
-
- /**
- * {@inheritDoc}
- */
- public Kernel getKernel() {
- return kernel;
- }
-
- /**
- * Sets the kernel in which configurations are loaded.
- * @param kernel the kernel in which configurations are loaded
- */
- public void setKernel(Kernel kernel) {
- this.kernel = kernel;
- }
-
- /**
- * Gets the BeanFactoryPostProcessors to apply to the configuration.
- * @return the BeanFactoryPostProcessors to apply to the configuration
- */
- public List getBeanFactoryPostProcessors() {
- return beanFactoryPostProcessors;
- }
-
- /**
- * Sets the BeanFactoryPostProcessors to apply to the configuration.
- * @param beanFactoryPostProcessors the BeanFactoryPostProcessors to apply to the configuration
- */
- public void setBeanFactoryPostProcessors(List beanFactoryPostProcessors) {
- this.beanFactoryPostProcessors = beanFactoryPostProcessors;
- }
-
- /**
- * Gets the base directory from which configuration locations are resolved.
- * @return the base directory from which configuration locations are resolved
- */
- public File getBaseDir() {
- return baseDir;
- }
-
- /**
- * Sets the base directory from which configuration locations are resolved.
- * @param baseDir the base directory from which configuration locations are resolved
- */
- public void setBaseDir(File baseDir) {
- this.baseDir = baseDir;
- }
-
- /**
- * Gets the SpringXmlPreprocessors applied to the configuration.
- * @return the SpringXmlPreprocessors applied to the configuration
- */
- public List getXmlPreprocessors() {
- return xmlPreprocessors;
- }
-
- /**
- * Sets the SpringXmlPreprocessors applied to the configuration.
- * @param xmlPreprocessors the SpringXmlPreprocessors applied to the configuration
- */
- public void setXmlPreprocessors(List xmlPreprocessors) {
- this.xmlPreprocessors = xmlPreprocessors;
- }
-
- /**
- * Loads the specified configuration into the kernel. The location specifies a file relative to the baseDir using
- * baseDir.toURI().resolve(location).getPath() + ".xml". This service uses the XBean version of
- * FileSystemXmlApplicationContext so custom XML extensions are available.
- * @param location the location of the configuration file relative to the base directory without the .xml extension
- * @return the name of the SpringConfiguration service for this location
- * @throws Exception if a problem occurs while loading the Spring configuration file
- */
- public ServiceName load(String location) throws Exception {
- String resolvedLocation = baseDir.toURI().resolve(location).getPath();
- String configLocation = "/" + resolvedLocation + ".xml";
- SpringApplicationContext applicationContext = new FileSystemXmlApplicationContext(
- new String[] {configLocation},
- false,
- xmlPreprocessors);
-
- // TODO - not adding the bean post processors
- applicationContext.setDisplayName(location);
-
- ClassLoader classLoader = applicationContext.getClassLoader();
- if (classLoader == null) {
- classLoader = Thread.currentThread().getContextClassLoader();
- }
- if (classLoader == null) {
- classLoader = SpringLoader.class.getClassLoader();
- }
-
- ServiceName serviceName = new StringServiceName("configuration:" + location);
- ServiceFactory springConfigurationServiceFactory = new SpringConfigurationServiceFactory(applicationContext);
- kernel.registerService(serviceName, springConfigurationServiceFactory, classLoader);
- return serviceName;
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/main/SpringBootstrap.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/main/SpringBootstrap.java
deleted file mode 100644
index c6e33e4..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/main/SpringBootstrap.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.spring.main;
-
-import java.beans.PropertyEditorManager;
-import java.io.File;
-import java.net.JarURLConnection;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import org.apache.xbean.server.main.FatalStartupError;
-import org.apache.xbean.server.main.Main;
-import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
-import org.apache.xbean.spring.context.FileSystemXmlApplicationContext;
-import org.apache.xbean.spring.context.SpringApplicationContext;
-
-/**
- * SpringBootstrap is the main class used by a Spring based server. This class uses the following strategies to determine
- * the configuration file to load:
- *
- * Command line parameter --bootstrap FILE
- * Manifest entry XBean-Bootstrap in the startup jar
- * META-INF/xbean-bootstrap.xml
- *
- * This class atempts to first load the configuration file from the local file system and if that fails it attempts to
- * load it from the classpath.
- *
- * SpringBootstrap expects the configuration to contain a service with the id "main" which is an implementation of
- * org.apache.xbean.server.main.Main.
- *
- * This class will set the system property xbean.base.dir to the directory containing the startup jar if the property
- * has not alredy been set (on the command line).
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class SpringBootstrap {
- private static final String XBEAN_BOOTSTRAP_MANIFEST = "XBean-Bootstrap";
- private static final String BOOTSTRAP_FLAG = "--bootstrap";
- private static final String DEFAULT_BOOTSTRAP = "META-INF/xbean-bootstrap.xml";
- private static final List DEFAULT_PROPERTY_EDITOR_PATHS = Collections.singletonList("org.apache.xbean.server.propertyeditor");
-
- private String configurationFile;
- private String[] mainArguments;
- private List propertyEditorPaths = DEFAULT_PROPERTY_EDITOR_PATHS;
- private String serverBaseDirectory;
-
- /**
- * Initializes and boots the server using the supplied arguments. If an error is thrown from the boot method,
- * this method will pring the error to standard error along with the stack trace and exit with the exit specified
- * in the FatalStartupError or exit code 9 if the error was not a FatalStartupError.
- * @param args the arguments used to start the server
- */
- public static void main(String[] args) {
- SpringBootstrap springBootstrap = new SpringBootstrap();
- main(args, springBootstrap);
- }
-
- /**
- * Like the main(args) method but allows a configured bootstrap instance to be passed in.
- *
- * @see #main(String[])
- */
- public static void main(String[] args, SpringBootstrap springBootstrap) {
- springBootstrap.initialize(args);
-
- try {
- springBootstrap.boot();
- } catch (FatalStartupError e) {
- System.err.println(e.getMessage());
- if (e.getCause() != null) {
- e.getCause().printStackTrace();
- }
- System.exit(e.getExitCode());
- } catch (Throwable e) {
- System.err.println("Unknown error");
- e.printStackTrace();
- System.exit(9);
- }
- }
-
- /**
- * Gets the configuration file from which the main instance is loaded.
- * @return the configuration file from which the main instance is loaded
- */
- public String getConfigurationFile() {
- return configurationFile;
- }
-
- /**
- * Sets the configuration file from which the main instance is loaded.
- * @param configurationFile the configuration file from which the main instance is loaded
- */
- public void setConfigurationFile(String configurationFile) {
- this.configurationFile = configurationFile;
- }
-
- /**
- * Gets the arguments passed to the main instance.
- * @return the arguments passed to the main instance
- */
- public String[] getMainArguments() {
- return mainArguments;
- }
-
- /**
- * Sets the arguments passed to the main instance.
- * @param mainArguments the arguments passed to the main instance
- */
- public void setMainArguments(String[] mainArguments) {
- this.mainArguments = mainArguments;
- }
-
- /**
- * Gets the paths that are appended to the system property editors search path.
- * @return the paths that are appended to the system property editors search path
- */
- public List getPropertyEditorPaths() {
- return propertyEditorPaths;
- }
-
- /**
- * Sets the paths that are appended to the system property editors search path.
- * @param propertyEditorPaths the paths that are appended to the system property editors search path
- */
- public void setPropertyEditorPaths(List propertyEditorPaths) {
- this.propertyEditorPaths = propertyEditorPaths;
- }
-
- /**
- * Gets the base directory of the server.
- * @return the base directory of the server
- */
- public String getServerBaseDirectory() {
- return serverBaseDirectory;
- }
-
- /**
- * Sets the base directory of the server.
- * @param serverBaseDirectory the base directory of the server
- */
- public void setServerBaseDirectory(String serverBaseDirectory) {
- this.serverBaseDirectory = serverBaseDirectory;
- }
-
- /**
- * Determines the configuration file and server base directory.
- * @param args the arguments passed to main
- */
- public void initialize(String[] args) {
- // check if bootstrap configuration was specified on the command line
- if (args.length > 1 && BOOTSTRAP_FLAG.equals(args[0])) {
- configurationFile = args[1];
- this.mainArguments = new String[args.length - 2];
- System.arraycopy(args, 2, this.mainArguments, 0, args.length);
- } else {
- if (configurationFile == null) {
- configurationFile = DEFAULT_BOOTSTRAP;
- }
- this.mainArguments = args;
- }
-
- // Determine the xbean installation directory
- // guess from the location of the jar
- URL url = SpringBootstrap.class.getClassLoader().getResource("META-INF/startup-jar");
- if (url != null) {
- try {
- JarURLConnection jarConnection = (JarURLConnection) url.openConnection();
- url = jarConnection.getJarFileURL();
-
- if (serverBaseDirectory == null) {
- URI baseURI = new URI(url.toString()).resolve("..");
- serverBaseDirectory = new File(baseURI).getAbsolutePath();
- }
-
- Manifest manifest;
- manifest = jarConnection.getManifest();
- Attributes mainAttributes = manifest.getMainAttributes();
- if (configurationFile == null) {
- configurationFile = mainAttributes.getValue(XBEAN_BOOTSTRAP_MANIFEST);
- }
- } catch (Exception e) {
- System.err.println("Could not determine xbean installation directory");
- e.printStackTrace();
- System.exit(9);
- return;
- }
- } else {
- if (serverBaseDirectory == null) {
- String dir = System.getProperty("xbean.base.dir", System.getProperty("user.dir"));
- serverBaseDirectory = new File(dir).getAbsolutePath();
- }
- }
- }
-
- /**
- * Loads the main instance from the configuration file.
- * @return the main instance
- */
- public Main loadMain() {
- if (serverBaseDirectory == null) {
- throw new NullPointerException("serverBaseDirectory is null");
-
- }
- File baseDirectory = new File(serverBaseDirectory);
- if (!baseDirectory.isDirectory()) {
- throw new IllegalArgumentException("serverBaseDirectory is not a directory: " + serverBaseDirectory);
-
- }
- if (configurationFile == null) {
- throw new NullPointerException("configurationFile is null");
-
- }
-
- ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(SpringBootstrap.class.getClassLoader());
- try {
- // add our property editors into the system
- if (propertyEditorPaths != null && !propertyEditorPaths.isEmpty()) {
- List editorSearchPath = new LinkedList(Arrays.asList(PropertyEditorManager.getEditorSearchPath()));
- editorSearchPath.addAll(propertyEditorPaths);
- PropertyEditorManager.setEditorSearchPath((String[]) editorSearchPath.toArray(new String[editorSearchPath.size()]));
- }
-
- // set the server base directory system property
- System.setProperty("xbean.base.dir", baseDirectory.getAbsolutePath());
-
- // load the configuration file
- SpringApplicationContext factory;
- File file = new File(configurationFile);
- if (!file.isAbsolute()) {
- file = new File(baseDirectory, configurationFile);
- }
- if (file.canRead()) {
- try {
- // configuration file is on the local file system
- factory = new FileSystemXmlApplicationContext(file.toURL().toString());
- } catch (MalformedURLException e) {
- throw new FatalStartupError("Error creating url for bootstrap file", e);
- }
- } else {
- // assume it is a classpath resource
- factory = new ClassPathXmlApplicationContext(configurationFile);
- }
-
- // get the main service from the configuration file
- String[] names = factory.getBeanNamesForType(Main.class);
- Main main = null;
- if (names.length == 0) {
- throw new FatalStartupError("No bean of type: " + Main.class.getName() + " found in the bootstrap file: " + configurationFile, 10);
- }
- main = (Main) factory.getBean(names[0]);
- return main;
- }
- finally {
- Thread.currentThread().setContextClassLoader(oldClassLoader);
- }
- }
-
- /**
- * Loads the main instance from the Spring configuration file and executes it.
- */
- public void boot() {
- // load the main instance
- Main main = loadMain();
-
- // start it up
- main.main(mainArguments);
-
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/ClassLoaderReference.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/ClassLoaderReference.java
deleted file mode 100644
index bb9f676..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/ClassLoaderReference.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.server.spring.reference;
-
-import java.io.Serializable;
-
-import org.apache.xbean.kernel.ServiceContext;
-import org.apache.xbean.kernel.ServiceContextThreadLocal;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-
-/**
- * ClassLoaderReference is a the class loader in the ServiceContextThreadLocal.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ClassLoaderReference implements FactoryBean, Serializable {
- /**
- * Creates a bean definition for ServiceContextThreadLocal.
- * @return a bean definition for ServiceContextThreadLocal
- */
- public static BeanDefinitionHolder createBeanDefinition() {
- RootBeanDefinition beanDefinition = new RootBeanDefinition(ClassLoaderReference.class, 0);
- return new BeanDefinitionHolder(beanDefinition, ClassLoaderReference.class.getName());
- }
-
- public final Class getObjectType() {
- return ClassLoader.class;
- }
-
- public synchronized final Object getObject() {
- ServiceContext serviceContext = ServiceContextThreadLocal.get();
- if (serviceContext == null) {
- throw new IllegalStateException("Service context has not been set");
- }
- return serviceContext.getClassLoader();
- }
-
- public boolean isSingleton() {
- return true;
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/KernelReference.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/KernelReference.java
deleted file mode 100644
index 0cab3df..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/KernelReference.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.server.spring.reference;
-
-import java.io.Serializable;
-
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.FactoryBean;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.ServiceContext;
-import org.apache.xbean.kernel.ServiceContextThreadLocal;
-
-
-/**
- * KernelReference is a the kernel in the ServiceContextThreadLocal.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class KernelReference implements FactoryBean, Serializable {
- /**
- * Creates a bean definition for KernelReference.
- * @return a bean definition for KernelReference
- */
- public static BeanDefinitionHolder createBeanDefinition() {
- RootBeanDefinition beanDefinition = new RootBeanDefinition(KernelReference.class, 0);
- return new BeanDefinitionHolder(beanDefinition, KernelReference.class.getName());
- }
-
- public final Class getObjectType() {
- return Kernel.class;
- }
-
- public synchronized final Object getObject() {
- ServiceContext serviceContext = ServiceContextThreadLocal.get();
- if (serviceContext == null) {
- throw new IllegalStateException("Service context has not been set");
- }
- return serviceContext.getKernel();
- }
-
- public boolean isSingleton() {
- return true;
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/ServiceNameReference.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/ServiceNameReference.java
deleted file mode 100644
index 4d7c734..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/ServiceNameReference.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.server.spring.reference;
-
-import java.io.Serializable;
-
-import org.apache.xbean.kernel.ServiceContext;
-import org.apache.xbean.kernel.ServiceContextThreadLocal;
-import org.apache.xbean.kernel.ServiceName;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-
-/**
- * ServiceNameReference is a the ServiceName in the ServiceContextThreadLocal.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceNameReference implements FactoryBean, Serializable {
- /**
- * Creates a bean definition for ServiceNameReference.
- * @return a bean definition for ServiceNameReference
- */
- public static BeanDefinitionHolder createBeanDefinition() {
- RootBeanDefinition beanDefinition = new RootBeanDefinition(ServiceNameReference.class, 0);
- return new BeanDefinitionHolder(beanDefinition, ServiceNameReference.class.getName());
- }
-
- public final Class getObjectType() {
- return ServiceName.class;
- }
-
- public synchronized final Object getObject() {
- ServiceContext serviceContext = ServiceContextThreadLocal.get();
- if (serviceContext == null) {
- throw new IllegalStateException("Service context has not been set");
- }
- return serviceContext.getServiceName();
- }
-
- public boolean isSingleton() {
- return true;
- }
-}
diff --git a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/ServiceNameStringReference.java b/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/ServiceNameStringReference.java
deleted file mode 100644
index 3201363..0000000
--- a/trunk/xbean-server/src/main/java/org/apache/xbean/server/spring/reference/ServiceNameStringReference.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.xbean.server.spring.reference;
-
-import java.io.Serializable;
-
-import org.apache.xbean.kernel.ServiceContext;
-import org.apache.xbean.kernel.ServiceContextThreadLocal;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-
-/**
- * ServiceNameStringReference is a the ServiceName as a string in the ServiceContextThreadLocal.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ServiceNameStringReference implements FactoryBean, Serializable {
- /**
- * Creates a bean definition for ServiceNameStringReference.
- * @return a bean definition for ServiceNameStringReference
- */
- public static BeanDefinitionHolder createBeanDefinition() {
- RootBeanDefinition beanDefinition = new RootBeanDefinition(ServiceNameStringReference.class, 0);
- return new BeanDefinitionHolder(beanDefinition, ServiceNameStringReference.class.getName());
- }
-
- public final Class getObjectType() {
- return String.class;
- }
-
- public synchronized final Object getObject() {
- ServiceContext serviceContext = ServiceContextThreadLocal.get();
- if (serviceContext == null) {
- throw new IllegalStateException("Service context has not been set");
- }
- return serviceContext.getServiceName().toString();
- }
-
- public boolean isSingleton() {
- return true;
- }
-}
diff --git a/trunk/xbean-server/src/main/resources/META-INF/LICENSE b/trunk/xbean-server/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-server/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-server/src/main/resources/META-INF/NOTICE b/trunk/xbean-server/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-server/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-server/src/main/resources/META-INF/xbean-bootstrap.xml b/trunk/xbean-server/src/main/resources/META-INF/xbean-bootstrap.xml
deleted file mode 100644
index ad9971b..0000000
--- a/trunk/xbean-server/src/main/resources/META-INF/xbean-bootstrap.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
--->
-<beans xmlns:s="http://xbean.apache.org/schemas/server">
- <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
-
- <s:kernel-main name="main" kernel="#kernel">
- <property name="services">
- <map>
- <entry key="FileSystemRepository" value-ref="repository"/>
- <entry key="SpringLoader" value-ref="springLoader"/>
- </map>
- </property>
- <s:next>
- <s:load-all-main kernel="#kernel"/>
- </s:next>
- </s:kernel-main>
-
- <bean name="kernelFactory" class="org.apache.xbean.kernel.KernelFactory" factory-method="newInstance"/>
- <bean name="kernel" factory-bean="kernelFactory" factory-method="createKernel">
- <constructor-arg index="0" value="xbean"/>
- </bean>
-
- <s:file-system-repository id="repository" root="${xbean.base.dir}/repository"/>
-
- <s:spring-loader id="springLoader" kernel="#kernel" baseDir="${xbean.base.dir}/conf">
- <s:xmlPreprocessors>
- <s:class-loader-xml-preprocessor repository="#repository"/>
- </s:xmlPreprocessors>
- </s:spring-loader>
-</beans>
diff --git a/trunk/xbean-server/src/test/java/org/apache/xbean/server/classloader/JarFileClassLoaderTest.java b/trunk/xbean-server/src/test/java/org/apache/xbean/server/classloader/JarFileClassLoaderTest.java
deleted file mode 100644
index 022f047..0000000
--- a/trunk/xbean-server/src/test/java/org/apache/xbean/server/classloader/JarFileClassLoaderTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.classloader;
-
-import java.net.URL;
-
-/**
- * Test the JarFileClassLoader.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class JarFileClassLoaderTest extends MultiParentClassLoaderTest {
- protected MultiParentClassLoader createClassLoader(String name, URL[] urls, ClassLoader[] parents) {
- return new JarFileClassLoader(name, urls, parents);
- }
-}
diff --git a/trunk/xbean-server/src/test/java/org/apache/xbean/server/classloader/MultiParentClassLoaderTest.java b/trunk/xbean-server/src/test/java/org/apache/xbean/server/classloader/MultiParentClassLoaderTest.java
deleted file mode 100644
index 185221a..0000000
--- a/trunk/xbean-server/src/test/java/org/apache/xbean/server/classloader/MultiParentClassLoaderTest.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.classloader;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Enumeration;
-import java.util.SortedSet;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-
-import junit.framework.TestCase;
-import net.sf.cglib.core.DefaultGeneratorStrategy;
-import net.sf.cglib.core.NamingPolicy;
-import net.sf.cglib.core.Predicate;
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.NoOp;
-
-/**
- * Tests the MultiParentClassLoader including classloading and resource loading.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class MultiParentClassLoaderTest extends TestCase {
- private static final String CLASS_NAME = "TestClass";
- private static final String ENTRY_NAME = "foo";
- private static final String ENTRY_VALUE = "bar";
- private File[] files;
- private static final String NON_EXISTANT_RESOURCE = "non-existant-resource";
- private static final String NON_EXISTANT_CLASS = "NonExistant.class";
- private URLClassLoader[] parents;
- private File myFile;
- private MultiParentClassLoader classLoader;
- private static final String NAME = "my test class loader";
-
- /**
- * Verify that the test jars are valid.
- * @throws Exception if a problem occurs
- */
- public void testTestJars() throws Exception {
- for (int i = 0; i < files.length; i++) {
- File file = files[i];
- JarFile jarFile = new JarFile(files[i]);
- String urlString = "jar:" + file.toURL() + "!/" + ENTRY_NAME;
- URL url = new URL(files[i].toURL(), urlString);
- assertStreamContains(ENTRY_VALUE + i, url.openStream());
- jarFile.close();
-
- URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { file.toURL() } );
- // clazz shared by all
- Class clazz = urlClassLoader.loadClass(CLASS_NAME);
- assertNotNull(clazz);
- assertTrue(SortedSet.class.isAssignableFrom(clazz));
-
- // clazz specific to this jar
- clazz = urlClassLoader.loadClass(CLASS_NAME + i);
- assertNotNull(clazz);
- assertTrue(SortedSet.class.isAssignableFrom(clazz));
-
- // resource shared by all jars
- InputStream in = urlClassLoader.getResourceAsStream(ENTRY_NAME );
- assertStreamContains("Should have found value from parent " + i, ENTRY_VALUE + i, in);
-
- // resource specific to this jar
- in = urlClassLoader.getResourceAsStream(ENTRY_NAME + i);
- assertStreamContains("Should have found value from parent " + i, ENTRY_VALUE + i + ENTRY_VALUE, in);
- }
- }
-
- /**
- * Verify the get name method returns the name provided to the constructor.
- */
- public void testGetName() {
- assertEquals(NAME, classLoader.getName());
- }
-
- /**
- * Verufy that the getParents method returns a different array from the one passed to the constructor and that the
- * parents are in the same order.
- */
- public void testGetParents() {
- ClassLoader[] actualParents = classLoader.getParents();
- assertNotSame(parents, actualParents);
- assertEquals(parents.length, actualParents.length);
- for (int i = 0; i < actualParents.length; i++) {
- assertEquals(parents[i], actualParents[i]);
- }
- }
-
- /**
- * Test loadClass loads in preference of the parents, in order, and then the local urls.
- * @throws Exception if a problem occurs
- */
- public void testLoadClass() throws Exception {
- // load class specific to my class loader
- Class clazz = classLoader.loadClass(CLASS_NAME + 33);
- assertNotNull(clazz);
- assertTrue(SortedSet.class.isAssignableFrom(clazz));
- assertEquals(classLoader, clazz.getClassLoader());
-
- // load class specific to each parent class loader
- for (int i = 0; i < parents.length; i++) {
- URLClassLoader parent = parents[i];
- clazz = classLoader.loadClass(CLASS_NAME + i);
- assertNotNull(clazz);
- assertTrue(SortedSet.class.isAssignableFrom(clazz));
- assertEquals(parent, clazz.getClassLoader());
- }
-
- // class shared by all class loaders
- clazz = classLoader.loadClass(CLASS_NAME);
- assertNotNull(clazz);
- assertTrue(SortedSet.class.isAssignableFrom(clazz));
- assertEquals(parents[0], clazz.getClassLoader());
- }
-
- /**
- * Test that an attempt to load a non-existant class causes a ClassNotFoundException.
- */
- public void testLoadNonExistantClass() {
- try {
- classLoader.loadClass(NON_EXISTANT_CLASS);
- fail("loadClass should have thrown a ClassNotFoundException");
- } catch (ClassNotFoundException e) {
- // expected
- }
- }
-
- /**
- * Test getResourceAsStream loads in preference of the parents, in order, and then the local urls.
- * @throws Exception if a problem occurs
- */
- public void testGetResourceAsStream() throws Exception {
- InputStream in = classLoader.getResourceAsStream(ENTRY_NAME + 33);
- assertStreamContains("Should have found value from my file", ENTRY_VALUE + 33 + ENTRY_VALUE, in);
-
- for (int i = 0; i < parents.length; i++) {
- in = classLoader.getResourceAsStream(ENTRY_NAME + i);
- assertStreamContains("Should have found value from parent " + i, ENTRY_VALUE + i + ENTRY_VALUE, in);
- }
-
- in = classLoader.getResourceAsStream(ENTRY_NAME);
- assertStreamContains("Should have found value from first parent", ENTRY_VALUE + 0, in);
- }
-
- /**
- * Test getResourceAsStream returns null when attempt is made to loade a non-existant resource.
- * @throws Exception if a problem occurs
- */
- public void testGetNonExistantResourceAsStream() throws Exception {
- InputStream in = classLoader.getResourceAsStream(NON_EXISTANT_RESOURCE);
- assertNull(in);
- }
-
- /**
- * Test getResource loads in preference of the parents, in order, and then the local urls.
- * @throws Exception if a problem occurs
- */
- public void testGetResource() throws Exception {
- URL resource = classLoader.getResource(ENTRY_NAME + 33);
- assertURLContains("Should have found value from my file", ENTRY_VALUE + 33 + ENTRY_VALUE, resource);
-
- for (int i = 0; i < parents.length; i++) {
- resource = classLoader.getResource(ENTRY_NAME + i);
- assertURLContains("Should have found value from parent " + i, ENTRY_VALUE + i + ENTRY_VALUE, resource);
- }
-
- resource = classLoader.getResource(ENTRY_NAME);
- assertURLContains("Should have found value from first parent", ENTRY_VALUE + 0, resource);
- }
-
- /**
- * Test getResource returns null when attempt is made to loade a non-existant resource.
- * @throws Exception if a problem occurs
- */
- public void testGetNonExistantResource() throws Exception {
- URL resource = classLoader.getResource(NON_EXISTANT_RESOURCE);
- assertNull(resource);
- }
-
- /**
- * Test getResource returns an enumeration in preference of the parents, in order, and then the local urls.
- * @throws Exception if a problem occurs
- */
- public void testGetResources() throws Exception {
- Enumeration resources = classLoader.getResources(ENTRY_NAME);
- assertNotNull(resources);
- assertTrue(resources.hasMoreElements());
-
- // there should be one entry for each parent
- for (int i = 0; i < parents.length; i++) {
- URL resource = (URL) resources.nextElement();
- assertURLContains("Should have found value from parent " + i, ENTRY_VALUE + i, resource);
- }
-
- // and one entry from my url
- assertTrue(resources.hasMoreElements());
- URL resource = (URL) resources.nextElement();
- assertURLContains("Should have found value from my file", ENTRY_VALUE + 33, resource);
- }
-
- /**
- * Test getResources returns an empty enumeration when attempt is made to loade a non-existant resource.
- * @throws Exception if a problem occurs
- */
- public void testGetNonExistantResources() throws Exception {
- Enumeration resources = classLoader.getResources(NON_EXISTANT_RESOURCE);
- assertNotNull(resources);
- assertFalse(resources.hasMoreElements());
- }
-
- private void assertStreamContains(String expectedValue, InputStream in) throws IOException {
- assertStreamContains(null, expectedValue, in);
- }
-
- private void assertStreamContains(String message, String expectedValue, InputStream in) throws IOException {
- String entryValue;
- try {
- StringBuffer stringBuffer = new StringBuffer();
- byte[] bytes = new byte[4000];
- for (int count = in.read(bytes); count != -1; count = in.read(bytes)) {
- stringBuffer.append(new String(bytes, 0, count));
- }
- entryValue = stringBuffer.toString();
- } finally {
- in.close();
- }
- assertEquals(message, expectedValue, entryValue);
- }
-
- private void assertURLContains(String message, String expectedValue, URL resource) throws IOException {
- InputStream in;
- assertNotNull(resource);
- in = resource.openStream();
- assertStreamContains(message, expectedValue, in);
- }
-
- private static void assertFileExists(File file) {
- assertTrue("File should exist: " + file, file.canRead());
- }
-
- private static void assertFileNotExists(File file) {
- assertTrue("File should not exist: " + file, !file.canRead());
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- files = new File[3];
- for (int i = 0; i < files.length; i++) {
- files[i] = createJarFile(i);
- }
-
- parents = new URLClassLoader[3];
- for (int i = 0; i < parents.length; i++) {
- parents[i] = new URLClassLoader(new URL[]{files[i].toURL()});
- }
-
- myFile = createJarFile(33);
- classLoader = createClassLoader(NAME, new URL[]{myFile.toURL()}, parents);
- }
-
- /**
- * Creates the class loader to test.
- * @param name the name of the classloader
- * @param urls the urls to load classes and resources from
- * @param parents the parents of the class loader
- * @return the class loader to test
- */
- protected MultiParentClassLoader createClassLoader(String name, URL[] urls, ClassLoader[] parents) {
- return new MultiParentClassLoader(name, urls, parents);
- }
-
- private static File createJarFile(int i) throws IOException {
- File file = File.createTempFile("test-" + i + "-", ".jar");
-
- FileOutputStream out = new FileOutputStream(file);
- JarOutputStream jarOut = new JarOutputStream(out);
-
- // common class shared by everyone
- jarOut.putNextEntry(new JarEntry(CLASS_NAME + ".class"));
- jarOut.write(createClass(CLASS_NAME));
-
- // class only available in this jar
- jarOut.putNextEntry(new JarEntry(CLASS_NAME + i + ".class"));
- jarOut.write(createClass(CLASS_NAME + i));
-
- // common resource shared by everyone
- jarOut.putNextEntry(new JarEntry(ENTRY_NAME));
- jarOut.write((ENTRY_VALUE + i).getBytes());
-
- // resource only available in this jar
- jarOut.putNextEntry(new JarEntry(ENTRY_NAME + i));
- jarOut.write((ENTRY_VALUE + i + ENTRY_VALUE).getBytes());
-
- jarOut.close();
- out.close();
-
- assertFileExists(file);
- return file;
- }
-
- private static byte[] createClass(final String name) {
- Enhancer enhancer = new Enhancer();
- enhancer.setNamingPolicy(new NamingPolicy() {
- public String getClassName(String prefix, String source, Object key, Predicate names) {
- return name;
- }
- });
- enhancer.setClassLoader(new URLClassLoader(new URL[0]));
- enhancer.setSuperclass(Object.class);
- enhancer.setInterfaces(new Class[]{SortedSet.class});
- enhancer.setCallbackTypes(new Class[]{NoOp.class});
- enhancer.setUseFactory(false);
- ByteCode byteCode = new ByteCode();
- enhancer.setStrategy(byteCode);
- enhancer.createClass();
-
- return byteCode.getByteCode();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- for (int i = 0; i < files.length; i++) {
- files[i].delete();
- }
- }
-
- private static class ByteCode extends DefaultGeneratorStrategy {
- private byte[] byteCode;
-
- public byte[] transform(byte[] byteCode) {
- this.byteCode = byteCode;
- return byteCode;
- }
-
- public byte[] getByteCode() {
- return byteCode;
- }
- }
-}
diff --git a/trunk/xbean-server/src/test/java/org/apache/xbean/server/deployer/DeployerTest.java b/trunk/xbean-server/src/test/java/org/apache/xbean/server/deployer/DeployerTest.java
deleted file mode 100644
index 2c88385..0000000
--- a/trunk/xbean-server/src/test/java/org/apache/xbean/server/deployer/DeployerTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.deployer;
-
-import org.apache.xbean.server.spring.main.SpringBootstrap;
-
-import junit.framework.TestCase;
-
-/**
- *
- * @version $Revision$
- */
-public class DeployerTest extends TestCase {
-
- public void testDeployer() throws Exception {
- SpringBootstrap bootstrap = new SpringBootstrap();
- bootstrap.setConfigurationFile("test-xbean-bootstrap.xml");
- SpringBootstrap.main(new String[0], bootstrap);
- Thread.sleep(5000);
- }
-}
diff --git a/trunk/xbean-server/src/test/java/org/apache/xbean/server/deployer/PropertyTestService.java b/trunk/xbean-server/src/test/java/org/apache/xbean/server/deployer/PropertyTestService.java
deleted file mode 100644
index 98352a2..0000000
--- a/trunk/xbean-server/src/test/java/org/apache/xbean/server/deployer/PropertyTestService.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.deployer;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.InitializingBean;
-
-/**
- * A simple test service used to validate that the property expansion works properly
- *
- * @version $Revision$
- */
-public class PropertyTestService implements InitializingBean {
-
- private static final Log log = LogFactory.getLog(PropertyTestService.class);
-
- private String baseDir;
- private String currentDir;
-
- public void afterPropertiesSet() throws Exception {
- assertValidProperty("baseDir", baseDir);
- assertValidProperty("currentDir", currentDir);
- if (!currentDir.endsWith("testcase")) {
- throw new IllegalArgumentException("The current directory should end with testcase but was: " + currentDir);
- }
- }
-
- public String getBaseDir() {
- return baseDir;
- }
-
- public void setBaseDir(String baseDir) {
- this.baseDir = baseDir;
- }
-
- public String getCurrentDir() {
- return currentDir;
- }
-
- public void setCurrentDir(String currentDir) {
- this.currentDir = currentDir;
- }
-
-
- protected void assertValidProperty(String name, String value) {
- log.info("Configured with " + name + ": " + value);
-
- if (value == null) {
- throw new IllegalArgumentException("No " + name + " property specified!");
- }
- if (value.length() == 0) {
- throw new IllegalArgumentException("Blank " + name + " property specified!");
- }
- if (value.startsWith("$")) {
- throw new IllegalArgumentException("The " + name + " property has not been expanded properly!: Its value is: " + value);
- }
- }
-
-}
diff --git a/trunk/xbean-server/src/test/java/org/apache/xbean/server/spring/loader/SpringLoaderTest.java b/trunk/xbean-server/src/test/java/org/apache/xbean/server/spring/loader/SpringLoaderTest.java
deleted file mode 100644
index ff84503..0000000
--- a/trunk/xbean-server/src/test/java/org/apache/xbean/server/spring/loader/SpringLoaderTest.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.spring.loader;
-
-import junit.framework.TestCase;
-import net.sf.cglib.core.DefaultGeneratorStrategy;
-import net.sf.cglib.core.NamingPolicy;
-import net.sf.cglib.core.Predicate;
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.NoOp;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.KernelFactory;
-import org.apache.xbean.kernel.ServiceName;
-import org.apache.xbean.kernel.StringServiceName;
-import org.apache.xbean.server.repository.FileSystemRepository;
-import org.apache.xbean.server.spring.configuration.ClassLoaderXmlPreprocessor;
-import org.apache.xbean.server.spring.configuration.SpringConfigurationServiceFactory;
-import org.apache.xbean.spring.context.SpringApplicationContext;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Collections;
-import java.util.List;
-import java.util.SortedSet;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class SpringLoaderTest extends TestCase {
- private static final String basedir = System.getProperties().getProperty("basedir", ".");
- private static final String CLASS_NAME = "TestClass";
- private static final String ENTRY_NAME = "foo";
- private static final String ENTRY_VALUE = "bar";
- private File jarFile;
-
- public void testLoad() throws Exception{
- Kernel kernel = KernelFactory.newInstance().createKernel("test");
-
- try {
- File xbeanDir = new File(basedir, "src/test/resources/org/apache/xbean/server/spring/loader/").getAbsoluteFile();
- System.setProperty("xbean.base.dir", xbeanDir.getAbsolutePath());
-
- FileSystemRepository repository = new FileSystemRepository(new File(basedir).getAbsoluteFile());
- ClassLoaderXmlPreprocessor classLoaderXmlPreprocessor = new ClassLoaderXmlPreprocessor(repository);
- List xmlPreprocessors = Collections.singletonList(classLoaderXmlPreprocessor);
-
- SpringLoader springLoader = new SpringLoader();
- springLoader.setKernel(kernel);
- springLoader.setBaseDir(xbeanDir);
- springLoader.setXmlPreprocessors(xmlPreprocessors);
- ServiceName configurationName = springLoader.load("classpath-xbean");
-
- kernel.startService(configurationName);
-
- Object testService = kernel.getService(new StringServiceName("test"));
- assertEquals("TestClass", testService.getClass().getName());
- assertTrue(testService instanceof SortedSet);
- } finally {
- kernel.destroy();
- }
- }
-
- public void testReload() throws Exception{
- Kernel kernel = KernelFactory.newInstance().createKernel("test");
-
- try {
- File xbeanDir = new File(basedir, "src/test/resources/org/apache/xbean/server/spring/loader/").getAbsoluteFile();
- System.setProperty("xbean.base.dir", xbeanDir.getAbsolutePath());
-
- FileSystemRepository repository = new FileSystemRepository(new File(basedir).getAbsoluteFile());
- ClassLoaderXmlPreprocessor classLoaderXmlPreprocessor = new ClassLoaderXmlPreprocessor(repository);
- List xmlPreprocessors = Collections.singletonList(classLoaderXmlPreprocessor);
-
- SpringLoader springLoader = new SpringLoader();
- springLoader.setKernel(kernel);
- springLoader.setBaseDir(xbeanDir);
- springLoader.setXmlPreprocessors(xmlPreprocessors);
- ServiceName configurationName = springLoader.load("classpath-xbean");
- SpringConfigurationServiceFactory serviceFactory = (SpringConfigurationServiceFactory) kernel.getServiceFactory(configurationName);
- SpringApplicationContext applicationContext = serviceFactory.getApplicationContext();
-
- kernel.startService(configurationName);
-
- Object testService = kernel.getService(new StringServiceName("test"));
- assertEquals("TestClass", testService.getClass().getName());
- assertEquals(applicationContext.getClassLoader(), testService.getClass().getClassLoader());
- assertTrue(testService instanceof SortedSet);
-
- kernel.stopService(configurationName);
- kernel.startService(configurationName);
-
- Object newTestService = kernel.getService(new StringServiceName("test"));
- assertEquals("TestClass", newTestService.getClass().getName());
- assertEquals(applicationContext.getClassLoader(), newTestService.getClass().getClassLoader());
- assertTrue(newTestService instanceof SortedSet);
-
- assertNotSame("test service should be a new instance",
- testService, newTestService);
-
- assertNotSame("test service should have been loaded from a different classloader",
- testService.getClass().getClassLoader(), newTestService.getClass().getClassLoader());
- } finally {
- kernel.destroy();
- }
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- jarFile = createJarFile();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- jarFile.delete();
- }
-
- private static File createJarFile() throws IOException {
- File file = new File(basedir, "target/SpringLoaderTest.jar");
-
- FileOutputStream out = new FileOutputStream(file);
- JarOutputStream jarOut = new JarOutputStream(out);
-
- jarOut.putNextEntry(new JarEntry(CLASS_NAME + ".class"));
- jarOut.write(createClass(CLASS_NAME));
-
- jarOut.putNextEntry(new JarEntry(ENTRY_NAME));
- jarOut.write(ENTRY_VALUE.getBytes());
-
- jarOut.close();
- out.close();
-
- return file;
- }
-
- private static byte[] createClass(final String name) {
- Enhancer enhancer = new Enhancer();
- enhancer.setNamingPolicy(new NamingPolicy() {
- public String getClassName(String prefix, String source, Object key, Predicate names) {
- return name;
- }
- });
- enhancer.setClassLoader(new URLClassLoader(new URL[0]));
- enhancer.setSuperclass(Object.class);
- enhancer.setInterfaces(new Class[]{SortedSet.class});
- enhancer.setCallbackTypes(new Class[]{NoOp.class});
- enhancer.setUseFactory(false);
- ByteCode byteCode = new ByteCode();
- enhancer.setStrategy(byteCode);
- enhancer.createClass();
-
- return byteCode.getByteCode();
- }
-
- private static class ByteCode extends DefaultGeneratorStrategy {
- private byte[] byteCode;
-
- public byte[] transform(byte[] byteCode) {
- this.byteCode = byteCode;
- return byteCode;
- }
-
- public byte[] getByteCode() {
- return byteCode;
- }
- }
-}
diff --git a/trunk/xbean-server/src/test/java/org/apache/xbean/server/spring/main/SpringBootstrapTest.java b/trunk/xbean-server/src/test/java/org/apache/xbean/server/spring/main/SpringBootstrapTest.java
deleted file mode 100644
index d08e036..0000000
--- a/trunk/xbean-server/src/test/java/org/apache/xbean/server/spring/main/SpringBootstrapTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.server.spring.main;
-
-import junit.framework.TestCase;
-import org.apache.xbean.kernel.Kernel;
-import org.apache.xbean.kernel.KernelFactory;
-import org.apache.xbean.server.main.KernelMain;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class SpringBootstrapTest extends TestCase {
- private static final String basedir = System.getProperties().getProperty("basedir", ".");
- private SpringBootstrap springBootstrap;
-
- public void testClasspathBootstrap() throws Exception{
- springBootstrap.setConfigurationFile("META-INF/xbean-bootstrap.xml");
- springBootstrap.setServerBaseDirectory(basedir);
- assertBootable(springBootstrap);
- }
-
- public void testFileBootstrapWithAbsoluteConfigPath() throws Exception {
- springBootstrap.setConfigurationFile(basedir + "/src/main/resources/META-INF/xbean-bootstrap.xml");
- springBootstrap.setServerBaseDirectory(basedir);
- assertBootable(springBootstrap);
- }
-
- public void testFileBootstrapWithRelativeConfigPath() throws Exception {
- springBootstrap.setConfigurationFile("src/main/resources/META-INF/xbean-bootstrap.xml");
- springBootstrap.setServerBaseDirectory(basedir);
- assertBootable(springBootstrap);
- }
-
- private static void assertBootable(SpringBootstrap springBootstrap) {
- // load the main instance
- KernelMain main = (KernelMain) springBootstrap.loadMain();
-
- // we don't want to start a daemon
- main.setDaemon(false);
-
- // verify a kernel was registered
- Kernel kernel = (Kernel) KernelFactory.getKernels().values().iterator().next();
- assertEquals(kernel, KernelFactory.getKernels().values().iterator().next());
- assertEquals(kernel, KernelFactory.getKernel(kernel.getKernelName()));
-
- // now boot the main instance
- main.main(new String[0]);
-
- // verify the kernel is destroyed (the kernel main destroys the kernel on exit)
- assertFalse(kernel.isRunning());
-
- // verify a kernel was unregistered
- assertFalse(KernelFactory.getKernels().values().iterator().hasNext());
- assertNull(KernelFactory.getKernel(kernel.getKernelName()));
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- springBootstrap = new SpringBootstrap();
- }
-}
diff --git a/trunk/xbean-server/src/test/repository/activemq/lib/activemq-4.0-SNAPSHOT.jar b/trunk/xbean-server/src/test/repository/activemq/lib/activemq-4.0-SNAPSHOT.jar
deleted file mode 100644
index 181fc63..0000000
--- a/trunk/xbean-server/src/test/repository/activemq/lib/activemq-4.0-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/xbean-server/src/test/repository/activemq/lib/geronimo-spec-j2ee-1.4-rc4.jar b/trunk/xbean-server/src/test/repository/activemq/lib/geronimo-spec-j2ee-1.4-rc4.jar
deleted file mode 100644
index 3f27762..0000000
--- a/trunk/xbean-server/src/test/repository/activemq/lib/geronimo-spec-j2ee-1.4-rc4.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/xbean-server/src/test/repository/activemq/xbean.xml b/trunk/xbean-server/src/test/repository/activemq/xbean.xml
deleted file mode 100755
index dce6370..0000000
--- a/trunk/xbean-server/src/test/repository/activemq/xbean.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<beans xmlns="http://activemq.org/config/1.0">
-
- <broker useJmx="false" persistent="false">
-
- <transportConnectors>
- <transportConnector uri="tcp://localhost:61616"/>
- </transportConnectors>
-
- </broker>
-
-</beans>
diff --git a/trunk/xbean-server/src/test/repository/testcase/test-xbean.xml b/trunk/xbean-server/src/test/repository/testcase/test-xbean.xml
deleted file mode 100644
index 9e9877c..0000000
--- a/trunk/xbean-server/src/test/repository/testcase/test-xbean.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<beans>
-
- <bean class="org.apache.xbean.server.deployer.PropertyTestService">
- <property name="baseDir" value="${xbean.base.dir}" />
- <property name="currentDir" value="${xbean.current.dir}" />
- </bean>
-
-</beans>
diff --git a/trunk/xbean-server/src/test/resources/org/apache/xbean/server/spring/loader/classpath-xbean.xml b/trunk/xbean-server/src/test/resources/org/apache/xbean/server/spring/loader/classpath-xbean.xml
deleted file mode 100644
index 243112c..0000000
--- a/trunk/xbean-server/src/test/resources/org/apache/xbean/server/spring/loader/classpath-xbean.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans>
- <classpath>
- <location>target/SpringLoaderTest.jar</location>
- </classpath>
-
- <bean id="test" class="TestClass"/>
-
- <bean name="FileSystemRepository" class="org.apache.xbean.server.repository.FileSystemRepository">
- <property name="root" value="${xbean.base.dir}/repository"/>
- </bean>
-</beans>
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-server/src/test/resources/test-xbean-bootstrap.xml b/trunk/xbean-server/src/test/resources/test-xbean-bootstrap.xml
deleted file mode 100644
index 6d36d89..0000000
--- a/trunk/xbean-server/src/test/resources/test-xbean-bootstrap.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<beans xmlns:s="http://xbean.apache.org/schemas/server">
- <bean id="propertyPlaceholderConfigurer"
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
-
- <s:kernel-main name="main" kernel="#kernel" daemon="false">
- <property name="services">
- <map>
- <entry key="FileSystemRepository" value-ref="repository" />
- </map>
- </property>
- <s:next>
- <s:load-all-main kernel="#kernel" />
- </s:next>
- </s:kernel-main>
-
- <bean name="kernelFactory"
- class="org.apache.xbean.kernel.KernelFactory"
- factory-method="newInstance" />
- <bean name="kernel" factory-bean="kernelFactory"
- factory-method="createKernel">
- <constructor-arg index="0" value="xbean" />
- </bean>
-
- <!-- TODO use proper directory
- <s:file-system-repository id="repository" root="${xbean.base.dir}/../components"/>
- -->
- <s:file-system-repository id="repository" root="src/test/repository" />
-
- <!-- TODO use proper directory -->
- <s:file-deployer baseDir="src/test/repository" kernel="#kernel">
- <s:xmlPreprocessors>
- <s:class-loader-xml-preprocessor repository="#repository" />
- </s:xmlPreprocessors>
- <s:beanFactoryPostProcessors>
- <bean
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
- </s:beanFactoryPostProcessors>
-
- </s:file-deployer>
-
-</beans>
\ No newline at end of file
diff --git a/trunk/xbean-spring-common/LICENSE.txt b/trunk/xbean-spring-common/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-spring-common/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-spring-common/NOTICE.txt b/trunk/xbean-spring-common/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-spring-common/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-spring-common/README.txt b/trunk/xbean-spring-common/README.txt
deleted file mode 100644
index 826ba9f..0000000
--- a/trunk/xbean-spring-common/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-This module contains the Spring additions for XBean which
-
-* provide a custom XML extension mechanism, allowing more concise XML to be used
- along with XSDs so that they can be more easily validated with off the shelf XML tooling
-
-* LDAP enhancements to Spring's configuration mechanism.
diff --git a/trunk/xbean-spring-common/pom.xml b/trunk/xbean-spring-common/pom.xml
deleted file mode 100644
index 65d4521..0000000
--- a/trunk/xbean-spring-common/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring-common</artifactId>
- <name>XBean :: Spring :: Common</name>
- <version>2.4-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- </dependency>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>qdox</groupId>
- <artifactId>qdox</artifactId>
- <optional>true</optional>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/ClassPathXmlApplicationContext.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/ClassPathXmlApplicationContext.java
deleted file mode 100644
index 8ee5127..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/ClassPathXmlApplicationContext.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.xbean.spring.context.impl.XBeanHelper;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.xml.ResourceEntityResolver;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.core.SpringVersion;
-
-/**
- * An XBean version of the regular Spring class to provide improved XML handling.
- *
- * @author James Strachan
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ClassPathXmlApplicationContext extends org.springframework.context.support.ClassPathXmlApplicationContext implements SpringApplicationContext {
- private final List xmlPreprocessors;
-
- /**
- * Creates a ClassPathXmlApplicationContext which loads the configuration at the specified location on the class
- * path.
- * @param configLocation the location of the configuration file on the class path
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public ClassPathXmlApplicationContext(String configLocation) throws BeansException {
- this(new String[] {configLocation}, true, null, Collections.EMPTY_LIST);
- }
-
- /**
- * Creates a ClassPathXmlApplicationContext which loads the configuration at the specified locations on the class
- * path.
- * @param configLocations the locations of the configuration files on the class path
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public ClassPathXmlApplicationContext(String[] configLocations) throws BeansException {
- this(configLocations, true, null, Collections.EMPTY_LIST);
- }
-
- /**
- * Creates a ClassPathXmlApplicationContext which loads the configuration at the specified locations on the class
- * path.
- * @param configLocations the locations of the configuration files on the class path
- * @param refresh if true the configurations are immedately loaded; otherwise the configurations are not loaded
- * until refresh() is called
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public ClassPathXmlApplicationContext(String[] configLocations, boolean refresh) throws BeansException {
- this(configLocations, refresh, null, Collections.EMPTY_LIST);
- }
-
- /**
- * Creates a ClassPathXmlApplicationContext which loads the configuration at the specified locations on the class
- * path.
- * @param configLocations the locations of the configuration files on the class path
- * @param parent the parent of this application context
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public ClassPathXmlApplicationContext(String[] configLocations, ApplicationContext parent) throws BeansException {
- this(configLocations, true, parent, Collections.EMPTY_LIST);
- }
-
- /**
- * Creates a ClassPathXmlApplicationContext which loads the configuration at the specified locations on the class
- * path.
- * @param configLocations the locations of the configuration files on the class path
- * @param refresh if true the configurations are immedately loaded; otherwise the configurations are not loaded
- * until refresh() is called
- * @param parent the parent of this application context
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public ClassPathXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent) throws BeansException {
- this(configLocations, refresh, parent, Collections.EMPTY_LIST);
- }
-
- /**
- * Creates a ClassPathXmlApplicationContext which loads the configuration at the specified location on the class
- * path.
- * @param configLocation the location of the configuration file on the classpath
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public ClassPathXmlApplicationContext(String configLocation, List xmlPreprocessors) throws BeansException {
- this(new String[] {configLocation}, true, null, xmlPreprocessors);
- }
-
- /**
- * Creates a ClassPathXmlApplicationContext which loads the configuration at the specified locations on the class
- * path.
- * @param configLocations the locations of the configuration files on the class path
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public ClassPathXmlApplicationContext(String[] configLocations, List xmlPreprocessors) throws BeansException {
- this(configLocations, true, null, xmlPreprocessors);
- }
-
- /**
- * Creates a ClassPathXmlApplicationContext which loads the configuration at the specified locations on the class
- * path.
- * @param configLocations the locations of the configuration files on the class path
- * @param refresh if true the configurations are immedately loaded; otherwise the configurations are not loaded
- * until refresh() is called
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public ClassPathXmlApplicationContext(String[] configLocations, boolean refresh, List xmlPreprocessors) throws BeansException {
- this(configLocations, refresh, null, xmlPreprocessors);
- }
-
- /**
- * Creates a ClassPathXmlApplicationContext which loads the configuration at the specified locations on the class
- * path.
- * @param configLocations the locations of the configuration files on the class path
- * @param parent the parent of this application context
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public ClassPathXmlApplicationContext(String[] configLocations, ApplicationContext parent, List xmlPreprocessors) throws BeansException {
- this(configLocations, true, parent, xmlPreprocessors);
- }
-
- /**
- * Creates a ClassPathXmlApplicationContext which loads the configuration at the specified locations on the class
- * path.
- * @param configLocations the locations of the configuration files on the class path
- * @param refresh if true the configurations are immedately loaded; otherwise the configurations are not loaded
- * until refresh() is called
- * @param parent the parent of this application context
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public ClassPathXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent, List xmlPreprocessors) throws BeansException {
- super(configLocations, false, parent);
- this.xmlPreprocessors = xmlPreprocessors;
- if (refresh) {
- refresh();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException {
- // Create a new XmlBeanDefinitionReader for the given BeanFactory.
- XmlBeanDefinitionReader beanDefinitionReader = XBeanHelper.createBeanDefinitionReader(this, beanFactory, xmlPreprocessors);
-
- // Configure the bean definition reader with this context's
- // resource loading environment.
- beanDefinitionReader.setResourceLoader(this);
- beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));
-
- // Allow a subclass to provide custom initialization of the reader,
- // then proceed with actually loading the bean definitions.
- initBeanDefinitionReader(beanDefinitionReader);
- loadBeanDefinitions(beanDefinitionReader);
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/FileSystemXmlApplicationContext.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/FileSystemXmlApplicationContext.java
deleted file mode 100644
index 01bddd1..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/FileSystemXmlApplicationContext.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.xbean.spring.context.impl.XBeanHelper;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.xml.ResourceEntityResolver;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-
-/**
- * An XBean version of the regular Spring class to provide improved XML
- * handling.
- *
- * @author James Strachan
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class FileSystemXmlApplicationContext extends org.springframework.context.support.FileSystemXmlApplicationContext implements SpringApplicationContext {
- private final List xmlPreprocessors;
-
- /**
- * Creates a FileSystemXmlApplicationContext which loads the configuration at the specified location on the file system.
- * @param configLocation the location of the configuration file on the class path
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public FileSystemXmlApplicationContext(String configLocation) throws BeansException {
- this(new String[] {configLocation}, true, null, Collections.EMPTY_LIST);
- }
-
- /**
- * Creates a FileSystemXmlApplicationContext which loads the configuration at the specified locations on the file system.
- * @param configLocations the locations of the configuration files on the class path
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public FileSystemXmlApplicationContext(String[] configLocations) throws BeansException {
- this(configLocations, true, null, Collections.EMPTY_LIST);
- }
-
- /**
- * Creates a FileSystemXmlApplicationContext which loads the configuration at the specified locations on the file system.
- * @param configLocations the locations of the configuration files on the class path
- * @param refresh if true the configurations are immedately loaded; otherwise the configurations are not loaded
- * until refresh() is called
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh) throws BeansException {
- this(configLocations, refresh, null, Collections.EMPTY_LIST);
- }
-
- /**
- * Creates a FileSystemXmlApplicationContext which loads the configuration at the specified locations on the file system.
- * @param configLocations the locations of the configuration files on the class path
- * @param parent the parent of this application context
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public FileSystemXmlApplicationContext(String[] configLocations, ApplicationContext parent) throws BeansException {
- this(configLocations, true, parent, Collections.EMPTY_LIST);
- }
-
- /**
- * Creates a FileSystemXmlApplicationContext which loads the configuration at the specified locations on the file system.
- * @param configLocations the locations of the configuration files on the class path
- * @param refresh if true the configurations are immedately loaded; otherwise the configurations are not loaded
- * until refresh() is called
- * @param parent the parent of this application context
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent) throws BeansException {
- this(configLocations, refresh, parent, Collections.EMPTY_LIST);
- }
-
- /**
- * Creates a FileSystemXmlApplicationContext which loads the configuration at the specified location on the file system.
- * @param configLocation the location of the configuration file on the class path
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public FileSystemXmlApplicationContext(String configLocation, List xmlPreprocessors) throws BeansException {
- this(new String[] {configLocation}, true, null, xmlPreprocessors);
- }
-
- /**
- * Creates a FileSystemXmlApplicationContext which loads the configuration at the specified locations on the file system.
- * @param configLocations the locations of the configuration files on the class path
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public FileSystemXmlApplicationContext(String[] configLocations, List xmlPreprocessors) throws BeansException {
- this(configLocations, true, null, xmlPreprocessors);
- }
-
- /**
- * Creates a FileSystemXmlApplicationContext which loads the configuration at the specified locations on the file system.
- * @param configLocations the locations of the configuration files on the class path
- * @param refresh if true the configurations are immedately loaded; otherwise the configurations are not loaded
- * until refresh() is called
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh, List xmlPreprocessors) throws BeansException {
- this(configLocations, refresh, null, xmlPreprocessors);
- }
-
- /**
- * Creates a FileSystemXmlApplicationContext which loads the configuration at the specified locations on the file system.
- * @param configLocations the locations of the configuration files on the class path
- * @param parent the parent of this application context
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public FileSystemXmlApplicationContext(String[] configLocations, ApplicationContext parent, List xmlPreprocessors) throws BeansException {
- this(configLocations, true, parent, xmlPreprocessors);
- }
-
- /**
- * Creates a FileSystemXmlApplicationContext which loads the configuration at the specified locations on the file system.
- * @param configLocations the locations of the configuration files on the class path
- * @param refresh if true the configurations are immedately loaded; otherwise the configurations are not loaded
- * until refresh() is called
- * @param parent the parent of this application context
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- * @throws BeansException if a problem occurs while reading the configuration
- */
- public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent, List xmlPreprocessors) throws BeansException {
- super(configLocations, false, parent);
- this.xmlPreprocessors = xmlPreprocessors;
- if (refresh) {
- refresh();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException {
- // Create a new XmlBeanDefinitionReader for the given BeanFactory.
- XmlBeanDefinitionReader beanDefinitionReader = XBeanHelper.createBeanDefinitionReader(this, beanFactory, xmlPreprocessors);
-
- // Configure the bean definition reader with this context's
- // resource loading environment.
- beanDefinitionReader.setResourceLoader(this);
- beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));
-
- // Allow a subclass to provide custom initialization of the reader,
- // then proceed with actually loading the bean definitions.
- initBeanDefinitionReader(beanDefinitionReader);
- loadBeanDefinitions(beanDefinitionReader);
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/ResourceXmlApplicationContext.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/ResourceXmlApplicationContext.java
deleted file mode 100644
index 46762c6..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/ResourceXmlApplicationContext.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.xbean.spring.context.impl.XBeanHelper;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.xml.ResourceEntityResolver;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.springframework.core.io.Resource;
-
-/**
- * An XBean version of a regular Spring ApplicationContext which takes a
- * {@link Resource} as a parameter to load the application context
- *
- * @author James Strachan
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class ResourceXmlApplicationContext extends AbstractXmlApplicationContext implements SpringApplicationContext {
- private final List xmlPreprocessors;
- private final Resource resource;
-
- /**
- * Creates a ResourceXmlApplicationContext which loads the configuration from the specified Resource.
- * @param resource the resource from which the configuration is loaded
- */
- public ResourceXmlApplicationContext(Resource resource) {
- this(resource, Collections.EMPTY_LIST);
- }
-
- /**
- * Creates a ResourceXmlApplicationContext which loads the configuration from the specified Resource.
- * @param resource the resource from which the configuration is loaded
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- */
- public ResourceXmlApplicationContext(Resource resource, List xmlPreprocessors) {
- super();
- this.xmlPreprocessors = xmlPreprocessors;
- this.resource = resource;
- refresh();
- }
-
- public ResourceXmlApplicationContext(Resource resource, ApplicationContext parent) {
- this(resource, Collections.EMPTY_LIST, parent);
- }
-
- public ResourceXmlApplicationContext(Resource resource, List xmlPreprocessors, ApplicationContext parent) {
- this(resource, xmlPreprocessors, parent, Collections.EMPTY_LIST);
- }
-
- public ResourceXmlApplicationContext(Resource resource, List xmlPreprocessors, ApplicationContext parent, List beanPostProcessors) {
- super(parent);
- this.xmlPreprocessors = xmlPreprocessors;
- this.resource = resource;
- for (Iterator iter = beanPostProcessors.iterator(); iter.hasNext();) {
- BeanFactoryPostProcessor processor = (BeanFactoryPostProcessor) iter.next();
- addBeanFactoryPostProcessor(processor);
- }
- refresh();
- }
-
- protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException {
- // Create a new XmlBeanDefinitionReader for the given BeanFactory.
- XmlBeanDefinitionReader beanDefinitionReader = XBeanHelper.createBeanDefinitionReader(this, beanFactory, xmlPreprocessors);
-
- // Configure the bean definition reader with this context's
- // resource loading environment.
- beanDefinitionReader.setResourceLoader(this);
- beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));
-
- // Allow a subclass to provide custom initialization of the reader,
- // then proceed with actually loading the bean definitions.
- initBeanDefinitionReader(beanDefinitionReader);
- loadBeanDefinitions(beanDefinitionReader);
- }
-
- /**
- * {@inheritDoc}
- */
- protected void loadBeanDefinitions(XmlBeanDefinitionReader reader) throws BeansException, IOException {
- reader.loadBeanDefinitions(resource);
- }
-
- /**
- * {@inheritDoc}
- */
- protected String[] getConfigLocations() {
- return null;
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/SpringApplicationContext.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/SpringApplicationContext.java
deleted file mode 100644
index b3bca37..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/SpringApplicationContext.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.ResourceLoader;
-
-import java.util.List;
-
-/**
- * SpringApplicationContext is an interface that defines the actual interface exposed by the application contexts
- * provided by Spring. This interface should be in Spring and the Spring application contexts should implement this
- * interface.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface SpringApplicationContext extends ConfigurableApplicationContext, DisposableBean, ResourceLoader{
- /**
- * Set a friendly name for this context.
- * Typically done during initialization of concrete context implementations.
- * @param displayName the display name for the context
- */
- void setDisplayName(String displayName);
-
- /**
- * Gets the list of BeanPostProcessors that will get applied
- * to beans created with this factory.
- * @return the list of BeanPostProcessors that will get applied
- * to beans created with this factory
- */
- List getBeanFactoryPostProcessors();
-
- /**
- * Specify the ClassLoader to load class path resources with,
- * or <code>null</code> if using the thread context class loader on actual access
- * (applying to the thread that does ClassPathResource calls).
- * <p>The default is that ClassLoader access will happen via the thread
- * context class loader on actual access (applying to the thread that
- * does ClassPathResource calls).
- * @param classLoader the ClassLoader to load class path resources
- */
- void setClassLoader(ClassLoader classLoader);
-
- /**
- * Return the ClassLoader to load class path resources with,
- * or <code>null</code> if using the thread context class loader on actual access
- * (applying to the thread that does ClassPathResource calls).
- * <p>Will get passed to ClassPathResource's constructor for all
- * ClassPathResource objects created by this resource loader.
- *
- * @return the ClassLoader to load class path resources
- * @see ClassPathResource
- */
- ClassLoader getClassLoader();
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/SpringXmlPreprocessor.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/SpringXmlPreprocessor.java
deleted file mode 100644
index 57800e2..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/SpringXmlPreprocessor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.w3c.dom.Document;
-
-/**
- * SpringXmlPreprocessor preprocesses the xml Document before it is passed to Spring for processing.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface SpringXmlPreprocessor {
- /**
- * Preprocesses the xml document which is being loaded by the specified application context and is being read by the
- * specified xml reader.
- * @param applicationContext the application context which is being loaded
- * @param reader the xml reader that read the document
- * @param document the xml document to read
- */
- public void preprocess(SpringApplicationContext applicationContext, XmlBeanDefinitionReader reader, Document document);
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/XmlWebApplicationContext.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/XmlWebApplicationContext.java
deleted file mode 100644
index 301eecc..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/XmlWebApplicationContext.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.Collections;
-import java.util.List;
-
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.xml.ResourceEntityResolver;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.core.SpringVersion;
-
-/**
- * An XBean version of the regular Spring class to provide improved XML
- * handling.
- *
- * @author James Strachan
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class XmlWebApplicationContext extends org.springframework.web.context.support.XmlWebApplicationContext implements SpringApplicationContext {
- private final List xmlPreprocessors;
-
- /**
- * Creates a XmlWebApplicationContext which loads the configuration from the a web application context.
- */
- public XmlWebApplicationContext() {
- this.xmlPreprocessors = Collections.EMPTY_LIST;
- }
-
- /**
- * Creates a XmlWebApplicationContext which loads the configuration from the a web application context.
- * @param xmlPreprocessors the SpringXmlPreprocessors to apply before passing the xml to Spring for processing
- */
- public XmlWebApplicationContext(List xmlPreprocessors) {
- this.xmlPreprocessors = xmlPreprocessors;
- }
-
- /**
- * {@inheritDoc}
- */
- protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException {
- // Create a new XmlBeanDefinitionReader for the given BeanFactory.
- XmlBeanDefinitionReader beanDefinitionReader = createBeanDefinitionReader(beanFactory);
-
- // Configure the bean definition reader with this context's
- // resource loading environment.
- beanDefinitionReader.setResourceLoader(this);
- beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));
-
- // Allow a subclass to provide custom initialization of the reader,
- // then proceed with actually loading the bean definitions.
- initBeanDefinitionReader(beanDefinitionReader);
- loadBeanDefinitions(beanDefinitionReader);
- }
-
- protected XmlBeanDefinitionReader createBeanDefinitionReader(DefaultListableBeanFactory beanFactory) {
- String version = SpringVersion.getVersion();
- String className = "org.apache.xbean.spring.v" + version.charAt(0) + ".XBeanXmlBeanDefinitionReader";
- try {
- Class cl = Class.forName(className);
- Constructor cstr = cl.getConstructor(new Class[] { SpringApplicationContext.class, BeanDefinitionRegistry.class, List.class });
- return (XmlBeanDefinitionReader) cstr.newInstance(new Object[] { this, beanFactory, xmlPreprocessors });
- } catch (Exception e) {
- throw new IllegalStateException("Could not find valid implementation for: " + version);
- }
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/DefaultProperty.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/DefaultProperty.java
deleted file mode 100644
index e5136fe..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/DefaultProperty.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.impl;
-
-/**
- * DefaultProperty contains the default value assigned to a property with a specific name and type.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class DefaultProperty {
- private String name;
- private Class type;
- private Object value;
-
- /**
- * Creates a new empty default property. This instance is unusable until the name, type and values are assigned.
- */
- public DefaultProperty() {
- }
-
- /**
- * Creates new default property value for a property with the specified name and type.
- * @param name the name of the property
- * @param type the type of the property
- * @param value the default value
- */
- public DefaultProperty(String name, Class type, Object value) {
- this.name = name;
- this.type = type;
- this.value = value;
- }
-
- /**
- * Gets the property name.
- * @return the property name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the property name.
- * @param name the property name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Gets the property type.
- * @return the property type
- */
- public Class getType() {
- return type;
- }
-
- /**
- * Sets the property type.
- * @param type the property type
- */
- public void setType(Class type) {
- this.type = type;
- }
-
- /**
- * Gets the default value.
- * @return the default value
- */
- public Object getValue() {
- return value;
- }
-
- /**
- * Sets the default value.
- * @param value the default value
- */
- public void setValue(Object value) {
- this.value = value;
- }
-
- /**
- * {@inheritDoc}
- */
- public String toString() {
- return "[" + name + ", " + type + ", " + value + "]";
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/MappingMetaData.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/MappingMetaData.java
deleted file mode 100644
index b67e7ee..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/MappingMetaData.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context.impl;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-/**
- * A helper class which understands how to map an XML namespaced element to
- * Spring bean configurations
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class MappingMetaData {
- private Properties properties;
- private String packageName;
-
- /**
- * Creates an empty MappingMetaData for the specified Java package.
- * @param packageName the Java package to map
- */
- public MappingMetaData(String packageName) {
- this.packageName = packageName;
- this.properties = new Properties();
- }
-
- /**
- * Creates MappingMetaData using the specified properties which contan the package name.
- * @param properties
- */
- public MappingMetaData(Properties properties) {
- this.properties = properties;
- this.packageName = properties.getProperty("package", "");
- }
-
- /**
- * Returns the Java class name for the given XML element name
- */
- public String getClassName(String localName) {
- String className = properties.getProperty(localName);
- if (className == null) {
- if (packageName.length() > 0) {
- className = packageName + "." + localName;
- }
- else {
- className = localName;
- }
- }
- return className;
- }
-
- /**
- * Returns the property name for the given element and attribute name
- *
- * @param elementName the XML local name of the element
- * @param attributeName the XML local name of the attribute
- * @return the property name to use or null if the attribute is not a valid property
- */
- public String getPropertyName(String elementName, String attributeName) {
- return properties.getProperty(elementName + ".alias." + attributeName, attributeName);
- }
-
- /**
- * Returns a valid property name if the childElementName maps to a nested list property
- *
- * @param elementName the owner element
- * @param childElementName is the child element name which maps to the nested list property
- * @return the property name if available or null if it is not applicable
- */
- public String getNestedListProperty(String elementName, String childElementName) {
- return properties.getProperty(elementName + ".list." + childElementName);
- }
-
- /**
- * Returns a valid property name if the childElementName maps to a nested bean property
- *
- * @param elementName the owner element
- * @param childElementName is the child element name which maps to the nested bean property
- * @return the property name if available or null if it is not applicable
- */
- public String getNestedProperty(String elementName, String childElementName) {
- return properties.getProperty(elementName + ".alias." + childElementName);
- }
-
- public boolean isDefaultConstructor(Constructor constructor) {
- String property = properties.getProperty(constructorToPropertyName(constructor) + ".default");
- if (property != null) {
- return Boolean.valueOf(property).booleanValue();
- }
- return false;
- }
-
- public boolean isDefaultFactoryMethod(Class beanClass, Method factoryMethod) {
- String property = properties.getProperty(methodToPropertyName(beanClass, factoryMethod) + ".default");
- if (property != null) {
- return Boolean.valueOf(property).booleanValue();
- }
- return false;
- }
-
- public String[] getParameterNames(Constructor constructor) {
- String property = properties.getProperty(constructorToPropertyName(constructor) + ".parameterNames");
- if (property != null) {
- ArrayList names = Collections.list(new StringTokenizer(property, ", "));
- return (String[]) names.toArray(new String[0]);
- }
- return null;
- }
-
- public String[] getParameterNames(Class beanClass, Method factoryMethod) {
- String property = properties.getProperty(methodToPropertyName(beanClass, factoryMethod) + ".parameterNames");
- if (property != null) {
- ArrayList names = Collections.list(new StringTokenizer(property, ", "));
- return (String[]) names.toArray(new String[0]);
- }
- return null;
- }
-
- public static String constructorToPropertyName(Constructor constructor) {
- StringBuffer buf = new StringBuffer();
- buf.append(constructor.getName()).append("(");
- Class[] parameterTypes = constructor.getParameterTypes();
- for (int i = 0; i < parameterTypes.length; i++) {
- Class parameterType = parameterTypes[i];
- buf.append(parameterType.getName());
- if (i < parameterTypes.length - 1) {
- buf.append(",");
- }
- }
- buf.append(")");
- return buf.toString();
- }
-
- public static String methodToPropertyName(Class beanClass, Method method) {
- StringBuffer buf = new StringBuffer();
- buf.append(beanClass.getName()).append(".");
- buf.append(method.getName()).append("(");
- Class[] parameterTypes = method.getParameterTypes();
- for (int i = 0; i < parameterTypes.length; i++) {
- Class parameterType = parameterTypes[i];
- buf.append(parameterType.getName());
- if (i < parameterTypes.length - 1) {
- buf.append(",");
- }
- }
- buf.append(")");
- return buf.toString();
- }
-
- public String getInitMethodName(String elementName) {
- return properties.getProperty(elementName + ".initMethod");
- }
-
- public String getDestroyMethodName(String elementName) {
- return properties.getProperty(elementName + ".destroyMethod");
- }
-
- public String getFactoryMethodName(String elementName) {
- return properties.getProperty(elementName + ".factoryMethod");
- }
-
- public String getContentProperty(String elementName) {
- return properties.getProperty(elementName + ".contentProperty");
- }
-
- public String getMapEntryName(String elementName, String property) {
- return properties.getProperty(elementName + "." + property + ".map.entryName");
- }
-
- public String getMapKeyName(String elementName, String property) {
- return properties.getProperty(elementName + "." + property + ".map.keyName");
- }
-
- public String getFlatCollectionProperty(String elementName, String property)
- {
- return properties.getProperty(elementName + "." + property + ".flatCollection");
- }
-
- public boolean isFlatProperty(String elementName, String property) {
- return properties.getProperty(elementName + "." + property + ".flat") != null;
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/NamedConstructorArgs.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/NamedConstructorArgs.java
deleted file mode 100644
index f44aa45..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/NamedConstructorArgs.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.impl;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.FatalBeanException;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.PropertyValue;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.config.ConstructorArgumentValues;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * NamedConstructorArgs is a BeanFactoryPostProcessor that converts property declarations into indexed constructor args
- * based on the the constructor parameter names annotation. This process first selects a constructor and then fills in
- * the constructor arguments from the properties defined in the bean definition. If a property is not defined in the
- * bean definition, first the defaultValues map is checked for a value and if a value is not present a Java default
- * value is provided for the constructor argument (e.g. numbers are assigned 0 and objects are assigned null).
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class NamedConstructorArgs {
- private Map defaultValues = new HashMap();
-
- /**
- * Gets the default values that are assigned to constructor arguments without a defined value.
- * @return the default values that are assigned to constructor arguments without a defined value
- */
- public List getDefaultValues() {
- List values = new LinkedList();
- for (Iterator iterator = defaultValues.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- PropertyKey key = (PropertyKey) entry.getKey();
- Object value = entry.getValue();
- values.add(new DefaultProperty(key.name, key.type, value));
- }
- return values;
- }
-
- /**
- * Sets the default values that are assigned to constructor arguments without a defined value.
- * @param defaultValues the values that are assigned to constructor arguments without a defined value
- */
- public void setDefaultValues(List defaultValues) {
- this.defaultValues.clear();
- for (Iterator iterator = defaultValues.iterator(); iterator.hasNext();) {
- addDefaultValue((DefaultProperty) iterator.next());
- }
- }
-
- /**
- * Adds a default value for a property with the specified name and type.
- * @param name the name of the property
- * @param type the type of the property
- * @param value the default value for a property with the specified name and type
- */
- public void addDefaultValue(String name, Class type, Object value) {
- defaultValues.put(new PropertyKey(name, type), value);
- }
-
- /**
- * Adds a defautl value for a property.
- * @param defaultProperty the default property information
- */
- private void addDefaultValue(DefaultProperty defaultProperty) {
- defaultValues.put(new PropertyKey(defaultProperty.getName(), defaultProperty.getType()), defaultProperty.getValue());
- }
-
- public void processParameters(BeanDefinitionHolder definitionHolder, MappingMetaData metadata) throws BeansException {
- // this only works if we have an abstsract bean definition
- if (!(definitionHolder.getBeanDefinition() instanceof AbstractBeanDefinition)) {
- return;
- }
-
- AbstractBeanDefinition beanDefinition = (AbstractBeanDefinition) definitionHolder.getBeanDefinition();
- ConstructorArgumentValues constructorArgumentValues = beanDefinition.getConstructorArgumentValues();
-
- // if this bean already has constructor arguments defined, don't mess with them
- if (constructorArgumentValues.getArgumentCount() > 0) {
- return;
- }
-
- // try to get a list of constructor arg names to use
- ConstructionInfo constructionInfo = selectConstructionMethod(beanDefinition, metadata);
- if (constructionInfo == null) {
- return;
- }
-
- // remove each named property and add an indexed constructor arg
- MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
- String[] parameterNames = constructionInfo.parameterNames;
- Class[] parameterTypes = constructionInfo.parameterTypes;
- for (int i = 0; i < parameterNames.length; i++) {
- String parameterName = parameterNames[i];
- Class parameterType = parameterTypes[i];
-
- PropertyValue propertyValue = propertyValues.getPropertyValue(parameterName);
- if (propertyValue != null) {
- propertyValues.removePropertyValue(parameterName);
- constructorArgumentValues.addIndexedArgumentValue(i, propertyValue.getValue(), parameterType.getName());
- } else {
- Object defaultValue = defaultValues.get(new PropertyKey(parameterName, parameterType));
- if (defaultValue == null) {
- defaultValue = DEFAULT_VALUE.get(parameterType);
- }
- if (defaultValue instanceof FactoryBean) {
- try {
- defaultValue = ((FactoryBean)defaultValue).getObject();
- } catch (Exception e) {
- throw new FatalBeanException("Unable to get object value from bean factory", e);
- }
- }
- constructorArgumentValues.addIndexedArgumentValue(i, defaultValue, parameterType.getName());
- }
- }
-
- // todo set any usable default values on the bean definition
- }
-
- private ConstructionInfo selectConstructionMethod(AbstractBeanDefinition beanDefinition, MappingMetaData metadata) {
- Class beanClass = beanDefinition.getBeanClass();
-
- // get a set containing the names of the defined properties
- Set definedProperties = new HashSet();
- PropertyValue[] values = beanDefinition.getPropertyValues().getPropertyValues();
- for (int i = 0; i < values.length; i++) {
- definedProperties.add(values[i].getName());
- }
-
- // first check for a factory method
- if (beanDefinition.getFactoryMethodName() != null) {
- return selectFactory(beanClass, beanDefinition, metadata, definedProperties);
- } else {
- return selectConstructor(beanClass, metadata, definedProperties);
- }
- }
-
- private ConstructionInfo selectFactory(Class beanClass, AbstractBeanDefinition beanDefinition, MappingMetaData metadata, Set definedProperties) {
- String factoryMethodName = beanDefinition.getFactoryMethodName();
-
- // get the factory methods sorted by longest arg length first
- Method[] methods = beanClass.getMethods();
- List factoryMethods = new ArrayList(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- if (method.getName().equals(factoryMethodName)) {
- factoryMethods.add(method);
- }
- }
-
- Collections.sort(factoryMethods, new ArgLengthComparator());
-
- // if a factory method has been annotated as the default constructor we always use that constructor
- for (Iterator iterator = factoryMethods.iterator(); iterator.hasNext();) {
- Method factoryMethod = (Method) iterator.next();
-
- if (metadata.isDefaultFactoryMethod(beanClass, factoryMethod)) {
- return new ConstructionInfo(beanClass, factoryMethod, metadata);
- }
- }
-
- // try to find a constructor for which we have all of the properties defined
- for (Iterator iterator = factoryMethods.iterator(); iterator.hasNext();) {
- Method factoryMethod = (Method) iterator.next();
- ConstructionInfo constructionInfo = new ConstructionInfo(beanClass, factoryMethod, metadata);
- if (isUsableConstructor(constructionInfo, definedProperties)) {
- return constructionInfo;
- }
- }
- return null;
- }
-
- private ConstructionInfo selectConstructor(Class beanClass, MappingMetaData metadata, Set definedProperties) {
- // get the constructors sorted by longest arg length first
- List constructors = new ArrayList(Arrays.asList(beanClass.getConstructors()));
- Collections.sort(constructors, new ArgLengthComparator());
-
- // if a constructor has been annotated as the default constructor we always use that constructor
- for (Iterator iterator = constructors.iterator(); iterator.hasNext();) {
- Constructor constructor = (Constructor) iterator.next();
-
- if (metadata.isDefaultConstructor(constructor)) {
- return new ConstructionInfo(constructor, metadata);
- }
- }
-
- // try to find a constructor for which we have all of the properties defined
- for (Iterator iterator = constructors.iterator(); iterator.hasNext();) {
- Constructor constructor = (Constructor) iterator.next();
- ConstructionInfo constructionInfo = new ConstructionInfo(constructor, metadata);
- if (isUsableConstructor(constructionInfo, definedProperties)) {
- return constructionInfo;
- }
- }
- return null;
- }
-
- private boolean isUsableConstructor(ConstructionInfo constructionInfo, Set definedProperties) {
- // if we don't have parameter names this is not the constructor we are looking for
- String[] parameterNames = constructionInfo.parameterNames;
- if (parameterNames == null) {
- return false;
- }
-
- Class[] parameterTypes = constructionInfo.parameterTypes;
- for (int i = 0; i < parameterNames.length; i++) {
- String parameterName = parameterNames[i];
- Class parameterType = parameterTypes[i];
-
- // can we satify this property using a defined property or default property
- if (!definedProperties.contains(parameterName) && !defaultValues.containsKey(new PropertyKey(parameterName, parameterType))) {
- return false;
- }
- }
-
- return true;
- }
-
- private class ConstructionInfo {
- private final Class[] parameterTypes;
- private final String[] parameterNames;
-
- public ConstructionInfo(Constructor constructor, MappingMetaData metadata) {
- this.parameterTypes = constructor.getParameterTypes();
- String[] names = metadata.getParameterNames(constructor);
-
- // verify that we have enough parameter names
- int expectedParameterCount = parameterTypes.length;
- if (names != null && names.length != expectedParameterCount) {
- throw new FatalBeanException("Excpected " + expectedParameterCount + " parameter names for constructor but only got " +
- names.length + ": " + constructor.toString());
- }
- if (expectedParameterCount == 0) {
- names = new String[0];
- }
-
- this.parameterNames = names;
- }
-
- public ConstructionInfo(Class beanClass, Method factoryMethod, MappingMetaData metadata) {
- this.parameterTypes = factoryMethod.getParameterTypes();
-
- String[] names = metadata.getParameterNames(beanClass, factoryMethod);
-
- // verify that we have enough parameter names
- int expectedParameterCount = parameterTypes.length;
- if (names != null && names.length != expectedParameterCount) {
- throw new FatalBeanException("Excpected " + expectedParameterCount + " parameter names for factory method but only got " +
- names.length + ": " + factoryMethod.toString());
- }
- if (expectedParameterCount == 0) {
- names = new String[0];
- }
-
- this.parameterNames = names;
- }
- }
-
- private static class ArgLengthComparator implements Comparator {
- public int compare(Object o1, Object o2) {
- return getArgLength(o2) - getArgLength(o1);
- }
-
- private int getArgLength(Object object) {
- if (object instanceof Method) {
- return ((Method) object).getParameterTypes().length;
- } else {
- return ((Constructor) object).getParameterTypes().length;
- }
- }
- }
-
- private static class PropertyKey {
- private final String name;
- private final Class type;
-
- public PropertyKey(String name, Class type) {
- this.name = name;
- this.type = type;
- }
-
- public boolean equals(Object object) {
- if (!(object instanceof PropertyKey)) {
- return false;
- }
-
- PropertyKey defaultProperty = (PropertyKey) object;
- return name.equals(defaultProperty.name) && type.equals(type);
- }
-
- public int hashCode() {
- int result = 17;
- result = 37 * result + name.hashCode();
- result = 37 * result + type.hashCode();
- return result;
- }
-
- public String toString() {
- return "[" + name + " " + type + "]";
- }
- }
-
- private static final Map DEFAULT_VALUE;
- static {
- Map temp = new HashMap();
- temp.put(Boolean.TYPE, Boolean.FALSE);
- temp.put(Byte.TYPE, new Byte((byte) 0));
- temp.put(Character.TYPE, new Character((char) 0));
- temp.put(Short.TYPE, new Short((short) 0));
- temp.put(Integer.TYPE, new Integer(0));
- temp.put(Long.TYPE, new Long(0));
- temp.put(Float.TYPE, new Float(0));
- temp.put(Double.TYPE, new Double(0));
-
- DEFAULT_VALUE = Collections.unmodifiableMap(temp);
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/NamespaceHelper.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/NamespaceHelper.java
deleted file mode 100644
index 9245a28..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/NamespaceHelper.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context.impl;
-
-/**
- * A helper class for turning namespaces into META-INF/services URIs
- *
- * @version $Revision: 1.1 $
- */
-public class NamespaceHelper {
- public static final String META_INF_PREFIX = "META-INF/services/org/apache/xbean/spring/";
- public static final String OLD_META_INF_PREFIX = "META-INF/services/org/xbean/spring/";
-
- /**
- * Converts the namespace and localName into a valid path name we can use on
- * the classpath to discover a text file
- */
- public static String createDiscoveryPathName(String uri, String localName) {
- if (isEmpty(uri)) {
- return localName;
- }
- return createDiscoveryPathName(uri) + "/" + localName;
- }
-
- /**
- * Converts the namespace and localName into a valid path name we can use on
- * the classpath to discover a text file
- */
- public static String createDiscoveryPathName(String uri) {
- // TODO proper encoding required
- // lets replace any dodgy characters
- return META_INF_PREFIX + uri.replaceAll("://", "/").replace(':', '/').replace(' ', '_');
- }
-
- /**
- * Creates the old URI for backwards compatibility
- */
- public static String createDiscoveryOldPathName(String uri) {
- // TODO proper encoding required
- // lets replace any dodgy characters
- return OLD_META_INF_PREFIX + uri.replaceAll("://", "/").replace(':', '/').replace(' ', '_');
- }
-
- public static boolean isEmpty(String uri) {
- return uri == null || uri.length() == 0;
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/ObjectNameEditor.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/ObjectNameEditor.java
deleted file mode 100644
index 9ac6575..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/ObjectNameEditor.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context.impl;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import java.beans.PropertyEditorSupport;
-
-/**
- * Editor for <code>java.net.URI</code>
- */
-public class ObjectNameEditor extends PropertyEditorSupport {
-
- public void setAsText(String text) throws IllegalArgumentException {
- try {
- setValue(new ObjectName(text));
- }
- catch (MalformedObjectNameException e) {
- throw new IllegalArgumentException("Could not convert ObjectName for " + text + ": " + e.getMessage());
- }
- }
-
- public String getAsText() {
- ObjectName value = (ObjectName) getValue();
- return (value != null ? value.toString() : "");
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java
deleted file mode 100644
index a42d8a0..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/PropertyEditorHelper.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context.impl;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyEditorManager;
-
-/**
- * A helper method to register some custom editors
- *
- * @version $Revision: 1.1 $
- */
-public class PropertyEditorHelper {
- private static final Log log = LogFactory.getLog(PropertyEditorHelper.class);
-
- public static void registerCustomEditors() {
- registerEditor("java.net.URI", "org.apache.xbean.spring.context.impl.URIEditor");
- registerEditor("javax.management.ObjectName", "org.apache.xbean.spring.context.impl.ObjectNameEditor");
- }
-
- protected static void registerEditor(String typeName, String editorName) {
- Class type = loadClass(typeName);
- Class editor = loadClass(editorName);
- if (type != null && editor != null) {
- PropertyEditorManager.registerEditor(type, editor);
- }
- }
-
- public static Class loadClass(String name) {
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- if (contextClassLoader != null) {
- try {
- return contextClassLoader.loadClass(name);
- }
- catch (ClassNotFoundException e) {
- }
- catch (NoClassDefFoundError e) {
- }
- }
- try {
- return PropertyEditorHelper.class.getClassLoader().loadClass(name);
- }
- catch (ClassNotFoundException e) {
- log.debug("Could not find class: " + name + " on the classpath");
- return null;
- }
- catch (NoClassDefFoundError e) {
- log.debug("Could not load class: " + name + " on the classpath. " + e.getMessage());
- return null;
- }
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/QNameHelper.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/QNameHelper.java
deleted file mode 100644
index 480684e..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/QNameHelper.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context.impl;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.PropertyValue;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.ManagedList;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import javax.xml.namespace.QName;
-
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- *
- * @version $Revision: 1.1 $
- */
-public class QNameHelper {
- private static final Log log = LogFactory.getLog(QNameHelper.class);
-
- public static QName createQName(Element element, String qualifiedName) {
- int index = qualifiedName.indexOf(':');
- if (index >= 0) {
- String prefix = qualifiedName.substring(0, index);
- String localName = qualifiedName.substring(index + 1);
- String uri = recursiveGetAttributeValue(element, "xmlns:" + prefix);
- return new QName(uri, localName, prefix);
- }
- else {
- String uri = recursiveGetAttributeValue(element, "xmlns");
- if (uri != null) {
- return new QName(uri, qualifiedName);
- }
- return new QName(qualifiedName);
- }
- }
-
- /**
- * Recursive method to find a given attribute value
- */
- public static String recursiveGetAttributeValue(Element element, String attributeName) {
- String answer = null;
- try {
- answer = element.getAttribute(attributeName);
- }
- catch (Exception e) {
- if (log.isTraceEnabled()) {
- log.trace("Caught exception looking up attribute: " + attributeName + " on element: " + element + ". Cause: " + e, e);
- }
- }
- if (answer == null || answer.length() == 0) {
- Node parentNode = element.getParentNode();
- if (parentNode instanceof Element) {
- return recursiveGetAttributeValue((Element) parentNode, attributeName);
- }
- }
- return answer;
- }
-
- public static void coerceQNamePropertyValues(QNameReflectionParams params) {
- coerceNamespaceAwarePropertyValues(params.getBeanDefinition(), params.getElement(), params.getDescriptors(), params.getIndex());
- }
-
- public static void coerceNamespaceAwarePropertyValues(AbstractBeanDefinition bd, Element element, PropertyDescriptor[] descriptors, int i) {
- PropertyDescriptor descriptor = descriptors[i];
- // When the property is an indexed property, the getPropertyType can return null.
- if (descriptor.getPropertyType() == null) {
- return;
- }
- if (descriptor.getPropertyType().isAssignableFrom(QName.class)) {
- String name = descriptor.getName();
- MutablePropertyValues propertyValues = bd.getPropertyValues();
- PropertyValue propertyValue = propertyValues.getPropertyValue(name);
- if (propertyValue != null) {
- Object value = propertyValue.getValue();
- if (value instanceof String) {
- propertyValues.removePropertyValue(propertyValue);
- addPropertyValue(propertyValues, name, createQName(element, (String) value));
- }
- }
- } else if (descriptor.getPropertyType().isAssignableFrom(QName[].class)) {
- String name = descriptor.getName();
- MutablePropertyValues propertyValues = bd.getPropertyValues();
- PropertyValue propertyValue = propertyValues.getPropertyValue(name);
- if (propertyValue != null) {
- Object value = propertyValue.getValue();
- if (value instanceof List) {
- List values = (List) value;
- List newValues = new ManagedList();
- for (Iterator iter = values.iterator(); iter.hasNext();) {
- Object v = iter.next();
- if (v instanceof String) {
- newValues.add(createQName(element, (String) v));
- } else {
- newValues.add(v);
- }
- }
- propertyValues.removePropertyValue(propertyValue);
- propertyValues.addPropertyValue(name, newValues);
- }
- }
- }
- }
-
- // Fix Spring 1.2.6 to 1.2.7 binary incompatibility.
- // The addPropertyValueMethod has changed to return a
- // value instead of void.
- // So use reflectiom to handle both cases.
- private static final Method addPropertyValueMethod;
- static {
- try {
- addPropertyValueMethod = MutablePropertyValues.class.getMethod(
- "addPropertyValue",
- new Class[] { String.class, Object.class });
- } catch (Exception e) {
- throw new RuntimeException("Unable to find MutablePropertyValues:addPropertyValue", e);
- }
- }
- public static void addPropertyValue(MutablePropertyValues values, String name, Object value) {
- try {
- addPropertyValueMethod.invoke(values, new Object[] { name, value });
- } catch (Exception e) {
- throw new RuntimeException("Error adding property definition", e);
- }
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/QNameReflectionHelper.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/QNameReflectionHelper.java
deleted file mode 100644
index 2369a67..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/QNameReflectionHelper.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context.impl;
-
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.w3c.dom.Element;
-
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-
-/**
- * To avoid a runtime dependency on the QName class lets use reflection to
- * process QName instances.
- *
- * @version $Revision: 1.1 $
- */
-public class QNameReflectionHelper {
-
- protected static Method coerceMethod;
- protected static Method createMethod;
-
- public static void coerceNamespaceAwarePropertyValues(AbstractBeanDefinition beanDefinition, Element element,
- PropertyDescriptor[] descriptors, int index) {
- QNameReflectionParams params = new QNameReflectionParams(beanDefinition, element, descriptors, index);
- if (coerceMethod == null) {
- coerceMethod = findMethod("coerceQNamePropertyValues");
- }
- if (coerceMethod != null) {
- try {
- coerceMethod.invoke(null, new Object[] { params });
- }
- catch (Exception e) {
- throw new BeanDefinitionStoreException("Failed to invoke method: " + coerceMethod + " via reflection: " + e,
- e);
- }
- }
- }
-
- public static Object createQName(Element element, String text) {
- if (createMethod == null) {
- createMethod = findMethod("createQName");
- }
- if (createMethod != null) {
- try {
- return createMethod.invoke(null, new Object[] { element, text });
- }
- catch (Exception e) {
- throw new BeanDefinitionStoreException("Failed to invoke method: " + createMethod + " via reflection: " + e,
- e);
- }
- }
- return null;
- }
-
- protected static Method findMethod(String name) {
- Class type = PropertyEditorHelper.loadClass("org.apache.xbean.spring.context.impl.QNameHelper");
- if (type != null) {
- Method[] methods = type.getMethods();
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- if (method.getName().equals(name)) {
- return method;
- }
- }
- }
- return null;
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/QNameReflectionParams.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/QNameReflectionParams.java
deleted file mode 100644
index 3cf6449..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/QNameReflectionParams.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context.impl;
-
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.w3c.dom.Element;
-
-import java.beans.PropertyDescriptor;
-
-/**
- *
- * @version $Revision: 1.1 $
- */
-public class QNameReflectionParams {
-
- private final AbstractBeanDefinition beanDefinition;
- private final Element element;
- private final PropertyDescriptor[] descriptors;
- private final int index;
-
- public QNameReflectionParams(AbstractBeanDefinition beanDefinition, Element element,
- PropertyDescriptor[] descriptors, int index) {
- this.beanDefinition = beanDefinition;
- this.element = element;
- this.descriptors = descriptors;
- this.index = index;
- }
-
- public AbstractBeanDefinition getBeanDefinition() {
- return beanDefinition;
- }
-
- public PropertyDescriptor[] getDescriptors() {
- return descriptors;
- }
-
- public Element getElement() {
- return element;
- }
-
- public int getIndex() {
- return index;
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/URIEditor.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/URIEditor.java
deleted file mode 100644
index a25596e..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/URIEditor.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context.impl;
-
-import java.beans.PropertyEditorSupport;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * Editor for <code>java.net.URI</code>
- */
-public class URIEditor extends PropertyEditorSupport {
-
- public void setAsText(String text) throws IllegalArgumentException {
- try {
- setValue(new URI(text));
- }
- catch (URISyntaxException e) {
- throw new IllegalArgumentException(
- "Could not convert URI for " + text + ": " + e.getMessage());
- }
- }
-
- public String getAsText() {
- URI value = (URI) getValue();
- return (value != null ? value.toString() : "");
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/XBeanHelper.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/XBeanHelper.java
deleted file mode 100644
index 721d381..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/XBeanHelper.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.apache.xbean.spring.context.impl;
-
-import java.lang.reflect.Constructor;
-import java.util.List;
-
-import org.apache.xbean.spring.context.SpringApplicationContext;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.core.SpringVersion;
-
-public class XBeanHelper {
-
- public static XmlBeanDefinitionReader createBeanDefinitionReader(
- SpringApplicationContext applicationContext,
- BeanDefinitionRegistry registry,
- List xmlPreprocessors) {
- String version = SpringVersion.getVersion();
- String className = "org.apache.xbean.spring.context.v" + version.charAt(0) + ".XBeanXmlBeanDefinitionReader";
- try {
- Class cl = Class.forName(className);
- Constructor cstr = cl.getConstructor(new Class[] { SpringApplicationContext.class, BeanDefinitionRegistry.class, List.class });
- return (XmlBeanDefinitionReader) cstr.newInstance(new Object[] { applicationContext, registry, xmlPreprocessors });
- } catch (Exception e) {
- throw new IllegalStateException("Could not find valid implementation for: " + version, e);
- }
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanFactory.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanFactory.java
deleted file mode 100644
index da178d7..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/context/impl/XBeanXmlBeanFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.impl;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.core.io.Resource;
-
-public class XBeanXmlBeanFactory extends DefaultListableBeanFactory {
-
- /**
- * Create a new XBeanXmlBeanFactory with the given resource,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource) throws BeansException {
- this(resource, null, Collections.EMPTY_LIST);
- }
-
- /**
- * Create a new XBeanXmlBeanFactory with the given input stream,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @param parentBeanFactory parent bean factory
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory) throws BeansException {
- this(resource, parentBeanFactory, Collections.EMPTY_LIST);
- }
-
- /**
- * Create a new XBeanXmlBeanFactory with the given input stream,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource, List xmlPreprocessors) throws BeansException {
- this(resource, null, xmlPreprocessors);
- }
-
- /**
- * Create a new XBeanXmlBeanFactory with the given input stream,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @param parentBeanFactory parent bean factory
- * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory, List xmlPreprocessors) throws BeansException {
- super(parentBeanFactory);
- XmlBeanDefinitionReader reader = XBeanHelper.createBeanDefinitionReader(null, this, xmlPreprocessors);
- reader.loadBeanDefinitions(resource);
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/AttributeMapping.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/AttributeMapping.java
deleted file mode 100644
index 2de987d..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/AttributeMapping.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class AttributeMapping implements Comparable {
- private final String attributeName;
- private final String propertyName;
- private final String description;
- private final Type type;
- private final String value;
- private final boolean fixed;
- private final boolean required;
-
- public AttributeMapping(String attributeName, String propertyName, String description, Type type, String value, boolean fixed, boolean required) {
- if (attributeName == null) throw new NullPointerException("attributeName");
- if (propertyName == null) throw new NullPointerException("propertyName");
- if (type == null) throw new NullPointerException("type");
- this.attributeName = attributeName;
- this.propertyName = propertyName;
- if (description == null) description = "";
- this.description = description;
- this.type = type;
- this.value = value;
- this.fixed = fixed;
- this.required = required;
- }
-
- public String getAttributeName() {
- return attributeName;
- }
-
- public String getPropertyName() {
- return propertyName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public Type getType() {
- return type;
- }
-
- public String getValue() {
- return value;
- }
-
- public boolean isFixed() {
- return fixed;
- }
-
- public boolean isRequired() {
- return required;
- }
-
- public int hashCode() {
- return attributeName.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof AttributeMapping) {
- return attributeName.equals(((AttributeMapping) obj).attributeName);
- }
- return false;
- }
-
- public int compareTo(Object obj) {
- return attributeName.compareTo(((AttributeMapping) obj).attributeName);
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/DocumentationGenerator.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/DocumentationGenerator.java
deleted file mode 100644
index cf49c27..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/DocumentationGenerator.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class DocumentationGenerator implements GeneratorPlugin {
- private final File destFile;
- private final LogFacade log;
-
- public DocumentationGenerator(LogFacade log, File destFile) {
- this.destFile = destFile;
- this.log = log;
- }
-
- public void generate(NamespaceMapping namespaceMapping) throws IOException {
- String namespace = namespaceMapping.getNamespace();
-
- // TODO can only handle 1 schema document so far...
- File file = new File(destFile.getParentFile(), destFile.getName() + ".html");
- log.log("Generating HTML documentation file: " + file + " for namespace: " + namespace);
- PrintWriter out = new PrintWriter(new FileWriter(file));
- try {
- generateDocumentation(out, namespaceMapping);
- } finally {
- out.close();
- }
- }
-
- private void generateDocumentation(PrintWriter out, NamespaceMapping namespaceMapping) {
- String namespace = namespaceMapping.getNamespace();
-
- out.println("<!-- NOTE: this file is autogenerated by XBeans -->");
- out.println("<html>");
- out.println("<head>");
- out.println("<title>Schema for namespace: " + namespace + "</title>");
- out.println("<link rel='stylesheet' href='style.css' type='text/css'>");
- out.println("<link rel='stylesheet' href='http://activemq.org/style.css' type='text/css'>");
- out.println("<link rel='stylesheet' href='http://activemq.org/style-xb.css' type='text/css'>");
- out.println("</head>");
- out.println();
- out.println("<body>");
- out.println();
-
- generateRootElement(out, namespaceMapping);
-
- generateElementsSummary(out, namespaceMapping);
- out.println();
- out.println();
-
- generateElementsDetail(out, namespaceMapping);
-
- out.println();
- out.println("</body>");
- out.println("</html>");
- }
-
- private void generateRootElement(PrintWriter out, NamespaceMapping namespaceMapping) {
- ElementMapping rootElement = namespaceMapping.getRootElement();
- if (rootElement != null) {
- out.println("<h1>Root Element</h1>");
- out.println("<table>");
- out.println(" <tr><th>Element</th><th>Description</th><th>Class</th>");
- generateElementSummary(out, rootElement);
- out.println("</table>");
- out.println();
- }
- }
-
- private void generateElementsSummary(PrintWriter out, NamespaceMapping namespaceMapping) {
- out.println("<h1>Element Summary</h1>");
- out.println("<table>");
- out.println(" <tr><th>Element</th><th>Description</th><th>Class</th>");
- for (Iterator iter = namespaceMapping.getElements().iterator(); iter.hasNext();) {
- ElementMapping element = (ElementMapping) iter.next();
- generateElementSummary(out, element);
- }
- out.println("</table>");
- }
-
- private void generateElementSummary(PrintWriter out, ElementMapping element) {
- out.println(" <tr>" +
- "<td><a href='#" + element.getElementName() + "'>" + element.getElementName() + "</a></td>" +
- "<td>" + element.getDescription() + "</td>" +
- "<td>" + element.getClassName() + "</td></tr>");
- }
-
- private void generateElementsDetail(PrintWriter out, NamespaceMapping namespaceMapping) {
- out.println("<h1>Element Detail</h1>");
- for (Iterator iter = namespaceMapping.getElements().iterator(); iter.hasNext();) {
- ElementMapping element = (ElementMapping) iter.next();
- generateHtmlElementDetail(out, namespaceMapping, element);
- }
- }
-
- private void generateHtmlElementDetail(PrintWriter out, NamespaceMapping namespaceMapping, ElementMapping element) {
- out.println("<h2>Element: <a name='" + element.getElementName() + "'>" + element.getElementName() + "</a></h2>");
-
- boolean hasAttributes = false;
- boolean hasElements = false;
- for (Iterator iterator = element.getAttributes().iterator(); iterator.hasNext() && (!hasAttributes || !hasElements);) {
- AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
- Type type = attributeMapping.getType();
- if (Utils.isSimpleType(type)) {
- hasAttributes = true;
- } else {
- hasElements = true;
- }
- }
-
- if (hasAttributes) {
- out.println("<table>");
- out.println(" <tr><th>Attribute</th><th>Type</th><th>Description</th>");
- for (Iterator iterator = element.getAttributes().iterator(); iterator.hasNext();) {
- AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
- Type type = attributeMapping.getType();
- if (Utils.isSimpleType(type)) {
- out.println(" <tr><td>" + attributeMapping.getAttributeName() + "</td><td>" + Utils.getXsdType(type)
- + "</td><td>" + attributeMapping.getDescription() + "</td></tr>");
- }
-
- }
- out.println("</table>");
- }
-
- if (hasElements) {
- out.println("<table>");
- out.println(" <tr><th>Element</th><th>Type</th><th>Description</th>");
- for (Iterator iterator = element.getAttributes().iterator(); iterator.hasNext();) {
- AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
- Type type = attributeMapping.getType();
- if (!Utils.isSimpleType(type)) {
- out.print(" <tr><td>" + attributeMapping.getAttributeName() + "</td><td>");
- printComplexPropertyTypeDocumentation(out, namespaceMapping, type);
- out.println("</td><td>" + attributeMapping.getDescription() + "</td></tr>");
- }
- }
- out.println("</table>");
- }
- }
-
- private void printComplexPropertyTypeDocumentation(PrintWriter out, NamespaceMapping namespaceMapping, Type type) {
- if (type.isCollection()) {
- out.print("(");
- }
-
- List types;
- if (type.isCollection()) {
- types = Utils.findImplementationsOf(namespaceMapping, type.getNestedType());
- } else {
- types = Utils.findImplementationsOf(namespaceMapping, type);
- }
-
- for (Iterator iterator = types.iterator(); iterator.hasNext();) {
- ElementMapping element = (ElementMapping) iterator.next();
- out.print("<a href='#" + element.getElementName() + "'>" + element.getElementName() + "</a>");
- if (iterator.hasNext()) {
- out.print(" | ");
- }
- }
- if (types.size() == 0) {
- out.print("<spring:bean/>");
- }
-
- if (type.isCollection()) {
- out.print(")*");
- }
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/ElementMapping.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/ElementMapping.java
deleted file mode 100644
index e8dc989..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/ElementMapping.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class ElementMapping implements Comparable {
- private final String namespace;
- private final String elementName;
- private final String className;
- private final String description;
- private final boolean rootElement;
- private final String initMethod;
- private final String destroyMethod;
- private final String factoryMethod;
- private final String contentProperty;
- private final Set attributes;
- private final Map attributesByName;
- private final List constructors;
- private final List flatProperties;
- private final Map maps;
- private final Map flatCollections;
-
- public ElementMapping(String namespace, String elementName, String className, String description,
- boolean rootElement, String initMethod, String destroyMethod, String factoryMethod,
- String contentProperty, Set attributes, List constructors, List flatProperties, Map maps, Map flatCollections) {
- if (namespace == null) throw new NullPointerException("namespace");
- if (elementName == null) throw new NullPointerException("elementName");
- if (className == null) throw new NullPointerException("className");
- if (attributes == null) throw new NullPointerException("attributes");
- if (constructors == null) throw new NullPointerException("constructors");
-
- this.namespace = namespace;
- this.elementName = elementName;
- this.className = className;
- this.description = description;
- this.rootElement = rootElement;
- this.initMethod = initMethod;
- this.destroyMethod = destroyMethod;
- this.factoryMethod = factoryMethod;
- this.contentProperty = contentProperty;
- this.constructors = constructors;
- this.attributes = Collections.unmodifiableSet(new TreeSet(attributes));
- this.maps = Collections.unmodifiableMap(maps);
- this.flatProperties = Collections.unmodifiableList(flatProperties);
- this.flatCollections = Collections.unmodifiableMap(flatCollections);
-
- Map attributesByName = new HashMap();
- for (Iterator iterator = attributes.iterator(); iterator.hasNext();) {
- AttributeMapping attribute = (AttributeMapping) iterator.next();
- attributesByName.put(attribute.getAttributeName(), attribute);
- }
- this.attributesByName = Collections.unmodifiableMap(attributesByName);
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public String getElementName() {
- return elementName;
- }
-
- public String getClassName() {
- return className;
- }
-
- public String getDescription() {
- return description;
- }
-
- public boolean isRootElement() {
- return rootElement;
- }
-
- public String getInitMethod() {
- return initMethod;
- }
-
- public String getDestroyMethod() {
- return destroyMethod;
- }
-
- public String getFactoryMethod() {
- return factoryMethod;
- }
-
- public String getContentProperty() {
- return contentProperty;
- }
-
- public Set getAttributes() {
- return attributes;
- }
-
- public AttributeMapping getAttribute(String attributeName) {
- return (AttributeMapping) attributesByName.get(attributeName);
- }
-
- public Map getMapMappings() {
- return maps;
- }
-
- public MapMapping getMapMapping(String name) {
- return (MapMapping) maps.get(name);
- }
-
- public Map getFlatCollections() {
- return flatCollections;
- }
-
- public List getFlatProperties() {
- return flatProperties;
- }
-
- public List getConstructors() {
- return constructors;
- }
-
- public int hashCode() {
- return elementName.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof ElementMapping) {
- return elementName.equals(((ElementMapping) obj).elementName);
- }
- return false;
- }
-
- public int compareTo(Object obj) {
- return elementName.compareTo(((ElementMapping) obj).elementName);
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/GeneratorPlugin.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/GeneratorPlugin.java
deleted file mode 100644
index b75a4b6..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/GeneratorPlugin.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.io.IOException;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public interface GeneratorPlugin {
- void generate(NamespaceMapping namespaceMapping) throws IOException;
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/InvalidModelException.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/InvalidModelException.java
deleted file mode 100644
index 7d5b0ba..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/InvalidModelException.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class InvalidModelException extends RuntimeException {
- public InvalidModelException(String message) {
- super(message);
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/LogFacade.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/LogFacade.java
deleted file mode 100644
index 08b9194..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/LogFacade.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.apache.xbean.spring.generator;
-
-public interface LogFacade {
-
- void log(String message);
-
- void log(String message, int level);
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MapMapping.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MapMapping.java
deleted file mode 100644
index e7f7654..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MapMapping.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.apache.xbean.spring.generator;
-
-public class MapMapping {
- private String entryName;
- private String keyName;
-
- public MapMapping(String entryName, String keyName) {
- this.entryName = entryName;
- this.keyName = keyName;
- }
-
- public String getEntryName() {
- return entryName;
- }
-
- public String getKeyName() {
- return keyName;
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MappingGeneratorTask.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MappingGeneratorTask.java
deleted file mode 100644
index 721b334..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MappingGeneratorTask.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.apache.xbean.spring.generator;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.MatchingTask;
-import org.apache.tools.ant.types.Path;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.StringTokenizer;
-import java.beans.PropertyEditorManager;
-
-/**
- * An Ant task for executing generating mapping metadata.
- *
- * @version $Revision$
- */
-public class MappingGeneratorTask extends MatchingTask implements LogFacade {
- private String namespace;
- private Path srcDir;
- private File destFile = new File("target/classes/schema.xsd");
- private String metaInfDir = "target/classes/";
- private String propertyEditorPaths = "org.apache.xbean.spring.context.impl";
-
- public File getDestFile() {
- return destFile;
- }
-
- public void setDestFile(File destFile) {
- this.destFile = destFile;
- }
-
- public String getMetaInfDir() {
- return metaInfDir;
- }
-
- public void setMetaInfDir(String metaInfDir) {
- this.metaInfDir = metaInfDir;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
- public Path getSrcDir() {
- return srcDir;
- }
-
- public void setSrcDir(Path srcDir) {
- this.srcDir = srcDir;
- }
-
- public String getPropertyEditorPaths() {
- return propertyEditorPaths;
- }
-
- public void setPropertyEditorPaths(String propertyEditorPaths) {
- this.propertyEditorPaths = propertyEditorPaths;
- }
-
- public void execute() throws BuildException {
- if (namespace == null) {
- throw new BuildException("'namespace' must be specified");
- }
- if (srcDir == null) {
- throw new BuildException("'srcDir' must be specified");
- }
- if (destFile == null) {
- throw new BuildException("'destFile' must be specified");
- }
-
- if (propertyEditorPaths != null) {
- List editorSearchPath = new LinkedList(Arrays.asList(PropertyEditorManager.getEditorSearchPath()));
- StringTokenizer paths = new StringTokenizer(propertyEditorPaths, " ,");
- editorSearchPath.addAll(Collections.list(paths));
- PropertyEditorManager.setEditorSearchPath((String[]) editorSearchPath.toArray(new String[editorSearchPath.size()]));
- }
-
- ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- try {
- MappingLoader mappingLoader = new QdoxMappingLoader(namespace, getFiles(srcDir));
-
- GeneratorPlugin[] plugins = new GeneratorPlugin[]{
- new XmlMetadataGenerator(this, metaInfDir),
- new DocumentationGenerator(this, destFile),
- new XsdGenerator(this, destFile)
- };
-
- // load the mappings
- Set namespaces = mappingLoader.loadNamespaces();
- if (namespaces.isEmpty()) {
- System.out.println("Warning: no namespaces found!");
- }
-
- // generate the files
- for (Iterator iterator = namespaces.iterator(); iterator.hasNext();) {
- NamespaceMapping namespaceMapping = (NamespaceMapping) iterator.next();
- for (int i = 0; i < plugins.length; i++) {
- GeneratorPlugin plugin = plugins[i];
- plugin.generate(namespaceMapping);
- }
- }
-
- log("...done.");
- } catch (Exception e) {
- throw new BuildException(e);
- } finally {
- Thread.currentThread().setContextClassLoader(oldCL);
- }
- }
-
- private File[] getFiles(Path path) {
- if (path == null) {
- return null;
- }
- String[] paths = path.list();
- File[] files = new File[paths.length];
- for (int i = 0; i < files.length; i++) {
- files[i] = new File(paths[i]).getAbsoluteFile();
- }
- return files;
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MappingLoader.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MappingLoader.java
deleted file mode 100644
index c13f129..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MappingLoader.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.io.IOException;
-import java.util.Set;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public interface MappingLoader {
- Set loadNamespaces() throws IOException;
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/NamespaceMapping.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/NamespaceMapping.java
deleted file mode 100644
index 6d10d07..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/NamespaceMapping.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class NamespaceMapping implements Comparable {
- private final String namespace;
- private final Set elements;
- private final Map elementsByName;
- private final ElementMapping rootElement;
-
- public NamespaceMapping(String namespace, Set elements, ElementMapping rootElement) {
- this.namespace = namespace;
- this.elements = Collections.unmodifiableSet(new TreeSet(elements));
- this.rootElement = rootElement;
-
- Map elementsByName = new HashMap();
- for (Iterator iterator = elements.iterator(); iterator.hasNext();) {
- ElementMapping elementMapping = (ElementMapping) iterator.next();
- elementsByName.put(elementMapping.getElementName(), elementMapping);
- }
- this.elementsByName = Collections.unmodifiableMap(elementsByName);
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public Set getElements() {
- return elements;
- }
-
- public ElementMapping getElement(String elementName) {
- return (ElementMapping) elementsByName.get(elementName);
- }
-
- public ElementMapping getRootElement() {
- return rootElement;
- }
-
- public int hashCode() {
- return namespace.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof NamespaceMapping) {
- return namespace.equals(((NamespaceMapping) obj).namespace);
- }
- return false;
- }
-
- public int compareTo(Object obj) {
- return namespace.compareTo(((NamespaceMapping) obj).namespace);
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
deleted file mode 100644
index 4e2d509..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.thoughtworks.qdox.JavaDocBuilder;
-import com.thoughtworks.qdox.model.BeanProperty;
-import com.thoughtworks.qdox.model.DocletTag;
-import com.thoughtworks.qdox.model.JavaClass;
-import com.thoughtworks.qdox.model.JavaMethod;
-import com.thoughtworks.qdox.model.JavaParameter;
-import com.thoughtworks.qdox.model.JavaSource;
-import com.thoughtworks.qdox.model.Type;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class QdoxMappingLoader implements MappingLoader {
- public static final String XBEAN_ANNOTATION = "org.apache.xbean.XBean";
- public static final String PROPERTY_ANNOTATION = "org.apache.xbean.Property";
- public static final String INIT_METHOD_ANNOTATION = "org.apache.xbean.InitMethod";
- public static final String DESTROY_METHOD_ANNOTATION = "org.apache.xbean.DestroyMethod";
- public static final String FACTORY_METHOD_ANNOTATION = "org.apache.xbean.FactoryMethod";
- public static final String MAP_ANNOTATION = "org.apache.xbean.Map";
- public static final String FLAT_PROPERTY_ANNOTATION = "org.apache.xbean.Flat";
- public static final String FLAT_COLLECTION_ANNOTATION = "org.apache.xbean.FlatCollection";
- public static final String ELEMENT_ANNOTATION = "org.apache.xbean.Element";
-
- private static final Log log = LogFactory.getLog(QdoxMappingLoader.class);
- private final String defaultNamespace;
- private final File[] srcDirs;
- private Type listType;
-
- public QdoxMappingLoader(String defaultNamespace, File[] srcDirs) {
- this.defaultNamespace = defaultNamespace;
- this.srcDirs = srcDirs;
- }
-
- public String getDefaultNamespace() {
- return defaultNamespace;
- }
-
- public File[] getSrcDirs() {
- return srcDirs;
- }
-
- public Set loadNamespaces() throws IOException {
- JavaDocBuilder builder = new JavaDocBuilder();
-
- log.debug("Source directories: ");
-
- for (int it = 0; it < srcDirs.length; it++) {
- File sourceDirectory = srcDirs[it];
-
- if (!sourceDirectory.isDirectory()) {
- log.warn("Specified source directory isn't a directory: '" + sourceDirectory.getAbsolutePath() + "'.");
- }
- log.debug(" - " + sourceDirectory.getAbsolutePath());
-
- builder.addSourceTree(sourceDirectory);
- }
-
- listType = builder.getClassByName("java.util.List").asType();
- Set namespaces = loadNamespaces(builder);
- return namespaces;
- }
-
- private Set loadNamespaces(JavaDocBuilder builder) {
- // load all of the elements
- List elements = loadElements(builder);
-
-
- // index the elements by namespace and find the root element of each namespace
- Map elementsByNamespace = new HashMap();
- Map namespaceRoots = new HashMap();
- for (Iterator iterator = elements.iterator(); iterator.hasNext();) {
- ElementMapping element = (ElementMapping) iterator.next();
- String namespace = element.getNamespace();
- Set namespaceElements = (Set) elementsByNamespace.get(namespace);
- if (namespaceElements == null) {
- namespaceElements = new HashSet();
- elementsByNamespace.put(namespace, namespaceElements);
- }
- namespaceElements.add(element);
- if (element.isRootElement()) {
- if (namespaceRoots.containsKey(namespace)) {
- log.warn("Multiple root elements found for namespace " + namespace);
- }
- namespaceRoots.put(namespace, element);
- }
- }
-
- // build the NamespaceMapping objects
- Set namespaces = new TreeSet();
- for (Iterator iterator = elementsByNamespace.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String namespace = (String) entry.getKey();
- Set namespaceElements = (Set) entry.getValue();
- ElementMapping rootElement = (ElementMapping) namespaceRoots.get(namespace);
- NamespaceMapping namespaceMapping = new NamespaceMapping(namespace, namespaceElements, rootElement);
- namespaces.add(namespaceMapping);
- }
- return Collections.unmodifiableSet(namespaces);
- }
-
- private List loadElements(JavaDocBuilder builder) {
- JavaSource[] javaSources = builder.getSources();
- List elements = new ArrayList();
- for (int i = 0; i < javaSources.length; i++) {
- JavaClass javaClass = javaSources[i].getClasses()[0];
-
- ElementMapping element = loadElement(javaClass);
- if (element != null && !javaClass.isAbstract()) {
- elements.add(element);
- } else {
- log.debug("No XML annotation found for type: " + javaClass.getFullyQualifiedName());
- }
- }
- return elements;
- }
-
- private ElementMapping loadElement(JavaClass javaClass) {
- DocletTag xbeanTag = javaClass.getTagByName(XBEAN_ANNOTATION);
- if (xbeanTag == null) {
- return null;
- }
-
- String element = getElementName(javaClass, xbeanTag);
- String description = getProperty(xbeanTag, "description");
- if (description == null) {
- description = javaClass.getComment();
-
- }
- String namespace = getProperty(xbeanTag, "namespace", defaultNamespace);
- boolean root = getBooleanProperty(xbeanTag, "rootElement");
- String contentProperty = getProperty(xbeanTag, "contentProperty");
-
- Map mapsByPropertyName = new HashMap();
- List flatProperties = new ArrayList();
- Map flatCollections = new HashMap();
- Set attributes = new HashSet();
- Map attributesByPropertyName = new HashMap();
-
- for (JavaClass jClass = javaClass; jClass != null; jClass = jClass.getSuperJavaClass()) {
- BeanProperty[] beanProperties = jClass.getBeanProperties();
- for (int i = 0; i < beanProperties.length; i++) {
- BeanProperty beanProperty = beanProperties[i];
-
- // we only care about properties with a setter
- if (beanProperty.getMutator() != null) {
- AttributeMapping attributeMapping = loadAttribute(beanProperty, "");
- if (attributeMapping != null) {
- attributes.add(attributeMapping);
- attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
- }
- JavaMethod acc = beanProperty.getAccessor();
- if (acc != null) {
- DocletTag mapTag = acc.getTagByName(MAP_ANNOTATION);
- if (mapTag != null) {
- MapMapping mm = new MapMapping(mapTag.getNamedParameter("entryName"),
- mapTag.getNamedParameter("keyName"));
- mapsByPropertyName.put(beanProperty.getName(), mm);
- }
-
- DocletTag flatColTag = acc.getTagByName(FLAT_COLLECTION_ANNOTATION);
- if (flatColTag != null) {
- String childName = flatColTag.getNamedParameter("childElement");
- if (childName == null)
- throw new InvalidModelException("Flat collections must specify the childElement attribute.");
- flatCollections.put(beanProperty.getName(), childName);
- }
-
- DocletTag flatPropTag = acc.getTagByName(FLAT_PROPERTY_ANNOTATION);
- if (flatPropTag != null) {
- flatProperties.add(beanProperty.getName());
- }
- }
- }
- }
- }
-
- String initMethod = null;
- String destroyMethod = null;
- String factoryMethod = null;
- for (JavaClass jClass = javaClass; jClass != null; jClass = jClass.getSuperJavaClass()) {
- JavaMethod[] methods = javaClass.getMethods();
- for (int i = 0; i < methods.length; i++) {
- JavaMethod method = methods[i];
- if (method.isPublic() && !method.isConstructor()) {
- if (initMethod == null && method.getTagByName(INIT_METHOD_ANNOTATION) != null) {
- initMethod = method.getName();
- }
- if (destroyMethod == null && method.getTagByName(DESTROY_METHOD_ANNOTATION) != null) {
- destroyMethod = method.getName();
- }
- if (factoryMethod == null && method.getTagByName(FACTORY_METHOD_ANNOTATION) != null) {
- factoryMethod = method.getName();
- }
-
- }
- }
- }
-
- List constructorArgs = new ArrayList();
- JavaMethod[] methods = javaClass.getMethods();
- for (int i = 0; i < methods.length; i++) {
- JavaMethod method = methods[i];
- JavaParameter[] parameters = method.getParameters();
- if (isValidConstructor(factoryMethod, method, parameters)) {
- List args = new ArrayList(parameters.length);
- for (int j = 0; j < parameters.length; j++) {
- JavaParameter parameter = parameters[j];
- String parameterType = parameter.getType().toString();
- AttributeMapping attributeMapping = (AttributeMapping) attributesByPropertyName.get(parameter.getName());
- if (attributeMapping == null) {
- attributeMapping = loadParameter(parameter);
-
- attributes.add(attributeMapping);
- attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
- }
- if (!parameterType.equals(attributeMapping.getType().getName())) {
- throw new InvalidModelException("Type mismatch:" +
- " The construction method " + toMethodLocator(parameter.getParentMethod()) +
- " declared parameter " + parameter.getName() + " as a " + parameterType +
- " but the bean property type is " + attributeMapping.getType().getName());
- }
- args.add(attributeMapping);
- }
- constructorArgs.add(Collections.unmodifiableList(args));
- }
- }
-
- return new ElementMapping(namespace,
- element,
- javaClass.getFullyQualifiedName(),
- description,
- root,
- initMethod,
- destroyMethod,
- factoryMethod,
- contentProperty,
- attributes,
- constructorArgs,
- flatProperties,
- mapsByPropertyName,
- flatCollections);
- }
-
- private String getElementName(JavaClass javaClass, DocletTag tag) {
- String elementName = getProperty(tag, "element");
- if (elementName == null) {
- String className = javaClass.getFullyQualifiedName();
- int index = className.lastIndexOf(".");
- if (index > 0) {
- className = className.substring(index + 1);
- }
- // strip off "Bean" from a spring factory bean
- if (className.endsWith("FactoryBean")) {
- className = className.substring(0, className.length() - 4);
- }
- elementName = Utils.decapitalise(className);
- }
- return elementName;
- }
-
- private AttributeMapping loadAttribute(BeanProperty beanProperty, String defaultDescription) {
- DocletTag propertyTag = getPropertyTag(beanProperty);
-
- if (getBooleanProperty(propertyTag, "hidden")) {
- return null;
- }
-
- String attribute = getProperty(propertyTag, "alias", beanProperty.getName());
- String attributeDescription = getAttributeDescription(beanProperty, propertyTag, defaultDescription);
- String defaultValue = getProperty(propertyTag, "default");
- boolean fixed = getBooleanProperty(propertyTag, "fixed");
- boolean required = getBooleanProperty(propertyTag, "required");
- String nestedType = getProperty(propertyTag, "nestedType");
-
- return new AttributeMapping(attribute,
- beanProperty.getName(),
- attributeDescription,
- toMappingType(beanProperty.getType(), nestedType),
- defaultValue,
- fixed,
- required);
- }
-
- private static DocletTag getPropertyTag(BeanProperty beanProperty) {
- JavaMethod accessor = beanProperty.getAccessor();
- if (accessor != null) {
- DocletTag propertyTag = accessor.getTagByName(PROPERTY_ANNOTATION);
- if (propertyTag != null) {
- return propertyTag;
- }
- }
- JavaMethod mutator = beanProperty.getMutator();
- if (mutator != null) {
- DocletTag propertyTag = mutator.getTagByName(PROPERTY_ANNOTATION);
- if (propertyTag != null) {
- return propertyTag;
- }
- }
- return null;
- }
-
- private String getAttributeDescription(BeanProperty beanProperty, DocletTag propertyTag, String defaultDescription) {
- String description = getProperty(propertyTag, "description");
- if (description != null && description.trim().length() > 0) {
- return description.trim();
- }
-
- JavaMethod accessor = beanProperty.getAccessor();
- if (accessor != null) {
- description = accessor.getComment();
- if (description != null && description.trim().length() > 0) {
- return description.trim();
- }
- }
-
- JavaMethod mutator = beanProperty.getMutator();
- if (mutator != null) {
- description = mutator.getComment();
- if (description != null && description.trim().length() > 0) {
- return description.trim();
- }
- }
- return defaultDescription;
- }
-
- private AttributeMapping loadParameter(JavaParameter parameter) {
- String parameterName = parameter.getName();
- String parameterDescription = getParameterDescription(parameter);
-
- // first attempt to load the attribute from the java beans accessor methods
- JavaClass javaClass = parameter.getParentMethod().getParentClass();
- BeanProperty beanProperty = javaClass.getBeanProperty(parameterName);
- if (beanProperty != null) {
- AttributeMapping attributeMapping = loadAttribute(beanProperty, parameterDescription);
- // if the attribute mapping is null, the property was tagged as hidden and this is an error
- if (attributeMapping == null) {
- throw new InvalidModelException("Hidden property usage: " +
- "The construction method " + toMethodLocator(parameter.getParentMethod()) +
- " can not use a hidded property " + parameterName);
- }
- return attributeMapping;
- }
-
- // create an attribute solely based on the parameter information
- return new AttributeMapping(parameterName,
- parameterName,
- parameterDescription,
- toMappingType(parameter.getType(), null),
- null,
- false,
- false);
- }
-
- private String getParameterDescription(JavaParameter parameter) {
- String parameterName = parameter.getName();
- DocletTag[] tags = parameter.getParentMethod().getTagsByName("param");
- for (int k = 0; k < tags.length; k++) {
- DocletTag tag = tags[k];
- if (tag.getParameters()[0].equals(parameterName)) {
- String parameterDescription = tag.getValue().trim();
- if (parameterDescription.startsWith(parameterName)) {
- parameterDescription = parameterDescription.substring(parameterName.length()).trim();
- }
- return parameterDescription;
- }
- }
- return null;
- }
-
- private boolean isValidConstructor(String factoryMethod, JavaMethod method, JavaParameter[] parameters) {
- if (!method.isPublic() || parameters.length == 0) {
- return false;
- }
-
- if (factoryMethod == null) {
- return method.isConstructor();
- } else {
- return method.getName().equals(factoryMethod);
- }
- }
-
- private static String getProperty(DocletTag propertyTag, String propertyName) {
- return getProperty(propertyTag, propertyName, null);
- }
-
- private static String getProperty(DocletTag propertyTag, String propertyName, String defaultValue) {
- String value = null;
- if (propertyTag != null) {
- value = propertyTag.getNamedParameter(propertyName);
- }
- if (value == null) {
- return defaultValue;
- }
- return value;
- }
-
- private boolean getBooleanProperty(DocletTag propertyTag, String propertyName) {
- return toBoolean(getProperty(propertyTag, propertyName));
- }
-
- private static boolean toBoolean(String value) {
- if (value != null) {
- return new Boolean(value).booleanValue();
- }
- return false;
- }
-
- private org.apache.xbean.spring.generator.Type toMappingType(Type type, String nestedType) {
- if (type.isArray()) {
- return org.apache.xbean.spring.generator.Type.newArrayType(type.getValue(), type.getDimensions());
- } else if (type.isA(listType)) {
- if (nestedType == null) nestedType = "java.lang.Object";
- return org.apache.xbean.spring.generator.Type.newCollectionType(type.getValue(),
- org.apache.xbean.spring.generator.Type.newSimpleType(nestedType));
- } else {
- return org.apache.xbean.spring.generator.Type.newSimpleType(type.getValue());
- }
- }
-
- private static String toMethodLocator(JavaMethod method) {
- StringBuffer buf = new StringBuffer();
- buf.append(method.getParentClass().getFullyQualifiedName());
- if (!method.isConstructor()) {
- buf.append(".").append(method.getName());
- }
- buf.append("(");
- JavaParameter[] parameters = method.getParameters();
- for (int i = 0; i < parameters.length; i++) {
- JavaParameter parameter = parameters[i];
- if (i > 0) {
- buf.append(", ");
- }
- buf.append(parameter.getName());
- }
- buf.append(") : ").append(method.getLineNumber());
- return buf.toString();
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/SchemaGenerator.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/SchemaGenerator.java
deleted file mode 100644
index 15cd97d..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/SchemaGenerator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.generator;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * @version $Revision$
- */
-public class SchemaGenerator {
- private final MappingLoader mappingLoader;
- private final GeneratorPlugin[] plugins;
- private final LogFacade log;
-
- public SchemaGenerator(LogFacade log, MappingLoader mappingLoader, GeneratorPlugin[] plugins) {
- this.log = log;
- this.mappingLoader = mappingLoader;
- this.plugins = plugins;
- }
-
- public void generate() throws IOException {
- Set namespaces = mappingLoader.loadNamespaces();
- if (namespaces.isEmpty()) {
- log.log("Warning: no namespaces found!");
- }
-
- for (Iterator iterator = namespaces.iterator(); iterator.hasNext();) {
- NamespaceMapping namespaceMapping = (NamespaceMapping) iterator.next();
- for (int i = 0; i < plugins.length; i++) {
- GeneratorPlugin plugin = plugins[i];
- plugin.generate(namespaceMapping);
- }
- }
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/Type.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/Type.java
deleted file mode 100644
index 0ef1c35..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/Type.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class Type {
- private final String name;
- private final Type nestedType;
- private final boolean primitive;
-
- public static Type newSimpleType(String name) {
- if (name == null) throw new NullPointerException("type");
- if (name.indexOf("[") >= 0 || name.indexOf("]") >= 0) {
- throw new IllegalArgumentException("Name can not contain '[' or ']' " + name);
- }
- return new Type(name, null);
- }
-
- public static Type newArrayType(String type, int dimensions) {
- if (type == null) throw new NullPointerException("type");
- if (dimensions < 1) throw new IllegalArgumentException("dimensions must be atleast one");
- StringBuffer buf = new StringBuffer(type.length() + (dimensions * 2));
- buf.append(type);
- for (int i = 0; i < dimensions; i ++) {
- buf.append("[]");
- }
- return new Type(buf.toString(), newSimpleType(type));
- }
-
- public static Type newCollectionType(String collectionType, Type elementType) {
- if (collectionType == null) throw new NullPointerException("collectionType");
- if (elementType == null) throw new NullPointerException("elementType");
- return new Type(collectionType, elementType);
- }
-
- private Type(String name, Type nestedType) {
- this.name = name;
- this.nestedType = nestedType;
- primitive = (nestedType == null) && primitives.contains(name);
- }
-
- public String getName() {
- return name;
- }
-
- public Type getNestedType() {
- return nestedType;
- }
-
- public boolean isCollection() {
- return nestedType != null;
- }
-
- public boolean isPrimitive() {
- return primitive;
- }
-
- public int hashCode() {
- return super.hashCode();
- }
-
- public boolean equals(Object obj) {
- return super.equals(obj);
- }
-
- private static final Set primitives;
-
- static {
- Set set = new HashSet();
- set.add("boolean");
- set.add("byte");
- set.add("char");
- set.add("short");
- set.add("int");
- set.add("long");
- set.add("float");
- set.add("double");
- primitives = Collections.unmodifiableSet(set);
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/Utils.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/Utils.java
deleted file mode 100644
index eb1d4f2..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/Utils.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.beans.PropertyEditor;
-import java.beans.PropertyEditorManager;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public final class Utils {
- public static final String XBEAN_ANNOTATION = "org.apache.xbean.XBean";
- public static final String PROPERTY_ANNOTATION = "org.apache.xbean.Property";
-
- private Utils() {
- }
-
- public static String decapitalise(String value) {
- if (value == null || value.length() == 0) {
- return value;
- }
- return value.substring(0, 1).toLowerCase() + value.substring(1);
- }
-
- public static boolean isSimpleType(Type type) {
- if (type.isPrimitive()) {
- return true;
- }
- if (type.isCollection()) {
- return false;
- }
-
- String name = type.getName();
- if (name.equals("java.lang.Class") ||
- name.equals("javax.xml.namespace.QName")) {
- return true;
- }
- return hasPropertyEditor(name);
- }
-
- private static boolean hasPropertyEditor(String type) {
- Class theClass;
- try {
- theClass = loadClass(type);
- } catch (ClassNotFoundException e) {
- System.out.println("Warning, could not load class: " + type);
- return false;
- }
- // lets see if we can find a property editor for this type
- PropertyEditor editor = PropertyEditorManager.findEditor(theClass);
- return editor != null;
- }
-
- /**
- * Attempts to load the class on the current thread context class loader or
- * the class loader which loaded us
- */
- private static Class loadClass(String name) throws ClassNotFoundException {
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- if (contextClassLoader != null) {
- try {
- return contextClassLoader.loadClass(name);
- } catch (ClassNotFoundException e) {
- }
- }
- return Utils.class.getClassLoader().loadClass(name);
- }
-
- public static String getXsdType(Type type) {
- String name = type.getName();
- String xsdType = (String) XSD_TYPES.get(name);
- if (xsdType == null) {
- xsdType = "xsd:string";
- }
- return xsdType;
- }
-
- public static final Map XSD_TYPES;
-
- static {
- // TODO check these XSD types are right...
- Map map = new HashMap();
- map.put(String.class.getName(), "xs:string");
- map.put(Boolean.class.getName(), "xs:boolean");
- map.put(boolean.class.getName(), "xs:boolean");
- map.put(Byte.class.getName(), "xs:byte");
- map.put(byte.class.getName(), "xs:byte");
- map.put(Short.class.getName(), "xs:short");
- map.put(short.class.getName(), "xs:short");
- map.put(Integer.class.getName(), "xs:integer");
- map.put(int.class.getName(), "xs:integer");
- map.put(Long.class.getName(), "xs:long");
- map.put(long.class.getName(), "xs:long");
- map.put(Float.class.getName(), "xs:float");
- map.put(float.class.getName(), "xs:float");
- map.put(Double.class.getName(), "xs:double");
- map.put(double.class.getName(), "xs:double");
- map.put(java.util.Date.class.getName(), "xs:date");
- map.put(java.sql.Date.class.getName(), "xs:date");
- map.put("javax.xml.namespace.QName", "xs:QName");
- XSD_TYPES = Collections.unmodifiableMap(map);
- }
-
- public static List findImplementationsOf(NamespaceMapping namespaceMapping, Type type) {
- List elements = new ArrayList();
- String nestedTypeName = type.getName();
- for (Iterator iter = namespaceMapping.getElements().iterator(); iter.hasNext();) {
- ElementMapping element = (ElementMapping) iter.next();
- if (nestedTypeName.equals(element.getClassName())) {
- elements.add(element);
- }
- }
- return elements;
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java
deleted file mode 100644
index f4871d9..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.xbean.spring.context.impl.NamespaceHelper;
-
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class XmlMetadataGenerator implements GeneratorPlugin {
- private final String metaInfDir;
- private final LogFacade log;
-
- public static final String NAMESPACE_HANDLER = "org.apache.xbean.spring.context.v2.XBeanNamespaceHandler";
-
- public XmlMetadataGenerator(LogFacade log, String metaInfDir) {
- this.metaInfDir = metaInfDir;
- this.log = log;
- }
-
- public void generate(NamespaceMapping namespaceMapping) throws IOException {
- String namespace = namespaceMapping.getNamespace();
- if (namespace == null) {
- return;
- }
-
- File file = new File(metaInfDir, NamespaceHelper.createDiscoveryPathName(namespace));
- file.getParentFile().mkdirs();
- log.log("Generating META-INF properties file: " + file + " for namespace: " + namespace);
- PrintWriter out = new PrintWriter(new FileWriter(file));
- try {
- generatePropertiesFile(out, namespaceMapping.getElements());
- } finally {
- out.close();
- }
-
- // Generate spring 2.0 mapping
- file = new File(metaInfDir, "META-INF/spring.handlers");
- log.log("Generating Spring 2.0 handler mapping: " + file + " for namespace: " + namespace);
- out = new PrintWriter(new FileWriter(file));
- try {
- out.println(namespace.replace(":", "\\:") + "=" + NAMESPACE_HANDLER);
- } finally {
- out.close();
- }
- }
-
- private void generatePropertiesFile(PrintWriter out, Set elements) {
- out.println("# NOTE: this file is autogenerated by XBeans");
- out.println();
- out.println("# beans");
-
- for (Iterator iter = elements.iterator(); iter.hasNext();) {
- ElementMapping element = (ElementMapping) iter.next();
- out.println(element.getElementName() + " = " + element.getClassName());
-
- generatePropertiesFileContent(out, element);
- generatePropertiesFilePropertyAliases(out, element);
- generatePropertiesFileConstructors(out, element);
- out.println();
- }
- }
-
- private void generatePropertiesFileContent(PrintWriter out, ElementMapping element) {
- String contentProperty = element.getContentProperty();
- if (contentProperty != null) {
- out.println(element.getElementName() + ".contentProperty = " + contentProperty);
- }
- String initMethod = element.getInitMethod();
- if (initMethod != null) {
- out.println(element.getElementName() + ".initMethod = " + initMethod);
- }
-
- String destroyMethod = element.getDestroyMethod();
- if (destroyMethod != null) {
- out.println(element.getElementName() + ".destroyMethod = " + destroyMethod);
- }
-
- String factoryMethod = element.getFactoryMethod();
- if (factoryMethod != null) {
- out.println(element.getElementName() + ".factoryMethod = " + factoryMethod);
- }
-
- List flatProperties = element.getFlatProperties();
- for (Iterator itr = flatProperties.iterator(); itr.hasNext();) {
- out.println(element.getElementName() + "." + itr.next() + ".flat");
- }
-
- Map maps = element.getMapMappings();
- for (Iterator itr = maps.entrySet().iterator(); itr.hasNext();) {
- Map.Entry entry = (Map.Entry) itr.next();
- MapMapping mm = (MapMapping) entry.getValue();
- out.println(element.getElementName() + "." + entry.getKey() + ".map.entryName = " + mm.getEntryName());
- out.println(element.getElementName() + "." + entry.getKey() + ".map.keyName = " + mm.getKeyName());
- }
-
- Map flatCollections = element.getFlatCollections();
- for (Iterator itr = flatCollections.entrySet().iterator(); itr.hasNext();) {
- Map.Entry entry = (Map.Entry) itr.next();
- String child = (String) entry.getValue();
- out.println(element.getElementName() + "." + child + ".flatCollection = " + entry.getKey());
- }
- }
-
- private void generatePropertiesFileConstructors(PrintWriter out, ElementMapping element) {
- List constructors = element.getConstructors();
- for (Iterator iterator = constructors.iterator(); iterator.hasNext();) {
- List args = (List) iterator.next();
- generatePropertiesFileConstructor(out, element, args);
-
- }
- }
-
- private void generatePropertiesFileConstructor(PrintWriter out, ElementMapping element, List args) {
- out.print(element.getClassName());
- if (element.getFactoryMethod() != null) {
- out.print("." + element.getFactoryMethod());
- }
- out.print("(");
- for (Iterator iterator = args.iterator(); iterator.hasNext();) {
- AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
- out.print(attributeMapping.getType().getName());
- if (iterator.hasNext()) {
- out.print(",");
- }
- }
- out.print(").parameterNames =");
- for (Iterator iterator = args.iterator(); iterator.hasNext();) {
- AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
- out.print(" ");
- out.print(attributeMapping.getPropertyName());
- }
- out.println();
- }
-
- private void generatePropertiesFilePropertyAliases(PrintWriter out, ElementMapping element) {
- for (Iterator iterator = element.getAttributes().iterator(); iterator.hasNext();) {
- AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
- String propertyName = attributeMapping.getPropertyName();
- String attributeName = attributeMapping.getAttributeName();
- if (!propertyName.equals(attributeName)) {
- if (List.class.getName().equals(attributeMapping.getType().getName())) {
- out.println(element.getElementName() + ".list." + attributeName + " = " + propertyName);
- } else {
- out.println(element.getElementName() + ".alias." + attributeName + " = " + propertyName);
- }
- }
- }
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XmlWriter.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XmlWriter.java
deleted file mode 100644
index ef9d852..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XmlWriter.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.LinkedList;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class XmlWriter {
- private PrintWriter writer;
-
- private LinkedList elementStack = new LinkedList();
-
- private boolean tagInProgress;
-
- private int depth;
-
- private String lineIndenter;
-
- private String encoding;
-
- private String docType;
-
- private boolean readyForNewLine;
-
- private boolean tagIsEmpty;
-
- public XmlWriter(PrintWriter writer, String lineIndenter) {
- this(writer, lineIndenter, null, null);
- }
-
- public XmlWriter(Writer writer, String lineIndenter) {
- this(new PrintWriter(writer), lineIndenter);
- }
-
- public XmlWriter(PrintWriter writer) {
- this(writer, null, null);
- }
-
- public XmlWriter(Writer writer) {
- this(new PrintWriter(writer));
- }
-
- public XmlWriter(PrintWriter writer, String lineIndenter, String encoding, String doctype) {
- this.writer = writer;
-
- this.lineIndenter = lineIndenter;
-
- this.encoding = encoding;
-
- this.docType = doctype;
-
- if (docType != null || encoding != null) {
- writeDocumentHeaders();
- }
- }
-
- public XmlWriter(Writer writer, String lineIndenter, String encoding, String doctype) {
- this(new PrintWriter(writer), lineIndenter, encoding, doctype);
- }
-
- public XmlWriter(PrintWriter writer, String encoding, String doctype) {
- this(writer, " ", encoding, doctype);
- }
-
- public XmlWriter(Writer writer, String encoding, String doctype) {
- this(new PrintWriter(writer), encoding, doctype);
- }
-
- public void startElement(String name) {
- tagIsEmpty = false;
-
- finishTag();
-
- write("<");
-
- write(name);
-
- elementStack.addLast(name);
-
- tagInProgress = true;
-
- depth++;
-
- readyForNewLine = true;
-
- tagIsEmpty = true;
- }
-
- public void writeText(String text) {
- writeText(text, true);
- }
-
- public void writeMarkup(String text) {
- writeText(text, false);
- }
-
- private void writeText(String text, boolean escapeHtml) {
- readyForNewLine = false;
-
- tagIsEmpty = false;
-
- finishTag();
-
- if (escapeHtml) {
- text = text.replaceAll("&", "&");
-
- text = text.replaceAll("<", "<");
-
- text = text.replaceAll(">", ">");
- }
-
- write(text);
- }
-
- public void addAttribute(String key, String value) {
- write(" ");
-
- write(key);
-
- write("=\"");
-
- write(value);
-
- write("\"");
- }
-
- public void endElement() {
- depth--;
-
- if (tagIsEmpty) {
- write("/");
-
- readyForNewLine = false;
-
- finishTag();
-
- elementStack.removeLast();
- } else {
- finishTag();
-
- write("</" + elementStack.removeLast() + ">");
- }
-
- readyForNewLine = true;
- }
-
- private void write(String str) {
- writer.write(str);
- }
-
- private void finishTag() {
- if (tagInProgress) {
- write(">");
- }
-
- tagInProgress = false;
-
- if (readyForNewLine) {
- endOfLine();
- }
- readyForNewLine = false;
-
- tagIsEmpty = false;
- }
-
- protected void endOfLine() {
- write("\n");
-
- for (int i = 0; i < depth; i++) {
- write(lineIndenter);
- }
- }
-
- private void writeDocumentHeaders() {
- write("<?xml version=\"1.0\"");
-
- if (encoding != null) {
- write(" encoding=\"" + encoding + "\"");
- }
-
- write("?>");
-
- endOfLine();
-
- if (docType != null) {
- write("<!DOCTYPE ");
-
- write(docType);
-
- write(">");
-
- endOfLine();
- }
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XsdGenerator.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XsdGenerator.java
deleted file mode 100644
index 73b9e85..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XsdGenerator.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Collections;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class XsdGenerator implements GeneratorPlugin {
- private final File destFile;
- private final LogFacade log;
-
- public XsdGenerator(LogFacade log, File destFile) {
- this.destFile = destFile;
- this.log = log;
- }
-
- public void generate(NamespaceMapping namespaceMapping) throws IOException {
- // TODO can only handle 1 schema document so far...
- File file = destFile;
- log.log("Generating XSD file: " + file + " for namespace: " + namespaceMapping.getNamespace());
- PrintWriter out = new PrintWriter(new FileWriter(file));
- try {
- generateSchema(out, namespaceMapping);
- } finally {
- out.close();
- }
- }
-
- private void generateSchema(PrintWriter out, NamespaceMapping namespaceMapping) {
- out.println("<?xml version='1.0'?>");
- out.println("<!-- NOTE: this file is autogenerated by XBeans -->");
- out.println();
- out.println("<xs:schema elementFormDefault='qualified'");
- out.println(" targetNamespace='" + namespaceMapping.getNamespace() + "'");
- out.println(" xmlns:xs='http://www.w3.org/2001/XMLSchema'");
- out.println(" xmlns:tns='" + namespaceMapping.getNamespace() + "'>");
-
- for (Iterator iter = namespaceMapping.getElements().iterator(); iter.hasNext();) {
- ElementMapping element = (ElementMapping) iter.next();
- generateElementMapping(out, namespaceMapping, element);
- }
-
- out.println();
- out.println("</xs:schema>");
- }
-
- private void generateElementMapping(PrintWriter out, NamespaceMapping namespaceMapping, ElementMapping element) {
- out.println();
- out.println(" <!-- element for type: " + element.getClassName() + " -->");
-
- String localName = element.getElementName();
-
- out.println(" <xs:element name='" + localName + "'>");
- out.println(" <xs:complexType>");
-
- int complexCount = 0;
- for (Iterator iterator = element.getAttributes().iterator(); iterator.hasNext();) {
- AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
- if (!Utils.isSimpleType(attributeMapping.getType())) {
- complexCount++;
- }
- }
- if (complexCount > 0) {
- out.println(" <xs:sequence>");
- for (Iterator iterator = element.getAttributes().iterator(); iterator.hasNext();) {
- AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
- if (!Utils.isSimpleType(attributeMapping.getType())) {
- generateElementMappingComplexProperty(out, namespaceMapping, attributeMapping);
- }
- }
- out.println(" </xs:sequence>");
- }
-
- for (Iterator iterator = element.getAttributes().iterator(); iterator.hasNext();) {
- AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
- if (Utils.isSimpleType(attributeMapping.getType())) {
- generateElementMappingSimpleProperty(out, attributeMapping);
- } else if (!attributeMapping.getType().isCollection()) {
- generateElementMappingComplexPropertyAsRef(out, attributeMapping);
- }
- }
- out.println(" <xs:anyAttribute namespace='##other' processContents='lax'/>");
- out.println(" </xs:complexType>");
- out.println(" </xs:element>");
- out.println();
- }
-
- private void generateElementMappingSimpleProperty(PrintWriter out, AttributeMapping attributeMapping) {
- out.println(" <xs:attribute name='" + attributeMapping.getAttributeName() + "' type='" + Utils.getXsdType(attributeMapping.getType()) + "'/>");
- }
-
- private void generateElementMappingComplexPropertyAsRef(PrintWriter out, AttributeMapping attributeMapping) {
- out.println(" <xs:attribute name='" + attributeMapping.getAttributeName() + "' type='xs:string'/>");
- }
-
- private void generateElementMappingComplexProperty(PrintWriter out, NamespaceMapping namespaceMapping, AttributeMapping attributeMapping) {
- Type type = attributeMapping.getType();
- List types;
- if (type.isCollection()) {
- types = Utils.findImplementationsOf(namespaceMapping, type.getNestedType());
- } else {
- types = Utils.findImplementationsOf(namespaceMapping, type);
- }
- types = Collections.EMPTY_LIST;
- String maxOccurs = type.isCollection() ? "unbounded" : "1";
-
- out.println(" <xs:element name='" + attributeMapping.getAttributeName() + "' minOccurs='0' maxOccurs='1'>");
- out.println(" <xs:complexType>");
- if (types.isEmpty()) {
- out.println(" <xs:sequence minOccurs='0' maxOccurs='" + maxOccurs + "'><xs:any/></xs:sequence>");
- } else {
- out.println(" <xs:choice minOccurs='0' maxOccurs='" + maxOccurs + "'>");
- for (Iterator iterator = types.iterator(); iterator.hasNext();) {
- ElementMapping element = (ElementMapping) iterator.next();
- out.println(" <xs:element ref='tns:" + element.getElementName() + "'/>");
- }
- out.println(" </xs:choice>");
- }
- out.println(" </xs:complexType>");
- out.println(" </xs:element>");
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/jndi/DefaultContext.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/jndi/DefaultContext.java
deleted file mode 100644
index c55cc6b..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/jndi/DefaultContext.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/**
- *
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.jndi;
-
-import javax.naming.Binding;
-import javax.naming.CompositeName;
-import javax.naming.Context;
-import javax.naming.LinkRef;
-import javax.naming.Name;
-import javax.naming.NameClassPair;
-import javax.naming.NameNotFoundException;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.NotContextException;
-import javax.naming.OperationNotSupportedException;
-import javax.naming.Reference;
-import javax.naming.spi.NamingManager;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * A simple spring based JNDI context which is mutable
- *
- * @version $Revision: 657 $
- */
-public class DefaultContext implements Context, Serializable {
-
- private static final long serialVersionUID = -5754338187296859149L;
- protected static final NameParser nameParser = new NameParserImpl();
-
- private boolean freeze = false;
-
- protected final Hashtable environment; // environment for this context
- protected final Map bindings; // bindings at my level
- protected final Map treeBindings; // all bindings under me
-
- private boolean frozen = false;
- private String nameInNamespace = "";
- public static final String SEPARATOR = "/";
-
- public DefaultContext() {
- environment = new Hashtable();
- bindings = new HashMap();
- treeBindings = new HashMap();
- }
-
- public DefaultContext(Hashtable env) {
- if (env == null) {
- this.environment = new Hashtable();
- }
- else {
- this.environment = new Hashtable(env);
- }
- this.bindings = new HashMap();
- this.treeBindings = new HashMap();
- }
-
- public DefaultContext(Hashtable environment, Map bindings) {
- if (environment == null) {
- this.environment = new Hashtable();
- }
- else {
- this.environment = new Hashtable(environment);
- }
- this.bindings = bindings;
- treeBindings = new HashMap();
- frozen = true;
- }
-
- public DefaultContext(Hashtable environment, Map bindings, String nameInNamespace) {
- this(environment, bindings);
- this.nameInNamespace = nameInNamespace;
- }
-
- protected DefaultContext(DefaultContext clone, Hashtable env) {
- this.bindings = clone.bindings;
- this.treeBindings = clone.treeBindings;
- this.environment = new Hashtable(env);
- }
-
- protected DefaultContext(DefaultContext clone, Hashtable env, String nameInNamespace) {
- this(clone, env);
- this.nameInNamespace = nameInNamespace;
- }
-
- public Object addToEnvironment(String propName, Object propVal) throws NamingException {
- return environment.put(propName, propVal);
- }
-
- public Hashtable getEnvironment() throws NamingException {
- return (Hashtable) environment.clone();
- }
-
- public Object removeFromEnvironment(String propName) throws NamingException {
- return environment.remove(propName);
- }
-
- public Object lookup(String name) throws NamingException {
- if (name.length() == 0) {
- return this;
- }
- Object result = treeBindings.get(name);
- if (result == null) {
- result = bindings.get(name);
- }
- if (result == null) {
- int pos = name.indexOf(':');
- if (pos > 0) {
- String scheme = name.substring(0, pos);
- Context ctx = NamingManager.getURLContext(scheme, environment);
- if (ctx == null) {
- throw new NamingException("scheme " + scheme + " not recognized");
- }
- return ctx.lookup(name);
- }
- else {
- // Split out the first name of the path
- // and look for it in the bindings map.
- CompositeName path = new CompositeName(name);
-
- if (path.size() == 0) {
- return this;
- }
- else {
- String first = path.get(0);
- Object obj = bindings.get(first);
- if (obj == null) {
- throw new NameNotFoundException(name);
- }
- else if (obj instanceof Context && path.size() > 1) {
- Context subContext = (Context) obj;
- obj = subContext.lookup(path.getSuffix(1));
- }
- return obj;
- }
- }
- }
- if (result instanceof LinkRef) {
- LinkRef ref = (LinkRef) result;
- result = lookup(ref.getLinkName());
- }
- if (result instanceof Reference) {
- try {
- result = NamingManager.getObjectInstance(result, null, null, this.environment);
- }
- catch (NamingException e) {
- throw e;
- }
- catch (Exception e) {
- throw (NamingException) new NamingException("could not look up : " + name).initCause(e);
- }
- }
- if (result instanceof DefaultContext) {
- String prefix = getNameInNamespace();
- if (prefix.length() > 0) {
- prefix = prefix + SEPARATOR;
- }
- result = new DefaultContext((DefaultContext) result, environment, prefix + name);
- }
- return result;
- }
-
- public Object lookup(Name name) throws NamingException {
- return lookup(name.toString());
- }
-
- public Object lookupLink(String name) throws NamingException {
- return lookup(name);
- }
-
- public Name composeName(Name name, Name prefix) throws NamingException {
- Name result = (Name) prefix.clone();
- result.addAll(name);
- return result;
- }
-
- public String composeName(String name, String prefix) throws NamingException {
- CompositeName result = new CompositeName(prefix);
- result.addAll(new CompositeName(name));
- return result.toString();
- }
-
- public NamingEnumeration list(String name) throws NamingException {
- Object o = lookup(name);
- if (o == this) {
- return new DefaultContext.ListEnumeration();
- }
- else if (o instanceof Context) {
- return ((Context) o).list("");
- }
- else {
- throw new NotContextException();
- }
- }
-
- public NamingEnumeration listBindings(String name) throws NamingException {
- Object o = lookup(name);
- if (o == this) {
- return new DefaultContext.ListBindingEnumeration();
- }
- else if (o instanceof Context) {
- return ((Context) o).listBindings("");
- }
- else {
- throw new NotContextException();
- }
- }
-
- public Object lookupLink(Name name) throws NamingException {
- return lookupLink(name.toString());
- }
-
- public NamingEnumeration list(Name name) throws NamingException {
- return list(name.toString());
- }
-
- public NamingEnumeration listBindings(Name name) throws NamingException {
- return listBindings(name.toString());
- }
-
- public void bind(Name name, Object value) throws NamingException {
- bind(name.toString(), value);
- }
-
- public void bind(String name, Object value) throws NamingException {
- checkFrozen();
- internalBind(name, value);
- }
-
- public void close() throws NamingException {
- // ignore
- }
-
- public Context createSubcontext(Name name) throws NamingException {
- throw new OperationNotSupportedException();
- }
-
- public Context createSubcontext(String name) throws NamingException {
- throw new OperationNotSupportedException();
- }
-
- public void destroySubcontext(Name name) throws NamingException {
- throw new OperationNotSupportedException();
- }
-
- public void destroySubcontext(String name) throws NamingException {
- throw new OperationNotSupportedException();
- }
-
- public String getNameInNamespace() throws NamingException {
- return nameInNamespace;
- }
-
- public NameParser getNameParser(Name name) throws NamingException {
- return nameParser;
- }
-
- public NameParser getNameParser(String name) throws NamingException {
- return nameParser;
- }
-
- public void rebind(Name name, Object value) throws NamingException {
- rebind(name.toString(), value);
- }
-
- public void rebind(String name, Object value) throws NamingException {
- checkFrozen();
- internalBind(name, value, true);
- }
-
- public void rename(Name oldName, Name newName) throws NamingException {
- checkFrozen();
- Object value = lookup(oldName);
- unbind(oldName);
- bind(newName, value);
- }
-
- public void rename(String oldName, String newName) throws NamingException {
- Object value = lookup(oldName);
- unbind(oldName);
- bind(newName, value);
- }
-
- public void unbind(Name name) throws NamingException {
- unbind(name.toString());
- }
-
- public void unbind(String name) throws NamingException {
- checkFrozen();
- internalBind(name, null, true);
- }
-
- private abstract class LocalNamingEnumeration implements NamingEnumeration {
- private Iterator i = bindings.entrySet().iterator();
-
- public boolean hasMore() throws NamingException {
- return i.hasNext();
- }
-
- public boolean hasMoreElements() {
- return i.hasNext();
- }
-
- protected Map.Entry getNext() {
- return (Map.Entry) i.next();
- }
-
- public void close() throws NamingException {
- }
- }
-
- private class ListEnumeration extends DefaultContext.LocalNamingEnumeration {
- public Object next() throws NamingException {
- return nextElement();
- }
-
- public Object nextElement() {
- Map.Entry entry = getNext();
- return new NameClassPair((String) entry.getKey(), entry.getValue().getClass().getName());
- }
- }
-
- private class ListBindingEnumeration extends DefaultContext.LocalNamingEnumeration {
- public Object next() throws NamingException {
- return nextElement();
- }
-
- public Object nextElement() {
- Map.Entry entry = getNext();
- return new Binding((String) entry.getKey(), entry.getValue());
- }
- }
-
- public Map getEntries() {
- return new HashMap(bindings);
- }
-
- public void setEntries(Map entries) throws NamingException {
- if (entries != null) {
- for (Iterator iter = entries.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- String name = (String) entry.getKey();
- Object value = entry.getValue();
- internalBind(name, value);
- }
- }
- }
-
- public boolean isFreeze() {
- return freeze;
- }
-
- public void setFreeze(boolean freeze) {
- this.freeze = freeze;
- }
-
- /**
- * internalBind is intended for use only during setup or possibly by suitably synchronized superclasses.
- * It binds every possible lookup into a map in each context. To do this, each context
- * strips off one name segment and if necessary creates a new context for it. Then it asks that context
- * to bind the remaining name. It returns a map containing all the bindings from the next context, plus
- * the context it just created (if it in fact created it). (the names are suitably extended by the segment
- * originally lopped off).
- *
- * @param name
- * @param value
- * @return
- * @throws javax.naming.NamingException
- */
- protected Map internalBind(String name, Object value) throws NamingException {
- return internalBind(name, value, false);
-
- }
- protected Map internalBind(String name, Object value, boolean allowRebind) throws NamingException {
-
- if (name == null || name.length() == 0){
- throw new NamingException("Invalid Name " + name);
- }
- if (frozen){
- throw new NamingException("Read only");
- }
-
- Map newBindings = new HashMap();
- int pos = name.indexOf('/');
- if (pos == -1) {
- Object oldValue = treeBindings.put(name, value);
- if (!allowRebind && oldValue != null) {
- throw new NamingException("Something already bound at " + name);
- }
- bindings.put(name, value);
- newBindings.put(name, value);
- }
- else {
- String segment = name.substring(0, pos);
-
- if (segment == null || segment.length()==0){
- throw new NamingException("Invalid segment " + segment);
- }
- Object o = treeBindings.get(segment);
- if (o == null) {
- o = newContext();
- treeBindings.put(segment, o);
- bindings.put(segment, o);
- newBindings.put(segment, o);
- }
- else if (!(o instanceof DefaultContext)) {
- throw new NamingException("Something already bound where a subcontext should go");
- }
- DefaultContext defaultContext = (DefaultContext) o;
- String remainder = name.substring(pos + 1);
- Map subBindings = defaultContext.internalBind(remainder, value, allowRebind);
- for (Iterator iterator = subBindings.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String subName = segment + "/" + (String) entry.getKey();
- Object bound = entry.getValue();
- treeBindings.put(subName, bound);
- newBindings.put(subName, bound);
- }
- }
- return newBindings;
- }
-
- protected void checkFrozen() throws OperationNotSupportedException {
- if (isFreeze()) {
- throw new OperationNotSupportedException("JNDI context is frozen!");
- }
- }
-
- protected DefaultContext newContext() {
- return new DefaultContext();
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/jndi/NameParserImpl.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/jndi/NameParserImpl.java
deleted file mode 100644
index 192603f..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/jndi/NameParserImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-
-package org.apache.xbean.spring.jndi;
-
-import javax.naming.CompositeName;
-import javax.naming.Name;
-import javax.naming.NameParser;
-import javax.naming.NamingException;
-
-/**
- * A default implementation of {@link NameParser}
- *
- * @version $Revision: 1.2 $
- */
-public class NameParserImpl implements NameParser {
-
- public Name parse(String name) throws NamingException {
- return new CompositeName(name);
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/jndi/SpringInitialContextFactory.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/jndi/SpringInitialContextFactory.java
deleted file mode 100644
index efb5b27..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/jndi/SpringInitialContextFactory.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.jndi;
-
-import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.ResourceEditor;
-import org.apache.xbean.spring.context.impl.XBeanXmlBeanFactory;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.spi.InitialContextFactory;
-
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-/**
- * A simple JNDI initial context which loads the JNDI namespace from a spring.xml configuration file.
- * The spring.xml configuration file can be specified by the {@link Context#PROVIDER_URL} property
- * which can be any spring resource string (classpath://foo.xml, or file://foo/bar.xml or a URL)
- * otherwise the jndi.xml file is found on the classpath.
- *
- * @version $Revision: 657 $
- */
-public class SpringInitialContextFactory implements InitialContextFactory {
- private static final transient Log log = LogFactory.getLog(SpringInitialContextFactory.class);
-
- private static Map cache = new HashMap();
-
- private static Context singleton;
-
- /**
- * A factory method which can be used to initialise a singleton JNDI context from inside a Spring.xml
- * such that future calls to new InitialContext() will reuse it
- */
- public static Context makeInitialContext() {
- singleton = new DefaultContext();
- return singleton;
- }
-
- public Context getInitialContext(Hashtable environment) throws NamingException {
- if (singleton != null) {
- return singleton;
- }
- Resource resource = null;
- Object value = environment.get(Context.PROVIDER_URL);
- String key = "jndi.xml";
- if (value == null) {
- resource = new ClassPathResource(key);
- }
- else {
- if (value instanceof Resource) {
- resource = (Resource) value;
- }
- else {
- ResourceEditor editor = new ResourceEditor();
- key = value.toString();
- editor.setAsText(key);
- resource = (Resource) editor.getValue();
- }
- }
- BeanFactory context = loadContext(resource, key);
- Context answer = (Context) context.getBean("jndi");
- if (answer == null) {
- log.warn("No JNDI context available in JNDI resource: " + resource);
- answer = new DefaultContext(environment, new ConcurrentHashMap());
- }
- return answer;
- }
-
- protected BeanFactory loadContext(Resource resource, String key) {
- synchronized (cache) {
- BeanFactory answer = (BeanFactory) cache.get(key);
- if (answer == null) {
- answer = createContext(resource);
- cache.put(key, answer);
- }
- return answer;
- }
- }
-
- protected BeanFactory createContext(Resource resource) {
- log.info("Loading JNDI context from: " + resource);
- return new XBeanXmlBeanFactory(resource);
- }
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/util/AbstractSpringVisitor.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/util/AbstractSpringVisitor.java
deleted file mode 100644
index c0222e8..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/util/AbstractSpringVisitor.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.util;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.PropertyValue;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.config.ConstructorArgumentValues;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Default do nothing implementation of SpringVisitor.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public abstract class AbstractSpringVisitor implements SpringVisitor {
- public void visitBeanFactory(ConfigurableListableBeanFactory beanRegistry, Object data) throws BeansException {
- String[] beanNames = beanRegistry.getBeanDefinitionNames();
- for (int i = 0; i < beanNames.length; i++) {
- String beanName = beanNames[i];
- visitBeanDefinition(beanName, beanRegistry.getBeanDefinition(beanName), data);
- }
- }
-
- public void visitBeanDefinitionHolder(BeanDefinitionHolder beanDefinitionHolder, Object data) throws BeansException {
- visitBeanDefinition(beanDefinitionHolder.getBeanName(), beanDefinitionHolder.getBeanDefinition(), data);
- }
-
- public void visitBeanDefinition(String beanName, BeanDefinition beanDefinition, Object data) throws BeansException {
- visitBeanDefinition(beanDefinition, data);
- }
-
- public void visitBeanDefinition(BeanDefinition beanDefinition, Object data) throws BeansException {
- visitConstructorArgumentValues(beanDefinition.getConstructorArgumentValues(), data);
- visitMutablePropertyValues(beanDefinition.getPropertyValues(), data);
- }
-
- public void visitMutablePropertyValues(MutablePropertyValues propertyValues, Object data) throws BeansException {
- PropertyValue[] values = propertyValues.getPropertyValues();
- for (int i = 0; i < values.length; i++) {
- visitPropertyValue(values[i], data);
- }
- }
-
- public void visitConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues, Object data) throws BeansException {
- Map indexedArgumentValues = constructorArgumentValues.getIndexedArgumentValues();
- for (Iterator iterator = indexedArgumentValues.values().iterator(); iterator.hasNext();) {
- visitConstructorArgumentValue((ConstructorArgumentValues.ValueHolder) iterator.next(), data);
- }
- List genericArgumentValues = constructorArgumentValues.getGenericArgumentValues();
- for (Iterator iterator = genericArgumentValues.iterator(); iterator.hasNext();) {
- visitConstructorArgumentValue((ConstructorArgumentValues.ValueHolder) iterator.next(), data);
- }
- }
-
- public void visitConstructorArgumentValue(ConstructorArgumentValues.ValueHolder valueHolder, Object data) throws BeansException {
- visitNext(valueHolder.getValue(), data);
- }
-
- public void visitPropertyValue(PropertyValue propertyValue, Object data) throws BeansException {
- visitNext(propertyValue.getValue(), data);
- }
-
- public void visitRuntimeBeanReference(RuntimeBeanReference beanReference, Object data) throws BeansException {
- }
-
- public void visitCollection(Collection collection, Object data) throws BeansException {
- for (Iterator iterator = collection.iterator(); iterator.hasNext();) {
- visitNext(iterator.next(), data);
- }
- }
-
- public void visitMap(Map map, Object data) throws BeansException {
- for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- visitNext(entry.getKey(), data);
- visitNext(entry.getValue(), data);
- }
- }
-
- public void visitObject(Object value, Object data) throws BeansException {
- }
-
- protected void visitNext(Object value, Object data) throws BeansException {
- if (value == null) {
- return;
- }
-
- if (value instanceof ConfigurableListableBeanFactory) {
- visitBeanFactory((ConfigurableListableBeanFactory) value, data);
- } else if (value instanceof BeanDefinitionHolder) {
- visitBeanDefinitionHolder((BeanDefinitionHolder) value, data);
- } else if (value instanceof BeanDefinition) {
- visitBeanDefinition((BeanDefinition) value, data);
- } else if (value instanceof ConstructorArgumentValues) {
- visitConstructorArgumentValues((ConstructorArgumentValues) value, data);
- } else if (value instanceof ConstructorArgumentValues.ValueHolder) {
- visitConstructorArgumentValue((ConstructorArgumentValues.ValueHolder) value, data);
- } else if (value instanceof MutablePropertyValues) {
- visitMutablePropertyValues((MutablePropertyValues) value, data);
- } else if (value instanceof PropertyValue) {
- visitPropertyValue((PropertyValue) value, data);
- } else if (value instanceof RuntimeBeanReference) {
- visitRuntimeBeanReference((RuntimeBeanReference) value, data);
- } else if (value instanceof Map) {
- visitMap((Map) value, data);
- } else if (value instanceof Collection) {
- visitCollection((Collection) value, data);
- } else {
- visitObject(value, data);
- }
- }
-
-}
diff --git a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/util/SpringVisitor.java b/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/util/SpringVisitor.java
deleted file mode 100644
index da4e8aa..0000000
--- a/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/util/SpringVisitor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.util;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.PropertyValue;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.config.ConstructorArgumentValues;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * Walks a spring bean factory tree.
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public interface SpringVisitor {
- void visitBeanFactory(ConfigurableListableBeanFactory beanRegistry, Object data) throws BeansException;
-
- void visitBeanDefinition(String beanName, BeanDefinition beanDefinition, Object data) throws BeansException;
-
- void visitBeanDefinition(BeanDefinition beanDefinition, Object data) throws BeansException;
-
- void visitMutablePropertyValues(MutablePropertyValues propertyValues, Object data) throws BeansException;
-
- void visitConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues, Object data) throws BeansException;
-
- void visitConstructorArgumentValue(ConstructorArgumentValues.ValueHolder valueHolder, Object data) throws BeansException;
-
- void visitPropertyValue(PropertyValue propertyValue, Object data) throws BeansException;
-
- void visitRuntimeBeanReference(RuntimeBeanReference beanReference, Object data) throws BeansException;
-
- void visitCollection(Collection collection, Object data) throws BeansException;
-
- void visitMap(Map map, Object data) throws BeansException;
-
- void visitObject(Object value, Object data) throws BeansException;
-
- void visitBeanDefinitionHolder(BeanDefinitionHolder beanDefinitionHolder, Object data) throws BeansException;
-}
diff --git a/trunk/xbean-spring-common/src/main/resources/META-INF/LICENSE b/trunk/xbean-spring-common/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-spring-common/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-spring-common/src/main/resources/META-INF/NOTICE b/trunk/xbean-spring-common/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-spring-common/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-spring-common/src/main/resources/org/apache/xbean/spring/spring-beans.xsd b/trunk/xbean-spring-common/src/main/resources/org/apache/xbean/spring/spring-beans.xsd
deleted file mode 100644
index 1488c88..0000000
--- a/trunk/xbean-spring-common/src/main/resources/org/apache/xbean/spring/spring-beans.xsd
+++ /dev/null
@@ -1,693 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Spring XML Beans DTD
- Authors: Rod Johnson, Juergen Hoeller, Alef Arendsen, Colin Sampaleanu
-
- This defines a simple and consistent way of creating a namespace
- of JavaBeans objects, managed by a Spring BeanFactory, read by
- XmlBeanDefinitionReader (with DefaultXmlBeanDefinitionParser).
-
- This document type is used by most Spring functionality, including
- web application contexts, which are based on bean factories.
-
- Each "bean" element in this document defines a JavaBean.
- Typically the bean class is specified, along with JavaBean properties
- and/or constructor arguments.
-
- Bean instances can be "singletons" (shared instances) or "prototypes"
- (independent instances). Further scopes are supposed to be built on top
- of the core BeanFactory infrastructure and are therefore not part of it.
-
- References among beans are supported, i.e. setting a JavaBean property
- or a constructor argument to refer to another bean in the same factory
- (or an ancestor factory).
-
- As alternative to bean references, "inner bean definitions" can be used.
- Singleton flags of such inner bean definitions are effectively ignored:
- Inner beans are typically anonymous prototypes.
-
- There is also support for lists, sets, maps, and java.util.Properties
- as bean property types or constructor argument types.
-
- As the format is simple, a DTD is sufficient, and there's no need
- for a schema at this point.
-
- XML documents that conform to this DTD should declare the following doctype:
-
- <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
- "http://www.springframework.org/dtd/spring-beans.dtd">
--->
-<!--
- The document root. A document can contain bean definitions only,
- imports only, or a mixture of both (typically with imports first).
--->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://xbean.apache.org/schemas/spring/1.0" xmlns:spring="http://xbean.apache.org/schemas/spring/1.0">
- <xs:element name="beans">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" ref="spring:description"/>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="spring:import"/>
- <xs:element ref="spring:alias"/>
- <xs:element ref="spring:bean"/>
- <xs:any namespace="##other" processContents="lax"/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="default-lazy-init" default="false">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="default-autowire" default="no">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="no"/>
- <xs:enumeration value="byName"/>
- <xs:enumeration value="byType"/>
- <xs:enumeration value="constructor"/>
- <xs:enumeration value="autodetect"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="default-dependency-check" default="none">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="none"/>
- <xs:enumeration value="objects"/>
- <xs:enumeration value="simple"/>
- <xs:enumeration value="all"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
- <!--
- Default values for all bean definitions. Can be overridden at
- the "bean" level. See those attribute definitions for details.
- -->
- <!--
- Element containing informative text describing the purpose of the enclosing
- element. Always optional.
- Used primarily for user documentation of XML bean definition documents.
- -->
- <xs:element name="description" type="xs:string"/>
- <!-- Specifies an XML bean definition resource to import. -->
- <xs:element name="import">
- <xs:complexType>
- <xs:attribute name="resource" use="required"/>
- </xs:complexType>
- </xs:element>
- <!--
- The relative resource location of the XML bean definition file to import,
- for example "myImport.xml" or "includes/myImport.xml" or "../myImport.xml".
- -->
- <!-- Defines an alias for a bean, which can reside in a different definition file. -->
- <xs:element name="alias">
- <xs:complexType>
- <xs:attribute name="name" use="required"/>
- <xs:attribute name="alias" use="required"/>
- </xs:complexType>
- </xs:element>
- <!-- The name of the bean to define an alias for. -->
- <!-- The alias name to define for the bean. -->
- <!--
- Defines a single (usually named) bean.
-
- A bean definition may contain nested tags for constructor arguments,
- property values, lookup methods, and replaced methods. Mixing constructor
- injection and setter injection on the same bean is explicitly supported.
- -->
- <xs:element name="bean">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" ref="spring:description"/>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="spring:constructor-arg"/>
- <xs:element ref="spring:property"/>
- <xs:element ref="spring:lookup-method"/>
- <xs:element ref="spring:replaced-method"/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="id" type="xs:ID"/>
- <xs:attribute name="name"/>
- <xs:attribute name="class"/>
- <xs:attribute name="parent"/>
- <xs:attribute name="abstract" default="false">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="singleton" default="true">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="lazy-init" default="default">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- <xs:enumeration value="default"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="autowire" default="default">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="no"/>
- <xs:enumeration value="byName"/>
- <xs:enumeration value="byType"/>
- <xs:enumeration value="constructor"/>
- <xs:enumeration value="autodetect"/>
- <xs:enumeration value="default"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="dependency-check" default="default">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="none"/>
- <xs:enumeration value="objects"/>
- <xs:enumeration value="simple"/>
- <xs:enumeration value="all"/>
- <xs:enumeration value="default"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="depends-on"/>
- <xs:attribute name="init-method"/>
- <xs:attribute name="destroy-method"/>
- <xs:attribute name="factory-method"/>
- <xs:attribute name="factory-bean"/>
- </xs:complexType>
- </xs:element>
- <!--
- Beans can be identified by an id, to enable reference checking.
-
- There are constraints on a valid XML id: if you want to reference your bean
- in Java code using a name that's illegal as an XML id, use the optional
- "name" attribute. If neither is given, the bean class name is used as id
- (with an appended counter like "#2" if there is already a bean with that name).
- -->
- <!--
- Optional. Can be used to create one or more aliases illegal in an id.
- Multiple aliases can be separated by any number of spaces or commas.
- -->
- <!--
- Each bean definition must specify the fully qualified name of the class,
- except if it pure serves as parent for child bean definitions.
- -->
- <!--
- Optionally specify a parent bean definition.
-
- Will use the bean class of the parent if none specified, but can
- also override it. In the latter case, the child bean class must be
- compatible with the parent, i.e. accept the parent's property values
- and constructor argument values, if any.
-
- A child bean definition will inherit constructor argument values,
- property values and method overrides from the parent, with the option
- to add new values. If init method, destroy method, factory bean and/or factory
- method are specified, they will override the corresponding parent settings.
-
- The remaining settings will always be taken from the child definition:
- depends on, autowire mode, dependency check, singleton, lazy init.
- -->
- <!--
- Is this bean "abstract", i.e. not meant to be instantiated itself but
- rather just serving as parent for concrete child bean definitions.
- Default is "false". Specify "true" to tell the bean factory to not try to
- instantiate that particular bean in any case.
- -->
- <!--
- Is this bean a "singleton" (one shared instance, which will
- be returned by all calls to getBean() with the id),
- or a "prototype" (independent instance resulting from each call to
- getBean(). Default is singleton.
-
- Singletons are most commonly used, and are ideal for multi-threaded
- service objects.
- -->
- <!--
- If this bean should be lazily initialized.
- If false, it will get instantiated on startup by bean factories
- that perform eager initialization of singletons.
- -->
- <!--
- Optional attribute controlling whether to "autowire" bean properties.
- This is an automagical process in which bean references don't need to be coded
- explicitly in the XML bean definition file, but Spring works out dependencies.
-
- There are 5 modes:
-
- 1. "no"
- The traditional Spring default. No automagical wiring. Bean references
- must be defined in the XML file via the <ref> element. We recommend this
- in most cases as it makes documentation more explicit.
-
- 2. "byName"
- Autowiring by property name. If a bean of class Cat exposes a dog property,
- Spring will try to set this to the value of the bean "dog" in the current factory.
- If there is no matching bean by name, nothing special happens;
- use dependency-check="objects" to raise an error in that case.
-
- 3. "byType"
- Autowiring if there is exactly one bean of the property type in the bean factory.
- If there is more than one, a fatal error is raised, and you can't use byType
- autowiring for that bean. If there is none, nothing special happens;
- use dependency-check="objects" to raise an error in that case.
-
- 4. "constructor"
- Analogous to "byType" for constructor arguments. If there isn't exactly one bean
- of the constructor argument type in the bean factory, a fatal error is raised.
-
- 5. "autodetect"
- Chooses "constructor" or "byType" through introspection of the bean class.
- If a default constructor is found, "byType" gets applied.
-
- The latter two are similar to PicoContainer and make bean factories simple to
- configure for small namespaces, but doesn't work as well as standard Spring
- behaviour for bigger applications.
-
- Note that explicit dependencies, i.e. "property" and "constructor-arg" elements,
- always override autowiring. Autowire behaviour can be combined with dependency
- checking, which will be performed after all autowiring has been completed.
- -->
- <!--
- Optional attribute controlling whether to check whether all this
- beans dependencies, expressed in its properties, are satisfied.
- Default is no dependency checking.
-
- "simple" type dependency checking includes primitives and String
- "object" includes collaborators (other beans in the factory)
- "all" includes both types of dependency checking
- -->
- <!--
- The names of the beans that this bean depends on being initialized.
- The bean factory will guarantee that these beans get initialized before.
-
- Note that dependencies are normally expressed through bean properties or
- constructor arguments. This property should just be necessary for other kinds
- of dependencies like statics (*ugh*) or database preparation on startup.
- -->
- <!--
- Optional attribute for the name of the custom initialization method
- to invoke after setting bean properties. The method must have no arguments,
- but may throw any exception.
- -->
- <!--
- Optional attribute for the name of the custom destroy method to invoke
- on bean factory shutdown. The method must have no arguments,
- but may throw any exception. Note: Only invoked on singleton beans!
- -->
- <!--
- Optional attribute specifying the name of a factory method to use to
- create this object. Use constructor-arg elements to specify arguments
- to the factory method, if it takes arguments. Autowiring does not apply
- to factory methods.
-
- If the "class" attribute is present, the factory method will be a static
- method on the class specified by the "class" attribute on this bean
- definition. Often this will be the same class as that of the constructed
- object - for example, when the factory method is used as an alternative
- to a constructor. However, it may be on a different class. In that case,
- the created object will *not* be of the class specified in the "class"
- attribute. This is analogous to FactoryBean behavior.
-
- If the "factory-bean" attribute is present, the "class" attribute is not
- used, and the factory method will be an instance method on the object
- returned from a getBean call with the specified bean name. The factory
- bean may be defined as a singleton or a prototype.
-
- The factory method can have any number of arguments. Autowiring is not
- supported. Use indexed constructor-arg elements in conjunction with the
- factory-method attribute.
-
- Setter Injection can be used in conjunction with a factory method.
- Method Injection cannot, as the factory method returns an instance,
- which will be used when the container creates the bean.
- -->
- <!--
- Alternative to class attribute for factory-method usage.
- If this is specified, no class attribute should be used.
- This should be set to the name of a bean in the current or
- ancestor factories that contains the relevant factory method.
- This allows the factory itself to be configured using Dependency
- Injection, and an instance (rather than static) method to be used.
- -->
- <!--
- Bean definitions can specify zero or more constructor arguments.
- This is an alternative to "autowire constructor".
- Arguments correspond to either a specific index of the constructor argument
- list or are supposed to be matched generically by type.
-
- Note: A single generic argument value will just be used once, rather than
- potentially matched multiple times (as of Spring 1.1).
-
- constructor-arg elements are also used in conjunction with the factory-method
- element to construct beans using static or instance factory methods.
- -->
- <xs:element name="constructor-arg">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" ref="spring:description"/>
- <xs:choice minOccurs="0">
- <xs:element ref="spring:bean"/>
- <xs:element ref="spring:ref"/>
- <xs:element ref="spring:idref"/>
- <xs:element ref="spring:value"/>
- <xs:element ref="spring:null"/>
- <xs:element ref="spring:list"/>
- <xs:element ref="spring:set"/>
- <xs:element ref="spring:map"/>
- <xs:element ref="spring:props"/>
- <xs:any namespace="##other" processContents="lax"/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="index"/>
- <xs:attribute name="type"/>
- <xs:attribute name="ref"/>
- <xs:attribute name="value"/>
- </xs:complexType>
- </xs:element>
- <!--
- The constructor-arg tag can have an optional index attribute,
- to specify the exact index in the constructor argument list. Only needed
- to avoid ambiguities, e.g. in case of 2 arguments of the same type.
- -->
- <!--
- The constructor-arg tag can have an optional type attribute,
- to specify the exact type of the constructor argument. Only needed
- to avoid ambiguities, e.g. in case of 2 single argument constructors
- that can both be converted from a String.
- -->
- <!-- A short-cut alternative to a child element "ref bean=". -->
- <!-- A short-cut alternative to a child element "value". -->
- <!--
- Bean definitions can have zero or more properties.
- Property elements correspond to JavaBean setter methods exposed
- by the bean classes. Spring supports primitives, references to other
- beans in the same or related factories, lists, maps and properties.
- -->
- <xs:element name="property">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" ref="spring:description"/>
- <xs:choice minOccurs="0">
- <xs:element ref="spring:bean"/>
- <xs:element ref="spring:ref"/>
- <xs:element ref="spring:idref"/>
- <xs:element ref="spring:value"/>
- <xs:element ref="spring:null"/>
- <xs:element ref="spring:list"/>
- <xs:element ref="spring:set"/>
- <xs:element ref="spring:map"/>
- <xs:element ref="spring:props"/>
- <xs:any namespace="##other" processContents="lax"/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="name" use="required"/>
- <xs:attribute name="ref"/>
- <xs:attribute name="value"/>
- </xs:complexType>
- </xs:element>
- <!--
- The property name attribute is the name of the JavaBean property.
- This follows JavaBean conventions: a name of "age" would correspond
- to setAge()/optional getAge() methods.
- -->
- <!-- A short-cut alternative to a child element "ref bean=". -->
- <!-- A short-cut alternative to a child element "value". -->
- <!--
- A lookup method causes the IoC container to override the given method and return
- the bean with the name given in the bean attribute. This is a form of Method Injection.
- It's particularly useful as an alternative to implementing the BeanFactoryAware
- interface, in order to be able to make getBean() calls for non-singleton instances
- at runtime. In this case, Method Injection is a less invasive alternative.
- -->
- <xs:element name="lookup-method">
- <xs:complexType>
- <xs:attribute name="name"/>
- <xs:attribute name="bean"/>
- </xs:complexType>
- </xs:element>
- <!-- Name of a lookup method. This method should take no arguments. -->
- <!--
- Name of the bean in the current or ancestor factories that the lookup method
- should resolve to. Often this bean will be a prototype, in which case the
- lookup method will return a distinct instance on every invocation. This
- is useful for single-threaded objects.
- -->
- <!--
- Similar to the lookup method mechanism, the replaced-method element is used to control
- IoC container method overriding: Method Injection. This mechanism allows the overriding
- of a method with arbitrary code.
- -->
- <xs:element name="replaced-method">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="spring:arg-type"/>
- </xs:sequence>
- <xs:attribute name="name"/>
- <xs:attribute name="replacer"/>
- </xs:complexType>
- </xs:element>
- <!--
- Name of the method whose implementation should be replaced by the IoC container.
- If this method is not overloaded, there's no need to use arg-type subelements.
- If this method is overloaded, arg-type subelements must be used for all
- override definitions for the method.
- -->
- <!--
- Bean name of an implementation of the MethodReplacer interface
- in the current or ancestor factories. This may be a singleton or prototype
- bean. If it's a prototype, a new instance will be used for each method replacement.
- Singleton usage is the norm.
- -->
- <!--
- Subelement of replaced-method identifying an argument for a replaced method
- in the event of method overloading.
- -->
- <xs:element name="arg-type">
- <xs:complexType mixed="true">
- <xs:attribute name="match"/>
- </xs:complexType>
- </xs:element>
- <!--
- Specification of the type of an overloaded method argument as a String.
- For convenience, this may be a substring of the FQN. E.g. all the
- following would match "java.lang.String":
- - java.lang.String
- - String
- - Str
-
- As the number of arguments will be checked also, this convenience can often
- be used to save typing.
- -->
- <!--
- Defines a reference to another bean in this factory or an external
- factory (parent or included factory).
- -->
- <xs:element name="ref">
- <xs:complexType>
- <xs:attribute name="bean"/>
- <xs:attribute name="local" type="xs:IDREF"/>
- <xs:attribute name="parent"/>
- </xs:complexType>
- </xs:element>
- <!--
- References must specify a name of the target bean.
- The "bean" attribute can reference any name from any bean in the context,
- to be checked at runtime.
- Local references, using the "local" attribute, have to use bean ids;
- they can be checked by this DTD, thus should be preferred for references
- within the same bean factory XML file.
- -->
- <!--
- Defines a string property value, which must also be the id of another
- bean in this factory or an external factory (parent or included factory).
- While a regular 'value' element could instead be used for the same effect,
- using idref in this case allows validation of local bean ids by the xml
- parser, and name completion by helper tools.
- -->
- <xs:element name="idref">
- <xs:complexType>
- <xs:attribute name="bean"/>
- <xs:attribute name="local" type="xs:IDREF"/>
- </xs:complexType>
- </xs:element>
- <!--
- ID refs must specify a name of the target bean.
- The "bean" attribute can reference any name from any bean in the context,
- potentially to be checked at runtime by bean factory implementations.
- Local references, using the "local" attribute, have to use bean ids;
- they can be checked by this DTD, thus should be preferred for references
- within the same bean factory XML file.
- -->
- <!--
- Contains a string representation of a property value.
- The property may be a string, or may be converted to the
- required type using the JavaBeans PropertyEditor
- machinery. This makes it possible for application developers
- to write custom PropertyEditor implementations that can
- convert strings to objects.
-
- Note that this is recommended for simple objects only.
- Configure more complex objects by populating JavaBean
- properties with references to other beans.
- -->
- <xs:element name="value">
- <xs:complexType mixed="true">
- <xs:attribute name="type"/>
- </xs:complexType>
- </xs:element>
- <!--
- The value tag can have an optional type attribute, to specify the
- exact type that the value should be converted to. Only needed
- if the type of the target property or constructor argument is
- too generic: for example, in case of a collection element.
- -->
- <!--
- Denotes a Java null value. Necessary because an empty "value" tag
- will resolve to an empty String, which will not be resolved to a
- null value unless a special PropertyEditor does so.
- -->
- <xs:element name="null" type="xs:string"/>
- <!--
- A list can contain multiple inner bean, ref, collection, or value elements.
- Java lists are untyped, pending generics support in Java 1.5,
- although references will be strongly typed.
- A list can also map to an array type. The necessary conversion
- is automatically performed by the BeanFactory.
- -->
- <xs:element name="list">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="spring:bean"/>
- <xs:element ref="spring:ref"/>
- <xs:element ref="spring:idref"/>
- <xs:element ref="spring:value"/>
- <xs:element ref="spring:null"/>
- <xs:element ref="spring:list"/>
- <xs:element ref="spring:set"/>
- <xs:element ref="spring:map"/>
- <xs:element ref="spring:props"/>
- <xs:any namespace="##other" processContents="lax"/>
- </xs:choice>
- </xs:complexType>
- </xs:element>
- <!--
- A set can contain multiple inner bean, ref, collection, or value elements.
- Java sets are untyped, pending generics support in Java 1.5,
- although references will be strongly typed.
- -->
- <xs:element name="set">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="spring:bean"/>
- <xs:element ref="spring:ref"/>
- <xs:element ref="spring:idref"/>
- <xs:element ref="spring:value"/>
- <xs:element ref="spring:null"/>
- <xs:element ref="spring:list"/>
- <xs:element ref="spring:set"/>
- <xs:element ref="spring:map"/>
- <xs:element ref="spring:props"/>
- <xs:any namespace="##other" processContents="lax"/>
- </xs:choice>
- </xs:complexType>
- </xs:element>
- <!--
- A Spring map is a mapping from a string key to object.
- Maps may be empty.
- -->
- <xs:element name="map">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="spring:entry"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <!--
- A map entry can be an inner bean, ref, value, or collection.
- The key of the entry is given by the "key" attribute or child element.
- -->
- <xs:element name="entry">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" ref="spring:key"/>
- <xs:choice minOccurs="0">
- <xs:element ref="spring:bean"/>
- <xs:element ref="spring:ref"/>
- <xs:element ref="spring:idref"/>
- <xs:element ref="spring:value"/>
- <xs:element ref="spring:null"/>
- <xs:element ref="spring:list"/>
- <xs:element ref="spring:set"/>
- <xs:element ref="spring:map"/>
- <xs:element ref="spring:props"/>
- <xs:any namespace="##other" processContents="lax"/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="key"/>
- <xs:attribute name="key-ref"/>
- <xs:attribute name="value"/>
- <xs:attribute name="value-ref"/>
- </xs:complexType>
- </xs:element>
- <!--
- Each map element must specify its key as attribute or as child element.
- A key attribute is always a String value.
- -->
- <!-- A short-cut alternative to a "key" element with a "ref bean=" child element. -->
- <!-- A short-cut alternative to a child element "value". -->
- <!-- A short-cut alternative to a child element "ref bean=". -->
- <!-- A key element can contain an inner bean, ref, value, or collection. -->
- <xs:element name="key">
- <xs:complexType>
- <xs:choice>
- <xs:element ref="spring:bean"/>
- <xs:element ref="spring:ref"/>
- <xs:element ref="spring:idref"/>
- <xs:element ref="spring:value"/>
- <xs:element ref="spring:null"/>
- <xs:element ref="spring:list"/>
- <xs:element ref="spring:set"/>
- <xs:element ref="spring:map"/>
- <xs:element ref="spring:props"/>
- <xs:any namespace="##other" processContents="lax"/>
- </xs:choice>
- </xs:complexType>
- </xs:element>
- <!--
- Props elements differ from map elements in that values must be strings.
- Props may be empty.
- -->
- <xs:element name="props">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="spring:prop"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <!--
- Element content is the string value of the property.
- Note that whitespace is trimmed off to avoid unwanted whitespace
- caused by typical XML formatting.
- -->
- <xs:element name="prop">
- <xs:complexType mixed="true">
- <xs:attribute name="key" use="required"/>
- </xs:complexType>
- </xs:element>
-</xs:schema>
-<!-- Each property element must specify its key. -->
diff --git a/trunk/xbean-spring-itests/1.2.4/pom.xml b/trunk/xbean-spring-itests/1.2.4/pom.xml
deleted file mode 100644
index 15a445c..0000000
--- a/trunk/xbean-spring-itests/1.2.4/pom.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean-spring-itests</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring-itests-124</artifactId>
- <name>XBean :: Spring :: ITests :: 124</name>
- <version>2.4-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-itests-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- <version>1.2.4</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-spring-itests/1.2.4/src/test/java/org/apache/xbean/spring/context/Spring124Test.java b/trunk/xbean-spring-itests/1.2.4/src/test/java/org/apache/xbean/spring/context/Spring124Test.java
deleted file mode 100644
index 9d03136..0000000
--- a/trunk/xbean-spring-itests/1.2.4/src/test/java/org/apache/xbean/spring/context/Spring124Test.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-public class Spring124Test extends RestaurantUsingXBeanTest {
-
-}
diff --git a/trunk/xbean-spring-itests/1.2.5/pom.xml b/trunk/xbean-spring-itests/1.2.5/pom.xml
deleted file mode 100644
index 92ed7d8..0000000
--- a/trunk/xbean-spring-itests/1.2.5/pom.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean-spring-itests</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring-itests-125</artifactId>
- <name>XBean :: Spring :: ITests :: 125</name>
- <version>2.4-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-itests-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- <version>1.2.5</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-support</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-orm</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-hibernate</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-remoting</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-spring-itests/1.2.5/src/test/java/org/apache/xbean/spring/context/Spring125Test.java b/trunk/xbean-spring-itests/1.2.5/src/test/java/org/apache/xbean/spring/context/Spring125Test.java
deleted file mode 100644
index 5cd3096..0000000
--- a/trunk/xbean-spring-itests/1.2.5/src/test/java/org/apache/xbean/spring/context/Spring125Test.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-public class Spring125Test extends RestaurantUsingXBeanTest {
-
-}
diff --git a/trunk/xbean-spring-itests/1.2.6/pom.xml b/trunk/xbean-spring-itests/1.2.6/pom.xml
deleted file mode 100644
index 86de874..0000000
--- a/trunk/xbean-spring-itests/1.2.6/pom.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean-spring-itests</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring-itests-126</artifactId>
- <name>XBean :: Spring :: ITests :: 126</name>
- <version>2.4-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-itests-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- <version>1.2.6</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-spring-itests/1.2.6/src/test/java/org/apache/xbean/spring/context/Spring126Test.java b/trunk/xbean-spring-itests/1.2.6/src/test/java/org/apache/xbean/spring/context/Spring126Test.java
deleted file mode 100644
index 2c484ca..0000000
--- a/trunk/xbean-spring-itests/1.2.6/src/test/java/org/apache/xbean/spring/context/Spring126Test.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-public class Spring126Test extends RestaurantUsingXBeanTest {
-
-}
diff --git a/trunk/xbean-spring-itests/1.2.7/pom.xml b/trunk/xbean-spring-itests/1.2.7/pom.xml
deleted file mode 100644
index 33258ce..0000000
--- a/trunk/xbean-spring-itests/1.2.7/pom.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean-spring-itests</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring-itests-127</artifactId>
- <name>XBean :: Spring :: ITests :: 127</name>
- <version>2.4-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-itests-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- <version>1.2.7</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-spring-itests/1.2.7/src/test/java/org/apache/xbean/spring/context/Spring127Test.java b/trunk/xbean-spring-itests/1.2.7/src/test/java/org/apache/xbean/spring/context/Spring127Test.java
deleted file mode 100644
index a29a4f9..0000000
--- a/trunk/xbean-spring-itests/1.2.7/src/test/java/org/apache/xbean/spring/context/Spring127Test.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-public class Spring127Test extends RestaurantUsingXBeanTest {
-
-}
diff --git a/trunk/xbean-spring-itests/1.2.8/pom.xml b/trunk/xbean-spring-itests/1.2.8/pom.xml
deleted file mode 100644
index 66ee60c..0000000
--- a/trunk/xbean-spring-itests/1.2.8/pom.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean-spring-itests</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring-itests-128</artifactId>
- <name>XBean :: Spring :: ITests :: 128</name>
- <version>2.4-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-itests-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- <version>1.2.8</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-spring-itests/1.2.8/src/test/java/org/apache/xbean/spring/context/Spring128Test.java b/trunk/xbean-spring-itests/1.2.8/src/test/java/org/apache/xbean/spring/context/Spring128Test.java
deleted file mode 100644
index cebfc96..0000000
--- a/trunk/xbean-spring-itests/1.2.8/src/test/java/org/apache/xbean/spring/context/Spring128Test.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-public class Spring128Test extends RestaurantUsingXBeanTest {
-
-}
diff --git a/trunk/xbean-spring-itests/2.0-m5/pom.xml b/trunk/xbean-spring-itests/2.0-m5/pom.xml
deleted file mode 100644
index 286db68..0000000
--- a/trunk/xbean-spring-itests/2.0-m5/pom.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean-spring-itests</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring-itests-20m5</artifactId>
- <name>XBean :: Spring :: ITests :: 20m5</name>
- <version>2.4-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-itests-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- <version>2.0-m5</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-spring-itests/2.0-m5/src/test/java/org/apache/xbean/spring/context/Spring20m5Test.java b/trunk/xbean-spring-itests/2.0-m5/src/test/java/org/apache/xbean/spring/context/Spring20m5Test.java
deleted file mode 100644
index 6cf7802..0000000
--- a/trunk/xbean-spring-itests/2.0-m5/src/test/java/org/apache/xbean/spring/context/Spring20m5Test.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-public class Spring20m5Test extends RestaurantUsingXBeanTest {
-
-}
diff --git a/trunk/xbean-spring-itests/core/pom.xml b/trunk/xbean-spring-itests/core/pom.xml
deleted file mode 100644
index 919dbec..0000000
--- a/trunk/xbean-spring-itests/core/pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean-spring-itests</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring-itests-core</artifactId>
- <name>XBean :: Spring :: ITests :: Core</name>
- <version>2.4-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.xbean</groupId>
- <artifactId>maven-xbean-plugin</artifactId>
- <version>${version}</version>
- <executions>
- <execution>
- <configuration>
- <namespace>http://xbean.apache.org/schemas/pizza</namespace>
- </configuration>
- <goals>
- <goal>mapping</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java b/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java
deleted file mode 100644
index d426410..0000000
--- a/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.RestaurantService;
-import org.apache.xbean.spring.example.PizzaService;
-
-import javax.xml.namespace.QName;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingXBeanTest extends SpringTestSupport {
-
- private static final Log log = LogFactory.getLog(RestaurantUsingXBeanTest.class);
-
- public void testPizza() throws Exception {
- RestaurantService restaurant = (RestaurantService) getBean("restaurant");
-
- QName name = restaurant.getServiceName();
- assertNotNull("Name is null", name);
- assertEquals("Namespace URI", "http://acme.com", name.getNamespaceURI());
- assertEquals("localName", "xyz", name.getLocalPart());
- assertEquals("prefix", "foo", name.getPrefix());
-
- // dinners (1-many using list)
- List dinners = restaurant.getDinnerMenu();
- assertNotNull("dinners is null!", dinners);
- assertEquals("dinners size: " + dinners, 2, dinners.size());
-
- PizzaService pizza = (PizzaService) dinners.get(0);
- assertEquals("topping", "Ham", pizza.getTopping());
- assertEquals("cheese", "Mozzarella", pizza.getCheese());
- assertEquals("size", 15, pizza.getSize());
-
- pizza = (PizzaService) dinners.get(1);
- assertEquals("topping", "Eggs", pizza.getTopping());
- assertEquals("cheese", "Mozzarella", pizza.getCheese());
- assertEquals("size", 16, pizza.getSize());
-
- // lunches (1-many using array)
- PizzaService[] lunches = restaurant.getLunchMenu();
- assertNotNull("lunches is null!", lunches);
- assertEquals("lunches size: " + lunches, 1, lunches.length);
-
- pizza = lunches[0];
- assertEquals("topping", "Chicken", pizza.getTopping());
- assertEquals("cheese", "Brie", pizza.getCheese());
- assertEquals("size", 17, pizza.getSize());
-
-
- // favourite (1-1)
- pizza = restaurant.getFavourite();
- assertNotNull("Pizza is null!", pizza);
- pizza.makePizza();
-
- assertEquals("topping", "Salami", pizza.getTopping());
- assertEquals("cheese", "Edam", pizza.getCheese());
- assertEquals("size", 17, pizza.getSize());
-
- URI uri = restaurant.getUri();
- assertNotNull("URI is null", uri);
- assertEquals("URI", new URI("http://cheese.com"), uri);
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean.xml");
- }
-}
diff --git a/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/context/SpringTestSupport.java b/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/context/SpringTestSupport.java
deleted file mode 100644
index f57ea50..0000000
--- a/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/context/SpringTestSupport.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-import junit.framework.TestCase;
-
-/**
- * A useful base class for testing spring based utilities.
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public abstract class SpringTestSupport extends TestCase {
- protected transient Log log = LogFactory.getLog(getClass());
-
- protected AbstractXmlApplicationContext context;
-
- protected void setUp() throws Exception {
- context = createApplicationContext();
- assertNotNull("ApplicationContext is null!", context);
- }
-
- protected void tearDown() throws Exception {
- if (context != null) {
- log.info("Closing down the spring context");
- context.destroy();
- }
- }
-
- protected Object getBean(String name) {
- Object answer = answer = context.getBean(name);
- assertNotNull("Could not find object in Spring for key: " + name, answer);
- return answer;
- }
-
- protected abstract AbstractXmlApplicationContext createApplicationContext();
-}
diff --git a/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/example/PizzaService.java b/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/example/PizzaService.java
deleted file mode 100644
index 0c57936..0000000
--- a/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/example/PizzaService.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @org.apache.xbean.XBean element="pizza"
- * description="This is a tasty Pizza"
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-
-// START SNIPPET: bean
-public class PizzaService {
-
- private static final Log log = LogFactory.getLog(PizzaService.class);
-
- private String topping;
- private String cheese;
- private int size;
- private double price;
-
- public void makePizza() {
- log.info("Making a pizza with topping: " + topping + " cheese: " + cheese + " with size: " + size);
- }
-
- public String getCheese() {
- return cheese;
- }
-
- public void setCheese(String cheese) {
- this.cheese = cheese;
- }
-
- public double getPrice() {
- return price;
- }
-
- public void setPrice(double price) {
- this.price = price;
- }
-
- public int getSize() {
- return size;
- }
-
- public void setSize(int size) {
- this.size = size;
- }
-
- /**
- * @org.apache.xbean.Property alias="myTopping"
- */
- public String getTopping() {
- return topping;
- }
-
- public void setTopping(String topping) {
- this.topping = topping;
- }
-
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/example/RestaurantService.java b/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/example/RestaurantService.java
deleted file mode 100644
index 20985c5..0000000
--- a/trunk/xbean-spring-itests/core/src/main/java/org/apache/xbean/spring/example/RestaurantService.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import javax.xml.namespace.QName;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * An owner POJO used for testing out nested properties
- *
- * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/pizza" element="restaurant"
- * description="A Restaurant thingy"
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantService {
-
- private PizzaService favourite;
- private List dinnerMenu;
- private PizzaService[] lunchMenu;
- private QName serviceName;
- private URI uri;
-
- /**
- * @org.apache.xbean.Property nestedType="org.apache.xbean.spring.example.PizzaService"
- */
- public List getDinnerMenu() {
- return dinnerMenu;
- }
-
- public void setDinnerMenu(List dinnerMenu) {
- this.dinnerMenu = dinnerMenu;
- }
-
- public PizzaService[] getLunchMenu() {
- return lunchMenu;
- }
-
- public void setLunchMenu(PizzaService[] lunchMenu) {
- this.lunchMenu = lunchMenu;
- }
-
- public PizzaService getFavourite() {
- return favourite;
- }
-
- public void setFavourite(PizzaService favourite) {
- this.favourite = favourite;
- }
-
- public QName getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(QName name) {
- this.serviceName = name;
- }
-
- public URI getUri() {
- return uri;
- }
-
- public void setUri(URI uri) {
- this.uri = uri;
- }
-
-}
diff --git a/trunk/xbean-spring-itests/core/src/main/resources/org/apache/xbean/spring/context/restaurant-xbean.xml b/trunk/xbean-spring-itests/core/src/main/resources/org/apache/xbean/spring/context/restaurant-xbean.xml
deleted file mode 100644
index baee015..0000000
--- a/trunk/xbean-spring-itests/core/src/main/resources/org/apache/xbean/spring/context/restaurant-xbean.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans>
-
- <restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/pizza" xmlns:foo="http://acme.com" serviceName="foo:xyz" uri="http://cheese.com">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <pizza myTopping="Eggs" cheese="Mozzarella" size="16"/>
- </dinnerMenu>
-
- <lunchMenu>
- <pizza myTopping="Chicken" cheese="Brie" size="17"/>
- </lunchMenu>
-
- <favourite>
- <pizza myTopping="Salami" cheese="Edam" size="17"/>
- </favourite>
- </restaurant>
-</beans>
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-itests/pom.xml b/trunk/xbean-spring-itests/pom.xml
deleted file mode 100644
index e825401..0000000
--- a/trunk/xbean-spring-itests/pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring-itests</artifactId>
- <name>XBean :: Spring :: ITests</name>
- <version>2.4-SNAPSHOT</version>
- <packaging>pom</packaging>
- <modules>
- <module>core</module>
- <module>1.2.4</module>
- <module>1.2.5</module>
- <module>1.2.6</module>
- <module>1.2.7</module>
- <module>1.2.8</module>
- <module>2.0-m5</module>
- </modules>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-itests-core</artifactId>
- <version>${version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-</project>
diff --git a/trunk/xbean-spring-v1/LICENSE.txt b/trunk/xbean-spring-v1/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-spring-v1/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-spring-v1/NOTICE.txt b/trunk/xbean-spring-v1/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-spring-v1/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-spring-v1/README.txt b/trunk/xbean-spring-v1/README.txt
deleted file mode 100644
index 826ba9f..0000000
--- a/trunk/xbean-spring-v1/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-This module contains the Spring additions for XBean which
-
-* provide a custom XML extension mechanism, allowing more concise XML to be used
- along with XSDs so that they can be more easily validated with off the shelf XML tooling
-
-* LDAP enhancements to Spring's configuration mechanism.
diff --git a/trunk/xbean-spring-v1/pom.xml b/trunk/xbean-spring-v1/pom.xml
deleted file mode 100644
index d1b1931..0000000
--- a/trunk/xbean-spring-v1/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring-v1</artifactId>
- <name>XBean :: Spring :: V1</name>
- <version>2.4-SNAPSHOT</version>
- <build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- <testResource>
- <directory>target/test-generated</directory>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <taskdef classname="org.apache.xbean.spring.generator.MappingGeneratorTask" name="mapping">
- <classpath>
- <pathelement path="${basedir}/target/classes"></pathelement>
- <pathelement path="${basedir}/target/test-classes"></pathelement>
- <path refid="maven.runtime.classpath"></path>
- </classpath>
- </taskdef>
- <mapping namespace="http://xbean.apache.org/schemas/pizza" srcdir="src/test/java" destFile="target/restaurant.xsd" metaInfDir="${basedir}/target/test-generated/"></mapping>
- <copy todir="${basedir}/target/test-classes">
- <fileset dir="${basedir}/target/test-generated"></fileset>
- </copy>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-common</artifactId>
- </dependency>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>qdox</groupId>
- <artifactId>qdox</artifactId>
- <optional>true</optional>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-spring-v1/src/main/java/org/apache/xbean/spring/context/v1/XBeanXmlBeanDefinitionParser.java b/trunk/xbean-spring-v1/src/main/java/org/apache/xbean/spring/context/v1/XBeanXmlBeanDefinitionParser.java
deleted file mode 100644
index a0a2a44..0000000
--- a/trunk/xbean-spring-v1/src/main/java/org/apache/xbean/spring/context/v1/XBeanXmlBeanDefinitionParser.java
+++ /dev/null
@@ -1,813 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context.v1;
-
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.xbean.spring.context.impl.MappingMetaData;
-import org.apache.xbean.spring.context.impl.NamedConstructorArgs;
-import org.apache.xbean.spring.context.impl.NamespaceHelper;
-import org.apache.xbean.spring.context.impl.PropertyEditorHelper;
-import org.apache.xbean.spring.context.impl.QNameHelper;
-import org.apache.xbean.spring.context.impl.QNameReflectionHelper;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.PropertyValue;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.support.ManagedList;
-import org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-
-/**
- * An enhanced XML parser capable of handling custom XML schemas.
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class XBeanXmlBeanDefinitionParser extends DefaultXmlBeanDefinitionParser {
-
- public static final String SPRING_SCHEMA = "http://xbean.apache.org/schemas/spring/1.0";
- public static final String SPRING_SCHEMA_COMPAT = "http://xbean.org/schemas/spring/1.0";
-
- static {
- PropertyEditorHelper.registerCustomEditors();
- }
-
- private static final Log log = LogFactory.getLog(XBeanXmlBeanDefinitionParser.class);
-
- private static final String QNAME_ELEMENT = "qname";
-
- /**
- * All the reserved Spring XML element names which cannot be overloaded by
- * an XML extension
- */
- protected static final String[] RESERVED_ELEMENT_NAMES = { "beans", DESCRIPTION_ELEMENT, IMPORT_ELEMENT,
- ALIAS_ELEMENT, BEAN_ELEMENT, CONSTRUCTOR_ARG_ELEMENT, PROPERTY_ELEMENT, LOOKUP_METHOD_ELEMENT,
- REPLACED_METHOD_ELEMENT, ARG_TYPE_ELEMENT, REF_ELEMENT, IDREF_ELEMENT, VALUE_ELEMENT, NULL_ELEMENT,
- LIST_ELEMENT, SET_ELEMENT, MAP_ELEMENT, ENTRY_ELEMENT, KEY_ELEMENT, PROPS_ELEMENT, PROP_ELEMENT,
- QNAME_ELEMENT };
-
- protected static final String[] RESERVED_BEAN_ATTRIBUTE_NAMES = { ID_ATTRIBUTE, NAME_ATTRIBUTE, CLASS_ATTRIBUTE,
- PARENT_ATTRIBUTE, DEPENDS_ON_ATTRIBUTE, FACTORY_METHOD_ATTRIBUTE, FACTORY_BEAN_ATTRIBUTE,
- DEPENDENCY_CHECK_ATTRIBUTE, AUTOWIRE_ATTRIBUTE, INIT_METHOD_ATTRIBUTE, DESTROY_METHOD_ATTRIBUTE,
- ABSTRACT_ATTRIBUTE, SINGLETON_ATTRIBUTE, LAZY_INIT_ATTRIBUTE };
-
- private static final String JAVA_PACKAGE_PREFIX = "java://";
-
- private static final String BEAN_REFERENCE_PREFIX = "#";
-
- private Set reservedElementNames = new HashSet(Arrays.asList(RESERVED_ELEMENT_NAMES));
- private Set reservedBeanAttributeNames = new HashSet(Arrays.asList(RESERVED_BEAN_ATTRIBUTE_NAMES));
- protected final NamedConstructorArgs namedConstructorArgs = new NamedConstructorArgs();
-
- private boolean qnameIsOnClassPath;
-
- private boolean initQNameOnClassPath;
-
- /**
- * Configures the XmlBeanDefinitionReader to work nicely with extensible XML
- * using this reader implementation.
- */
- public static void configure(AbstractApplicationContext context, XmlBeanDefinitionReader reader) {
- reader.setValidating(false);
- reader.setNamespaceAware(true);
- reader.setParserClass(XBeanXmlBeanDefinitionParser.class);
- }
-
- /**
- * Registers whatever custom editors we need
- */
- public static void registerCustomEditors(DefaultListableBeanFactory beanFactory) {
- PropertyEditorHelper.registerCustomEditors();
- }
-
- /**
- * Parses the non-standard XML element as a Spring bean definition
- */
- protected BeanDefinitionHolder parseBeanFromExtensionElement(Element element, String parentClass, String property) {
- String uri = element.getNamespaceURI();
- String localName = getLocalName(element);
-
- MappingMetaData metadata = findNamespaceProperties(uri, localName);
- if (metadata != null) {
- // lets see if we configured the localName to a bean class
- String className = getPropertyDescriptor(parentClass, property).getPropertyType().getName();
- if (className != null) {
- return parseBeanFromExtensionElement(element, metadata, className);
- }
- }
- return null;
- }
-
- private BeanDefinitionHolder parseBeanFromExtensionElement(Element element, MappingMetaData metadata, String className) {
- Element original = cloneElement(element);
- // lets assume the class name == the package name plus the
- element.setAttributeNS(null, "class", className);
- addSpringAttributeValues(className, element);
- BeanDefinitionHolder definition = parseBeanDefinitionElement(element, false);
- addAttributeProperties(definition, metadata, className, original);
- addContentProperty(definition, metadata, element);
- addNestedPropertyElements(definition, metadata, className, element);
- coerceNamespaceAwarePropertyValues(definition, element);
- declareLifecycleMethods(definition, metadata, element);
- namedConstructorArgs.processParameters(definition, metadata);
- return definition;
- }
-
- /**
- * Parses the non-standard XML element as a Spring bean definition
- */
- protected BeanDefinitionHolder parseBeanFromExtensionElement(Element element) {
- String uri = element.getNamespaceURI();
- String localName = getLocalName(element);
-
- MappingMetaData metadata = findNamespaceProperties(uri, localName);
- if (metadata != null) {
- // lets see if we configured the localName to a bean class
- String className = metadata.getClassName(localName);
- if (className != null) {
- return parseBeanFromExtensionElement(element, metadata, className);
- } else {
- throw new BeanDefinitionStoreException("Unrecognized xbean element mapping: " + localName + " in namespace " + uri);
- }
- } else {
- if (uri == null) throw new BeanDefinitionStoreException("Unrecognized Spring element: " + localName);
- else throw new BeanDefinitionStoreException("Unrecognized xbean namespace mapping: " + uri);
- }
- }
-
- protected void addSpringAttributeValues(String className, Element element) {
- NamedNodeMap attributes = element.getAttributes();
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- String localName = attribute.getLocalName();
-
- if (uri != null && (uri.equals(SPRING_SCHEMA) || uri.equals(SPRING_SCHEMA_COMPAT))) {
- element.setAttributeNS(null, localName, attribute.getNodeValue());
- }
- }
- }
-
- /**
- * Creates a clone of the element and its attribute (though not its content)
- */
- protected Element cloneElement(Element element) {
- Element answer = element.getOwnerDocument().createElementNS(element.getNamespaceURI(), element.getNodeName());
- NamedNodeMap attributes = element.getAttributes();
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- answer.setAttributeNS(uri, attribute.getName(), attribute.getNodeValue());
- }
- return answer;
- }
-
- /**
- * Parses attribute names and values as being bean property expressions
- */
- protected void addAttributeProperties(BeanDefinitionHolder definition, MappingMetaData metadata, String className,
- Element element) {
- NamedNodeMap attributes = element.getAttributes();
- // First pass on attributes with no namespaces
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- String localName = attribute.getLocalName();
- // Skip namespaces
- if (localName == null || localName.equals("xmlns") || localName.startsWith("xmlns:")) {
- continue;
- }
- // Add attributes with no namespaces
- if (isEmpty(uri) && !localName.equals("class")) {
- boolean addProperty = true;
- if (reservedBeanAttributeNames.contains(localName)) {
- // should we allow the property to shine through?
- PropertyDescriptor descriptor = getPropertyDescriptor(className, localName);
- addProperty = descriptor != null;
- }
- if (addProperty) {
- addAttributeProperty(definition, metadata, element, attribute);
- }
- }
- }
- // Second pass on attributes with namespaces
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- String localName = attribute.getLocalName();
- // Skip namespaces
- if (localName == null || localName.equals("xmlns") || localName.startsWith("xmlns:")) {
- continue;
- }
- // Add attributs with namespaces matching the element ns
- if (!isEmpty(uri) && uri.equals(element.getNamespaceURI())) {
- boolean addProperty = true;
- if (reservedBeanAttributeNames.contains(localName)) {
- // should we allow the property to shine through?
- PropertyDescriptor descriptor = getPropertyDescriptor(className, localName);
- addProperty = descriptor != null;
- }
- if (addProperty) {
- addAttributeProperty(definition, metadata, element, attribute);
- }
- }
- }
- }
-
- protected void addContentProperty(BeanDefinitionHolder definition, MappingMetaData metadata, Element element) {
- String name = metadata.getContentProperty(getLocalName(element));
- if (name != null) {
- String value = getElementText(element);
- addProperty(definition, metadata, element, name, value);
- }
- else {
- // lets stry parse a nested properties file
- NodeList childNodes = element.getChildNodes();
- if (childNodes.getLength() == 1 && childNodes.item(0) instanceof Text) {
- Text text = (Text) childNodes.item(0);
- ByteArrayInputStream in = new ByteArrayInputStream(text.getData().getBytes());
- Properties properties = new Properties();
- try {
- properties.load(in);
- }
- catch (IOException e) {
- return;
- }
- Enumeration enumeration = properties.propertyNames();
- while (enumeration.hasMoreElements()) {
- name = (String) enumeration.nextElement();
- Object value = properties.getProperty(name);
- definition.getBeanDefinition().getPropertyValues().addPropertyValue(name, value);
- }
- }
- }
- }
-
- protected void addAttributeProperty(BeanDefinitionHolder definition, MappingMetaData metadata, Element element,
- Attr attribute) {
- String localName = attribute.getLocalName();
- String value = attribute.getValue();
- addProperty(definition, metadata, element, localName, value);
- }
-
- /**
- * Add a property onto the current BeanDefinition.
- */
- protected void addProperty(BeanDefinitionHolder definition, MappingMetaData metadata, Element element,
- String localName, String value) {
- String propertyName = metadata.getPropertyName(getLocalName(element), localName);
- if (propertyName != null) {
- QNameHelper.addPropertyValue(
- definition.getBeanDefinition().getPropertyValues(),
- propertyName,
- getValue(value));
- }
- }
-
- protected Object getValue(String value) {
- if (value == null) return null;
-
- boolean reference = false;
- if (value.startsWith(BEAN_REFERENCE_PREFIX)) {
- value = value.substring(BEAN_REFERENCE_PREFIX.length());
-
- // we could be an escaped string
- if (!value.startsWith(BEAN_REFERENCE_PREFIX)) {
- reference = true;
- }
- }
-
- if (reference) {
- // TOOD handle custom reference types like local or queries etc
- return new RuntimeBeanReference(value);
- }
- else {
- return value;
- }
- }
-
- protected String getLocalName(Element element) {
- String localName = element.getLocalName();
- if (localName == null) {
- localName = element.getNodeName();
- }
- return localName;
- }
-
- /**
- * Lets iterate through the children of this element and create any nested
- * child properties
- */
- protected void addNestedPropertyElements(BeanDefinitionHolder definition, MappingMetaData metadata,
- String className, Element element) {
- NodeList nl = element.getChildNodes();
-
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element childElement = (Element) node;
- String uri = childElement.getNamespaceURI();
- String localName = childElement.getLocalName();
-
- if (!isEmpty(uri) || !reservedElementNames.contains(localName)) {
- // we could be one of the following
- // * the child element maps to a <property> tag with inner
- // tags being the bean
- // * the child element maps to a <property><list> tag with
- // inner tags being the contents of the list
- // * the child element maps to a <property> tag and is the
- // bean tag too
- // * the child element maps to a <property> tag and is a simple
- // type (String, Class, int, etc).
- Object value = null;
- String propertyName = metadata.getNestedListProperty(getLocalName(element), localName);
- if (propertyName != null) {
- value = parseListElement(childElement, propertyName);
- }
- else {
- propertyName = metadata.getFlatCollectionProperty(getLocalName(element), localName);
- if (propertyName != null) {
- Object def = parseBeanFromExtensionElement(childElement);
- PropertyValue pv = definition.getBeanDefinition().getPropertyValues().getPropertyValue(propertyName);
- if (pv != null) {
- Collection l = (Collection) pv.getValue();
- l.add(def);
- continue;
- } else {
- ManagedList l = new ManagedList();
- l.add(def);
- value = l;
- }
- } else {
- propertyName = metadata.getNestedProperty(getLocalName(element), localName);
- if (propertyName != null) {
- // lets find the first child bean that parses fine
- value = parseChildExtensionBean(childElement);
- }
- }
- }
-
- if (propertyName == null && metadata.isFlatProperty(getLocalName(element), localName)) {
- value = parseBeanFromExtensionElement(childElement, className, localName);
- propertyName = localName;
- }
-
- if (propertyName == null) {
- value = tryParseNestedPropertyViaIntrospection(metadata, className, childElement);
- propertyName = localName;
- }
-
- if (value != null) {
- QNameHelper.addPropertyValue(
- definition.getBeanDefinition().getPropertyValues(),
- propertyName,
- value);
- }
- else
- {
- /**
- * In this case there is no nested property, so just do a normal
- * addProperty like we do with attributes.
- */
- String text = getElementText(childElement);
-
- if (text != null) {
- addProperty(definition, metadata, element, localName, text);
- }
- }
- }
- }
- }
- }
-
- /**
- * Attempts to use introspection to parse the nested property element.
- */
- protected Object tryParseNestedPropertyViaIntrospection(MappingMetaData metadata, String className, Element element) {
- String localName = getLocalName(element);
- PropertyDescriptor descriptor = getPropertyDescriptor(className, localName);
- if (descriptor != null) {
- return parseNestedPropertyViaIntrospection(metadata, className, element, descriptor);
- }
- return null;
- }
-
- /**
- * Any namespace aware property values (such as QNames) need to be coerced
- * while we still have access to the XML Element from which its value comes -
- * so lets do that now before we trash the DOM and just have the bean
- * definition.
- */
- protected void coerceNamespaceAwarePropertyValues(BeanDefinitionHolder definitionHolder, Element element) {
- BeanDefinition definition = definitionHolder.getBeanDefinition();
- if (definition instanceof AbstractBeanDefinition && isQnameIsOnClassPath()) {
- AbstractBeanDefinition bd = (AbstractBeanDefinition) definition;
- // lets check for any QName types
- BeanInfo beanInfo = getBeanInfo(bd.getBeanClassName());
- if (beanInfo != null) {
- PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- QNameReflectionHelper.coerceNamespaceAwarePropertyValues(bd, element, descriptors, i);
- }
- }
- }
- }
-
-
- protected boolean isQnameIsOnClassPath() {
- if (initQNameOnClassPath == false) {
- qnameIsOnClassPath = PropertyEditorHelper.loadClass("javax.xml.namespace.QName") != null;
- initQNameOnClassPath = true;
- }
- return qnameIsOnClassPath;
- }
-
- protected BeanInfo getBeanInfo(String className) throws BeanDefinitionStoreException {
- if (className == null) {
- return null;
- }
-
- BeanInfo info = null;
- Class type = null;
- try {
- type = loadClass(className);
- }
- catch (ClassNotFoundException e) {
- throw new BeanDefinitionStoreException("Failed to load type: " + className + ". Reason: " + e, e);
- }
- try {
- info = Introspector.getBeanInfo(type);
- }
- catch (IntrospectionException e) {
- throw new BeanDefinitionStoreException("Failed to introspect type: " + className + ". Reason: " + e, e);
- }
- return info;
- }
-
- /**
- * Looks up the property decriptor for the given class and property name
- */
- protected PropertyDescriptor getPropertyDescriptor(String className, String localName) {
- BeanInfo beanInfo = getBeanInfo(className);
- if (beanInfo != null) {
- PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- PropertyDescriptor descriptor = descriptors[i];
- String name = descriptor.getName();
- if (name.equals(localName)) {
- return descriptor;
- }
- }
- }
- return null;
- }
-
- /**
- * Attempts to use introspection to parse the nested property element.
- */
- protected Object parseNestedPropertyViaIntrospection(MappingMetaData metadata, String className, Element element,
- PropertyDescriptor descriptor) {
- String name = descriptor.getName();
- if (isMap(descriptor.getPropertyType())) {
- return parseCustomMapElement(metadata, element, name);
- }
- else if (isCollection(descriptor.getPropertyType())) {
- return parseListElement(element, name);
- }
- else {
- return parseChildExtensionBean(element);
- }
- }
-
- protected Object parseCustomMapElement(MappingMetaData metadata, Element element, String name) {
- Map map = new HashMap();
-
- Element parent = (Element) element.getParentNode();
- String entryName = metadata.getMapEntryName(getLocalName(parent), name);
- String keyName = metadata.getMapKeyName(getLocalName(parent), name);
-
- if (entryName == null) entryName = "property";
- if (keyName == null) keyName = "key";
-
- // TODO : support further customizations
- //String valueName = "value";
- //boolean keyIsAttr = true;
- //boolean valueIsAttr = false;
- NodeList nl = element.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element childElement = (Element) node;
-
- String localName = childElement.getLocalName();
- String uri = childElement.getNamespaceURI();
- if (localName == null || localName.equals("xmlns") || localName.startsWith("xmlns:")) {
- continue;
- }
-
- // we could use namespaced attributes to differentiate real spring
- // attributes from namespace-specific attributes
- if (!isEmpty(uri) && localName.equals(entryName)) {
- String key = childElement.getAttribute(keyName);
- if (key == null) throw new RuntimeException("No key defined for map " + entryName);
-
- Object keyValue = getValue(key);
-
- Object value = getValue(getElementText(childElement));
-
- map.put(keyValue, value);
- }
- }
- }
- return map;
- }
-
- protected boolean isMap(Class type) {
- return Map.class.isAssignableFrom(type);
- }
-
- /**
- * Returns true if the given type is a collection type or an array
- */
- protected boolean isCollection(Class type) {
- return type.isArray() || Collection.class.isAssignableFrom(type);
- }
-
- /**
- * Iterates the children of this element to find the first nested bean
- */
- protected Object parseChildExtensionBean(Element element) {
- NodeList nl = element.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element childElement = (Element) node;
- String uri = childElement.getNamespaceURI();
- String localName = childElement.getLocalName();
-
- if (uri == null || uri.equals(SPRING_SCHEMA) || uri.equals(SPRING_SCHEMA_COMPAT)) {
- if (BEAN_ELEMENT.equals(localName)) {
- return parseBeanDefinitionElement(childElement, true);
- }
- } else {
- Object value = parseBeanFromExtensionElement(childElement);
- if (value != null) {
- return value;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Uses META-INF/services discovery to find a Properties file with the XML
- * marshaling configuration
- *
- * @param namespaceURI
- * the namespace URI of the element
- * @param localName
- * the local name of the element
- * @return the properties configuration of the namespace or null if none
- * could be found
- */
- protected MappingMetaData findNamespaceProperties(String namespaceURI, String localName) {
- // lets look for the magic prefix
- if (namespaceURI != null && namespaceURI.startsWith(JAVA_PACKAGE_PREFIX)) {
- String packageName = namespaceURI.substring(JAVA_PACKAGE_PREFIX.length());
- return new MappingMetaData(packageName);
- }
-
- String uri = NamespaceHelper.createDiscoveryPathName(namespaceURI, localName);
- InputStream in = loadResource(uri);
- if (in == null) {
- if (namespaceURI != null && namespaceURI.length() > 0) {
- uri = NamespaceHelper.createDiscoveryPathName(namespaceURI);
- in = loadResource(uri);
- if (in == null) {
- uri = NamespaceHelper.createDiscoveryOldPathName(namespaceURI);
- in = loadResource(uri);
- }
- }
- }
-
- if (in != null) {
- try {
- Properties properties = new Properties();
- properties.load(in);
- return new MappingMetaData(properties);
- }
- catch (IOException e) {
- log.warn("Failed to load resource from uri: " + uri, e);
- }
- }
- return null;
- }
-
- /**
- * Loads the resource from the given URI
- */
- protected InputStream loadResource(String uri) {
- // lets try the thread context class loader first
- InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri);
- if (in == null) {
- in = getClass().getClassLoader().getResourceAsStream(uri);
- if (in == null) {
- logger.debug("Could not find resource: " + uri);
- }
- }
- return in;
- }
-
- /**
- * Attempts to load the class on the current thread context class loader or
- * the class loader which loaded us
- */
- protected Class loadClass(String name) throws ClassNotFoundException {
- ClassLoader beanClassLoader = getBeanDefinitionReader().getBeanClassLoader();
- if (beanClassLoader != null) {
- try {
- return beanClassLoader.loadClass(name);
- }
- catch (ClassNotFoundException e) {
- }
- }
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- if (contextClassLoader != null) {
- try {
- return contextClassLoader.loadClass(name);
- }
- catch (ClassNotFoundException e) {
- }
- }
- return getClass().getClassLoader().loadClass(name);
- }
-
- protected boolean isEmpty(String uri) {
- return uri == null || uri.length() == 0;
- }
-
- protected void declareLifecycleMethods(BeanDefinitionHolder definitionHolder, MappingMetaData metaData,
- Element element) {
- BeanDefinition definition = definitionHolder.getBeanDefinition();
- if (definition instanceof AbstractBeanDefinition) {
- AbstractBeanDefinition beanDefinition = (AbstractBeanDefinition) definition;
- if (beanDefinition.getInitMethodName() == null) {
- beanDefinition.setInitMethodName(metaData.getInitMethodName(getLocalName(element)));
- }
- if (beanDefinition.getDestroyMethodName() == null) {
- beanDefinition.setDestroyMethodName(metaData.getDestroyMethodName(getLocalName(element)));
- }
- if (beanDefinition.getFactoryMethodName() == null) {
- beanDefinition.setFactoryMethodName(metaData.getFactoryMethodName(getLocalName(element)));
- }
- }
- }
-
- // -------------------------------------------------------------------------
- //
- // TODO we could apply the following patches into the Spring code -
- // though who knows if it'll ever make it into a release! :)
- //
- // -------------------------------------------------------------------------
- protected int parseBeanDefinitions(Element root) throws BeanDefinitionStoreException {
- int beanDefinitionCount = 0;
- if (isEmpty(root.getNamespaceURI()) || root.getLocalName().equals("beans")) {
- NodeList nl = root.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element ele = (Element) node;
- if (IMPORT_ELEMENT.equals(node.getNodeName())) {
- importBeanDefinitionResource(ele);
- }
- else if (ALIAS_ELEMENT.equals(node.getNodeName())) {
- String name = ele.getAttribute(NAME_ATTRIBUTE);
- String alias = ele.getAttribute(ALIAS_ATTRIBUTE);
- getBeanDefinitionReader().getBeanFactory().registerAlias(name, alias);
- }
- else if (BEAN_ELEMENT.equals(node.getNodeName())) {
- beanDefinitionCount++;
- BeanDefinitionHolder bdHolder = parseBeanDefinitionElement(ele, false);
- BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
- .getBeanFactory());
- }
- else {
- BeanDefinitionHolder bdHolder = parseBeanFromExtensionElement(ele);
- if (bdHolder != null) {
- beanDefinitionCount++;
- BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
- .getBeanFactory());
- }
- else {
- log.debug("Ignoring unknown element namespace: " + ele.getNamespaceURI() + " localName: "
- + ele.getLocalName());
- }
- }
- }
- }
- } else {
- BeanDefinitionHolder bdHolder = parseBeanFromExtensionElement(root);
- if (bdHolder != null) {
- beanDefinitionCount++;
- BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
- .getBeanFactory());
- }
- else {
- log.debug("Ignoring unknown element namespace: " + root.getNamespaceURI() + " localName: " + root.getLocalName());
- }
- }
- return beanDefinitionCount;
- }
-
- protected BeanDefinitionHolder parseBeanDefinitionElement(Element ele, boolean isInnerBean) throws BeanDefinitionStoreException {
- BeanDefinitionHolder bdh = super.parseBeanDefinitionElement(ele, isInnerBean);
- coerceNamespaceAwarePropertyValues(bdh, ele);
- return bdh;
- }
-
- protected Object parsePropertySubElement(Element element, String beanName) throws BeanDefinitionStoreException {
- String uri = element.getNamespaceURI();
- String localName = getLocalName(element);
-
- if ((!isEmpty(uri) && !(uri.equals(SPRING_SCHEMA) || uri.equals(SPRING_SCHEMA_COMPAT)))
- || !reservedElementNames.contains(localName)) {
- Object answer = parseBeanFromExtensionElement(element);
- if (answer != null) {
- return answer;
- }
- }
- if (QNAME_ELEMENT.equals(localName) && isQnameIsOnClassPath()) {
- Object answer = parseQNameElement(element);
- if (answer != null) {
- return answer;
- }
- }
- return super.parsePropertySubElement(element, beanName);
- }
-
- protected Object parseQNameElement(Element element) {
- return QNameReflectionHelper.createQName(element, getElementText(element));
- }
-
- /**
- * Returns the text of the element
- */
- protected String getElementText(Element element) {
- StringBuffer buffer = new StringBuffer();
- NodeList nodeList = element.getChildNodes();
- for (int i = 0, size = nodeList.getLength(); i < size; i++) {
- Node node = nodeList.item(i);
- if (node.getNodeType() == Node.TEXT_NODE) {
- buffer.append(node.getNodeValue());
- }
- }
- return buffer.toString();
- }
-}
diff --git a/trunk/xbean-spring-v1/src/main/java/org/apache/xbean/spring/context/v1/XBeanXmlBeanDefinitionReader.java b/trunk/xbean-spring-v1/src/main/java/org/apache/xbean/spring/context/v1/XBeanXmlBeanDefinitionReader.java
deleted file mode 100644
index d8cb1ce..0000000
--- a/trunk/xbean-spring-v1/src/main/java/org/apache/xbean/spring/context/v1/XBeanXmlBeanDefinitionReader.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.v1;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.xml.ResourceEntityResolver;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.core.io.Resource;
-import org.w3c.dom.Document;
-import org.apache.xbean.spring.context.SpringApplicationContext;
-import org.apache.xbean.spring.context.SpringXmlPreprocessor;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * XBeanXmlBeanDefinitionReader extends XmlBeanDefinitionReader adds support for SpringXMLPreprocessors which can
- * modify the DOM before it is passed to Spring for reading. This allows for extra information to be added into the
- * Spring configuration file that is processed and removed before Spring sees the xml.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class XBeanXmlBeanDefinitionReader extends XmlBeanDefinitionReader {
- private final SpringApplicationContext applicationContext;
- private final List xmlPreprocessors;
-
- /**
- * Creates a XBeanXmlBeanDefinitionReader for the specified applicationContext and beanFactory which will apply
- * the xmlPreprocessors before passing the DOM to Spring for processing.
- * @param applicationContext the application context for which the bean definitons will be loaded
- * @param beanFactory the beanFactory that services will be loaded
- * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
- */
- public XBeanXmlBeanDefinitionReader(SpringApplicationContext applicationContext, BeanDefinitionRegistry beanFactory, List xmlPreprocessors) {
- super(beanFactory);
- this.applicationContext = applicationContext;
- this.xmlPreprocessors = xmlPreprocessors;
- setValidating(false);
- setNamespaceAware(true);
- setParserClass(XBeanXmlBeanDefinitionParser.class);
-
- setResourceLoader(applicationContext);
- setEntityResolver(new ResourceEntityResolver(applicationContext));
- }
-
- /**
- * Gets the application context for which the bean definitons will be loaded.
- * @return the application context for which the bean definitons will be loaded
- */
- public ApplicationContext getApplicationContext() {
- return applicationContext;
- }
-
- /**
- * {@inheritDoc}
- */
- public int registerBeanDefinitions(Document doc, Resource resource) throws BeansException {
- preprocess(doc);
- XBeanXmlBeanDefinitionParser parser = new XBeanXmlBeanDefinitionParser();
- return parser.registerBeanDefinitions(this, doc, resource);
- }
-
- private void preprocess(Document doc) {
- for (Iterator iterator = xmlPreprocessors.iterator(); iterator.hasNext();) {
- SpringXmlPreprocessor preprocessor = (SpringXmlPreprocessor) iterator.next();
- preprocessor.preprocess(applicationContext, this, doc);
- }
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/main/java/org/apache/xbean/spring/context/v1/XBeanXmlBeanFactory.java b/trunk/xbean-spring-v1/src/main/java/org/apache/xbean/spring/context/v1/XBeanXmlBeanFactory.java
deleted file mode 100644
index 9c24660..0000000
--- a/trunk/xbean-spring-v1/src/main/java/org/apache/xbean/spring/context/v1/XBeanXmlBeanFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.v1;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.core.io.Resource;
-
-import java.util.Collections;
-import java.util.List;
-
-public class XBeanXmlBeanFactory extends DefaultListableBeanFactory {
-
- /**
- * Create a new XBeanXmlBeanFactory with the given resource,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource) throws BeansException {
- this(resource, null, Collections.EMPTY_LIST);
- }
-
- /**
- * Create a new XBeanXmlBeanFactory with the given input stream,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @param parentBeanFactory parent bean factory
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory) throws BeansException {
- this(resource, parentBeanFactory, Collections.EMPTY_LIST);
- }
-
- /**
- * Create a new XBeanXmlBeanFactory with the given input stream,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource, List xmlPreprocessors) throws BeansException {
- this(resource, null, xmlPreprocessors);
- }
-
- /**
- * Create a new XBeanXmlBeanFactory with the given input stream,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @param parentBeanFactory parent bean factory
- * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory, List xmlPreprocessors) throws BeansException {
- super(parentBeanFactory);
- XBeanXmlBeanDefinitionReader reader = new XBeanXmlBeanDefinitionReader(null, this, xmlPreprocessors);
- reader.loadBeanDefinitions(resource);
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/main/resources/META-INF/LICENSE b/trunk/xbean-spring-v1/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-spring-v1/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-spring-v1/src/main/resources/META-INF/NOTICE b/trunk/xbean-spring-v1/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-spring-v1/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BadAttributeTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BadAttributeTest.java
deleted file mode 100644
index f21e026..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BadAttributeTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import junit.framework.TestCase;
-
-/**
- * @author Guillaume Nodet
- * @version $Id$
- * @since 2.3
- */
-public class BadAttributeTest extends TestCase {
-
- public void testBadNs() throws Exception {
- try {
- new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/bad-attribute.xml");
- fail("This should have thrown an exception");
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BadElementTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BadElementTest.java
deleted file mode 100644
index dde11b1..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BadElementTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import junit.framework.TestCase;
-
-/**
- * @author Guillaume Nodet
- * @version $Id$
- * @since 2.3
- */
-public class BadElementTest extends TestCase {
-
- public void testBadNs() throws Exception {
- try {
- new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/bad-element.xml");
- fail("This should have thrown an exception");
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BadNamespaceTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BadNamespaceTest.java
deleted file mode 100644
index 339d388..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BadNamespaceTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import junit.framework.TestCase;
-
-/**
- * @author Guillaume Nodet
- * @version $Id$
- * @since 2.3
- */
-public class BadNamespaceTest extends TestCase {
-
- public void testBadNs() throws Exception {
- try {
- new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/bad-namespace.xml");
- fail("This should have thrown an exception");
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingSpringTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingSpringTest.java
deleted file mode 100644
index 06afa3f..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingSpringTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.BeerService;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 1.0
- */
-public class BeerUsingSpringTest extends SpringTestSupport {
-
- public void testBeer() throws Exception {
- BeerService soup = (BeerService) getBean("beerService");
-
- assertEquals("name", "Stella", soup.getName());
- assertEquals("id", "123", soup.getId());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/beer-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanNSTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanNSTest.java
deleted file mode 100644
index ab2a814..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanNSTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author Guillaume Nodet
- * @version $Id$
- * @since 2.2
- */
-public class BeerUsingXBeanNSTest extends BeerUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/beer-xbean-ns.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanSystemPropTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanSystemPropTest.java
deleted file mode 100644
index e1f6198..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanSystemPropTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author Hiram Chirino
- * @version $Id$
- * @since 2.0
- */
-public class BeerUsingXBeanSystemPropTest extends BeerUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- ClassPathXmlApplicationContext rc = new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/beer-xbean-system-prop.xml");
-//
-// PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
-// cfg.postProcessBeanFactory(rc.getBeanFactory());
-//
- return rc;
- }
-
- protected void setUp() throws Exception {
- System.setProperty("beerType", "Stella");
- super.setUp();
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanTest.java
deleted file mode 100644
index 0993174..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class BeerUsingXBeanTest extends BeerUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/beer-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/FavoriteUsingSpringTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/FavoriteUsingSpringTest.java
deleted file mode 100644
index 2290867..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/FavoriteUsingSpringTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import java.util.Map;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.FavoriteService;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 1.0
- */
-public class FavoriteUsingSpringTest extends SpringTestSupport {
-
- public void testFavs() throws Exception {
- FavoriteService fs = (FavoriteService) getBean("favoriteService");
-
- Map favorites = fs.getFavorites();
- assertNotNull(favorites);
- assertEquals(1, favorites.size());
-
- assertEquals("Grey Goose", favorites.get("Dan"));
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/favorite-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/FavoriteUsingXBeanTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/FavoriteUsingXBeanTest.java
deleted file mode 100644
index 5a84683..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/FavoriteUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class FavoriteUsingXBeanTest extends FavoriteUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/favorite-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/GinUsingSpringTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/GinUsingSpringTest.java
deleted file mode 100644
index 8f65ce2..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/GinUsingSpringTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.GinService;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 1.0
- */
-public class GinUsingSpringTest extends SpringTestSupport {
-
- public void testWine() throws Exception {
- GinService service = (GinService) getBean("ginService");
-
- assertEquals("name", "Bombay Sapphire", service.getName());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/gin.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingSpringTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingSpringTest.java
deleted file mode 100644
index 8cae8ad..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingSpringTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.PizzaService;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class PizzaUsingSpringTest extends SpringTestSupport {
-
- public void testPizza() throws Exception {
- PizzaService pizza = (PizzaService) getBean("pizzaService");
- pizza.makePizza();
-
- assertEquals("topping", "Salami", pizza.getTopping());
- assertEquals("cheese", "Edam", pizza.getCheese());
- assertEquals("size", 17, pizza.getSize());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanTest.java
deleted file mode 100644
index 7308dea..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class PizzaUsingXBeanTest extends PizzaUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWinBeanRefTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWinBeanRefTest.java
deleted file mode 100644
index 78b1dbd..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWinBeanRefTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.PizzaService;
-
-/**
- *
- * @version $Revision: 1.1 $
- */
-public class PizzaUsingXBeanWinBeanRefTest extends PizzaUsingSpringTest {
-
- public void testPizza() throws Exception {
- PizzaService pizza = (PizzaService) getBean("pizzaService");
- pizza.makePizza();
-
- assertEquals("topping", "Salami", pizza.getTopping());
- assertEquals("cheese", "#Edam", pizza.getCheese());
- assertEquals("size", 17, pizza.getSize());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean-bean-ref.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithJavaNamespaceTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithJavaNamespaceTest.java
deleted file mode 100644
index b4b281b..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithJavaNamespaceTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class PizzaUsingXBeanWithJavaNamespaceTest extends PizzaUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean-java.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithPropertiesTextNodeTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithPropertiesTextNodeTest.java
deleted file mode 100644
index ee621fc..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithPropertiesTextNodeTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- * Copyright 2005 David Blevins
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- *
- * @version $Revision: 1.1 $
- */
-public class PizzaUsingXBeanWithPropertiesTextNodeTest extends PizzaUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean-properties.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/QNameUsingSpringTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/QNameUsingSpringTest.java
deleted file mode 100644
index bca9f8c..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/QNameUsingSpringTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xbean.spring.example.QNameService;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-public class QNameUsingSpringTest extends SpringTestSupport {
-
- public void testQName() throws Exception {
- QNameService svc = (QNameService) getBean("qnameService");
-
- QName[] services = svc.getServices();
- assertNotNull(services);
- assertEquals(2, services.length);
- assertEquals(new QName("urn:foo", "test"), services[0]);
- assertEquals(new QName("urn:foo", "bar"), services[1]);
-
- List list = svc.getList();
- assertNotNull(list);
- assertEquals(1, list.size());
- assertEquals(new QName("urn:foo", "list"), list.get(0));
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/qname-normal.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/QNameUsingXBeanTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/QNameUsingXBeanTest.java
deleted file mode 100644
index a0c6e75..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/QNameUsingXBeanTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-public class QNameUsingXBeanTest extends QNameUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/qname-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RecipeUsingSpringTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RecipeUsingSpringTest.java
deleted file mode 100644
index 3b9a2e8..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RecipeUsingSpringTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import java.util.List;
-
-import org.apache.xbean.spring.example.Recipe;
-import org.apache.xbean.spring.example.RecipeService;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-public class RecipeUsingSpringTest extends SpringTestSupport {
-
- public void testRecipes() throws Exception {
- RecipeService svc = (RecipeService) getBean("recipeService");
-
- List list = svc.getRecipes();
- assertNotNull(list);
- assertEquals(2, list.size());
- Recipe r = (Recipe) list.get(0);
- assertEquals("Food", r.getIngredients());
- assertEquals("Mash together", r.getInstructions());
-
- r = (Recipe) list.get(1);
- assertEquals("Food", r.getIngredients());
- assertEquals("Mash together", r.getInstructions());
-
- assertNotNull(svc.getTopRecipe());
- assertEquals("Food", svc.getTopRecipe().getIngredients());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/recipe-normal.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RecipeUsingXBeanTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RecipeUsingXBeanTest.java
deleted file mode 100644
index 6267707..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RecipeUsingXBeanTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-public class RecipeUsingXBeanTest extends RecipeUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/recipe-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingResourceXmlApplicationContextTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingResourceXmlApplicationContextTest.java
deleted file mode 100644
index 8d2c5d1..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingResourceXmlApplicationContextTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingResourceXmlApplicationContextTest extends RestaurantUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ResourceXmlApplicationContext(new ClassPathResource("org/apache/xbean/spring/context/restaurant-xbean.xml"));
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringExtendedTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringExtendedTest.java
deleted file mode 100644
index cd3d4d9..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringExtendedTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-import java.util.List;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingSpringExtendedTest extends RestaurantUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-spring-extended.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringTest.java
deleted file mode 100644
index b8c60aa..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.PizzaService;
-import org.apache.xbean.spring.example.RestaurantService;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingSpringTest extends SpringTestSupport {
-
- public void testPizza() throws Exception {
- RestaurantService restaurant = (RestaurantService) getBean("restaurant");
-
- QName service = restaurant.getServiceName();
- assertEquals(new QName("http://acme.com", "xyz"), service);
-
- // dinners (1-many using list)
- List dinners = restaurant.getDinnerMenu();
- assertNotNull("dinners is null!", dinners);
- assertEquals("dinners size: " + dinners, 2, dinners.size());
-
- PizzaService pizza = (PizzaService) dinners.get(0);
- assertEquals("topping", "Ham", pizza.getTopping());
- assertEquals("cheese", "Mozzarella", pizza.getCheese());
- assertEquals("size", 15, pizza.getSize());
-
- pizza = (PizzaService) dinners.get(1);
- assertEquals("topping", "Eggs", pizza.getTopping());
- assertEquals("cheese", "Mozzarella", pizza.getCheese());
- assertEquals("size", 16, pizza.getSize());
-
- // lunches (1-many using array)
- PizzaService[] lunches = restaurant.getLunchMenu();
- assertNotNull("lunches is null!", lunches);
- assertEquals("lunches size: " + lunches, 1, lunches.length);
-
- pizza = lunches[0];
- assertEquals("topping", "Chicken", pizza.getTopping());
- assertEquals("cheese", "Brie", pizza.getCheese());
- assertEquals("size", 17, pizza.getSize());
-
-
- // favourite (1-1)
- pizza = restaurant.getFavourite();
- assertNotNull("Pizza is null!", pizza);
- pizza.makePizza();
-
- assertEquals("topping", "Salami", pizza.getTopping());
- assertEquals("cheese", "Edam", pizza.getCheese());
- assertEquals("size", 17, pizza.getSize());
-
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanAsRootTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanAsRootTest.java
deleted file mode 100644
index a5b56db..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanAsRootTest.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-public class RestaurantUsingXBeanAsRootTest extends RestaurantUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean-root.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanMixedTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanMixedTest.java
deleted file mode 100644
index ba2bb2b..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanMixedTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingXBeanMixedTest extends RestaurantUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean-mixed.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java
deleted file mode 100644
index 31e0bb6..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.RestaurantService;
-
-import javax.xml.namespace.QName;
-
-import java.net.URI;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingXBeanTest extends RestaurantUsingSpringTest {
- private static final Log log = LogFactory.getLog(RestaurantUsingXBeanTest.class);
-
- public void testPizza() throws Exception {
- super.testPizza();
-
- RestaurantService restaurant = (RestaurantService) getBean("restaurant");
- QName name = restaurant.getServiceName();
- assertNotNull("Name is null", name);
-
- assertEquals("Namespace URI", "http://acme.com", name.getNamespaceURI());
- assertEquals("localName", "xyz", name.getLocalPart());
- assertEquals("prefix", "foo", name.getPrefix());
-
- log.info("Successfully converted the property to a QName: " + name);
-
- URI uri = restaurant.getUri();
- assertNotNull("URI is null", uri);
- assertEquals("URI", new URI("http://cheese.com"), uri);
-
- log.info("Successfully converted the property to a URI: " + uri);
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanWithSimplerConfigTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanWithSimplerConfigTest.java
deleted file mode 100644
index ab47d5e..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanWithSimplerConfigTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingXBeanWithSimplerConfigTest extends RestaurantUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SaladUsingSpringTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SaladUsingSpringTest.java
deleted file mode 100644
index bd6934b..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SaladUsingSpringTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.SaladService;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class SaladUsingSpringTest extends SpringTestSupport {
- public void testSalad() throws Exception {
- SaladService salad = (SaladService) getBean("saladService");
-
- assertEquals("dressing", "Cesar", salad.getDressing());
- assertEquals("size", "Small", salad.getSize());
- assertEquals("crouton", true, salad.isCrouton());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/salad-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SaladUsingXBeanTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SaladUsingXBeanTest.java
deleted file mode 100644
index f92ffeb..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SaladUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class SaladUsingXBeanTest extends SaladUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/salad-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SoupUsingSpringTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SoupUsingSpringTest.java
deleted file mode 100644
index 89ffa98..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SoupUsingSpringTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.SoupService;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class SoupUsingSpringTest extends SpringTestSupport {
- private static final long time = System.currentTimeMillis();
-
- public void testSoup() throws Exception {
- SoupService soup = (SoupService) getBean("soupService");
-
- assertEquals("type", "French Onion", soup.getType());
- assertTrue(soup.getCreateTime() >= time);
- assertTrue(soup.exists());
-
- context.close();
- assertFalse(soup.exists());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/soup-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SoupUsingXBeanTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SoupUsingXBeanTest.java
deleted file mode 100644
index ecbf24d..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SoupUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class SoupUsingXBeanTest extends SoupUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/soup-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SpringTestSupport.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SpringTestSupport.java
deleted file mode 100644
index f57ea50..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/SpringTestSupport.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-import junit.framework.TestCase;
-
-/**
- * A useful base class for testing spring based utilities.
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public abstract class SpringTestSupport extends TestCase {
- protected transient Log log = LogFactory.getLog(getClass());
-
- protected AbstractXmlApplicationContext context;
-
- protected void setUp() throws Exception {
- context = createApplicationContext();
- assertNotNull("ApplicationContext is null!", context);
- }
-
- protected void tearDown() throws Exception {
- if (context != null) {
- log.info("Closing down the spring context");
- context.destroy();
- }
- }
-
- protected Object getBean(String name) {
- Object answer = answer = context.getBean(name);
- assertNotNull("Could not find object in Spring for key: " + name, answer);
- return answer;
- }
-
- protected abstract AbstractXmlApplicationContext createApplicationContext();
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/VodkaUsingSpringTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/VodkaUsingSpringTest.java
deleted file mode 100644
index 3680bc4..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/VodkaUsingSpringTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.VodkaService;
-
-/**
- * @author Dan Diephouse
- * @version $Id$
- * @since 1.0
- */
-public class VodkaUsingSpringTest extends SpringTestSupport {
-
- public void testWine() throws Exception {
- VodkaService vodka = (VodkaService) getBean("vodkaService");
-
- assertEquals("name", "Grey Goose", vodka.getName());
- assertEquals("id", "vodkaService", vodka.getId());
-
- // Test more complex classes
- assertEquals("class", VodkaService.class, vodka.getClass());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/vodka-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/VodkaUsingXBeanTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/VodkaUsingXBeanTest.java
deleted file mode 100644
index 3d0c229..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/VodkaUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class VodkaUsingXBeanTest extends VodkaUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/vodka-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/WineUsingSpringTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/WineUsingSpringTest.java
deleted file mode 100644
index d89f0d5..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/WineUsingSpringTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.WineService;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 1.0
- */
-public class WineUsingSpringTest extends SpringTestSupport {
-
- public void testWine() throws Exception {
- WineService soup = (WineService) getBean("wineService");
-
- assertEquals("name", "Amarone", soup.getName());
- assertEquals("id", "wineService", soup.getId());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/wine-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/WineUsingXBeanTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/WineUsingXBeanTest.java
deleted file mode 100644
index 4257618..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/WineUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class WineUsingXBeanTest extends WineUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/wine-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/impl/NamedConstructorArgsTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/impl/NamedConstructorArgsTest.java
deleted file mode 100644
index 1d8105e..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/context/impl/NamedConstructorArgsTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.impl;
-
-import java.io.ByteArrayInputStream;
-import java.lang.reflect.Constructor;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Arrays;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class NamedConstructorArgsTest extends TestCase {
- private Properties properties = new Properties();
-
- public void testPropertyParsing() {
- assertEquals("bar", properties.getProperty("foo"));
- assertEquals("blah", properties.getProperty("foo,chese"));
- assertEquals("StringBuffer", properties.getProperty("java.lang.String(java.lang.StringBuffer)"));
- assertEquals("char[]", properties.getProperty("java.lang.String([C)"));
- assertEquals("byte[],int,int", properties.getProperty("java.lang.String([B,int,int)"));
- assertEquals("URL[],ClassLoader", properties.getProperty("java.net.URLClassLoader([Ljava.net.URL;,java.lang.ClassLoader)"));
- }
-
- public void testMappingMetaData() throws Exception {
- MappingMetaData mappingMetaData = new MappingMetaData(properties);
- Constructor constructor = URLClassLoader.class.getConstructor(new Class[] { URL[].class, ClassLoader.class});
- assertTrue(mappingMetaData.isDefaultConstructor(constructor));
- assertEquals(Arrays.asList(new String[] { "urls", "parent" }),
- Arrays.asList(mappingMetaData.getParameterNames(constructor)));
-
- constructor = String.class.getConstructor(new Class[] { byte[].class, int.class, int.class});
- assertFalse(mappingMetaData.isDefaultConstructor(constructor));
- assertEquals(Arrays.asList(new String[] { "bytes", "offset", "length" }),
- Arrays.asList(mappingMetaData.getParameterNames(constructor)));
- }
-
- protected void setUp() throws Exception {
- StringBuffer buf = new StringBuffer();
- buf.append("# test properties\n");
- buf.append("foo=bar\n");
- buf.append("foo,chese=blah\n");
- Constructor constructor = String.class.getConstructor(new Class[] { StringBuffer.class});
- buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=StringBuffer\n");
- constructor = String.class.getConstructor(new Class[] { char[].class});
- buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=char[]\n");
- constructor = String.class.getConstructor(new Class[] { byte[].class, int.class, int.class});
- buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=byte[],int,int\n");
- constructor = URLClassLoader.class.getConstructor(new Class[] { URL[].class, ClassLoader.class});
- buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=URL[],ClassLoader\n");
-
- properties.load(new ByteArrayInputStream(buf.toString().getBytes()));
-
- constructor = URLClassLoader.class.getConstructor(new Class[] { URL[].class, ClassLoader.class});
- properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".default", "true");
- properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".parameterNames", "urls,parent");
- constructor = String.class.getConstructor(new Class[] { byte[].class, int.class, int.class});
- properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".default", "false");
- properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".parameterNames", "bytes,offset,length");
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/BeerService.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/BeerService.java
deleted file mode 100644
index c85ab54..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/BeerService.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-
-/**
- * @org.apache.xbean.XBean element="beer" description="Mmmmm beer"
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-
-// START SNIPPET: bean
-public class BeerService {
- private String id;
- private String name;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/FavoriteService.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/FavoriteService.java
deleted file mode 100644
index 1c1b8b8..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/FavoriteService.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import java.util.Map;
-
-
-/**
- * @org.apache.xbean.XBean element="favorite"
- *
- * @author Dan Diephouse
- * @version $Id$
- */
-
-// START SNIPPET: bean
-public class FavoriteService {
- private Map favorites;
-
- /**
- * @org.apache.xbean.Map entryName="favorite-item" keyName="person"
- * @return
- */
- public Map getFavorites() {
- return favorites;
- }
-
- public void setFavorites(Map favorites) {
- this.favorites = favorites;
- }
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/GinService.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/GinService.java
deleted file mode 100644
index 05a3141..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/GinService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-/**
- * Gin is made from the distillation of white grain spirit and juniper berries.
- * @org.apache.xbean.XBean element="gin" contentProperty="name"
- *
- * @version $Revision: 1.1 $
- */
-public class GinService {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/PizzaService.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/PizzaService.java
deleted file mode 100644
index 0c57936..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/PizzaService.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @org.apache.xbean.XBean element="pizza"
- * description="This is a tasty Pizza"
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-
-// START SNIPPET: bean
-public class PizzaService {
-
- private static final Log log = LogFactory.getLog(PizzaService.class);
-
- private String topping;
- private String cheese;
- private int size;
- private double price;
-
- public void makePizza() {
- log.info("Making a pizza with topping: " + topping + " cheese: " + cheese + " with size: " + size);
- }
-
- public String getCheese() {
- return cheese;
- }
-
- public void setCheese(String cheese) {
- this.cheese = cheese;
- }
-
- public double getPrice() {
- return price;
- }
-
- public void setPrice(double price) {
- this.price = price;
- }
-
- public int getSize() {
- return size;
- }
-
- public void setSize(int size) {
- this.size = size;
- }
-
- /**
- * @org.apache.xbean.Property alias="myTopping"
- */
- public String getTopping() {
- return topping;
- }
-
- public void setTopping(String topping) {
- this.topping = topping;
- }
-
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/QNameService.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/QNameService.java
deleted file mode 100644
index 2ea873f..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/QNameService.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * @org.apache.xbean.XBean element="qname-service"
- * @author gnodet
- */
-public class QNameService {
-
- private QName[] services;
- private List list;
-
- public QName[] getServices() {
- return services;
- }
-
- public void setServices(QName[] services) {
- this.services = services;
- }
-
- public List getList() {
- return list;
- }
-
- public void setList(List list) {
- this.list = list;
- }
-
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/Recipe.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/Recipe.java
deleted file mode 100644
index caf46fa..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/Recipe.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-/**
- * @org.apache.xbean.XBean element="recipe"
- * @author Dan Diephouse
- */
-public class Recipe
-{
- private String ingredients;
- private String instructions;
-
- public String getInstructions()
- {
- return instructions;
- }
-
- public void setInstructions(String instructions)
- {
- this.instructions = instructions;
- }
-
- public String getIngredients()
- {
- return ingredients;
- }
-
- public void setIngredients(String ingredients)
- {
- this.ingredients = ingredients;
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/RecipeService.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/RecipeService.java
deleted file mode 100644
index 2dc5576..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/RecipeService.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import java.util.List;
-/**
- * @org.apache.xbean.XBean element="recipe-service"
- * @author Dan Diephouse
- */
-public class RecipeService
-{
- private List recipes;
- private Recipe topRecipe;
-
- /**
- * @org.apache.xbean.FlatCollection childElement="recipe"
- * @return
- */
- public List getRecipes()
- {
- return recipes;
- }
-
- public void setRecipes(List recipes)
- {
- this.recipes = recipes;
- }
-
- /**
- * @org.apache.xbean.Flat
- * @return
- */
- public Recipe getTopRecipe() {
- return topRecipe;
- }
-
- public void setTopRecipe(Recipe topRecipe) {
- this.topRecipe = topRecipe;
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/RestaurantService.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/RestaurantService.java
deleted file mode 100644
index 20985c5..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/RestaurantService.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import javax.xml.namespace.QName;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * An owner POJO used for testing out nested properties
- *
- * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/pizza" element="restaurant"
- * description="A Restaurant thingy"
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantService {
-
- private PizzaService favourite;
- private List dinnerMenu;
- private PizzaService[] lunchMenu;
- private QName serviceName;
- private URI uri;
-
- /**
- * @org.apache.xbean.Property nestedType="org.apache.xbean.spring.example.PizzaService"
- */
- public List getDinnerMenu() {
- return dinnerMenu;
- }
-
- public void setDinnerMenu(List dinnerMenu) {
- this.dinnerMenu = dinnerMenu;
- }
-
- public PizzaService[] getLunchMenu() {
- return lunchMenu;
- }
-
- public void setLunchMenu(PizzaService[] lunchMenu) {
- this.lunchMenu = lunchMenu;
- }
-
- public PizzaService getFavourite() {
- return favourite;
- }
-
- public void setFavourite(PizzaService favourite) {
- this.favourite = favourite;
- }
-
- public QName getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(QName name) {
- this.serviceName = name;
- }
-
- public URI getUri() {
- return uri;
- }
-
- public void setUri(URI uri) {
- this.uri = uri;
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/SaladService.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/SaladService.java
deleted file mode 100644
index 157ec14..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/SaladService.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.example;
-
-/**
- * Basic salad.
- * @org.apache.xbean.XBean
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-
-// START SNIPPET: bean
-public class SaladService {
- private final String dressing;
- private final String size;
- private final boolean crouton;
-
- public SaladService(String dressing, String size, boolean crouton) {
- this.dressing = dressing;
- this.size = size;
- this.crouton = crouton;
- }
-
- /**
- * Dressing What type of dressing do you want?
- */
- public String getDressing() {
- return dressing;
- }
-
- /**
- * What size do you want?
- */
- public String getSize() {
- return size;
- }
-
- /**
- * Do you want crutons on that?
- * @org.apache.xbean.Property alias="addCroutons"
- */
- public boolean isCrouton() {
- return crouton;
- }
-}
-// END SNIPPET: bean
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/SoupService.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/SoupService.java
deleted file mode 100644
index 6aaa7da..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/SoupService.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @org.apache.xbean.XBean element="soup"
- * description="This is a tasty soup"
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-
-// START SNIPPET: bean
-public class SoupService {
- private static final Log log = LogFactory.getLog(SoupService.class);
-
- /**
- * @org.apache.xbean.FactoryMethod
- */
- public static SoupService newSoup(String type) {
- return new SoupService(type, System.currentTimeMillis());
- }
-
- private final String type;
- private final long createTime;
- private boolean exists = false;
-
- private SoupService(String type, long createTime) {
- this.type = type;
- this.createTime = createTime;
- }
-
- /**
- * @org.apache.xbean.InitMethod
- */
- public void make() {
- log.info("Making " + type + "soup");
- exists = true;
- }
-
- /**
- * @org.apache.xbean.DestroyMethod
- */
- public void eat() {
- log.info("Mummmm " + type + "soup is yummie!");
- exists = false;
- }
-
- public boolean exists() {
- return exists;
- }
-
- /**
- * What type of soup would you like?
- */
- public String getType() {
- return type;
- }
-
- public long getCreateTime() {
- return createTime;
- }
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/VodkaService.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/VodkaService.java
deleted file mode 100644
index 94cc23b..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/VodkaService.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-/**
- * It comes from a potatoe, it must be good.
- *
- * @org.apache.xbean.XBean element="vodka"
- *
- * @author Dan Diephouse
- * @version $Id$
- * @since 2.0
- */
-
-// START SNIPPET: bean
-public class VodkaService {
- private String id;
- private String name;
- private Class vodkaClass;
-
- public VodkaService() {
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Class getVodkaClass() {
- return vodkaClass;
- }
-
- public void setVodkaClass(Class vodkaClass) {
- this.vodkaClass = vodkaClass;
- }
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/WineService.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/WineService.java
deleted file mode 100644
index 143a02f..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/example/WineService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-/**
- * A drop of nice
- *
- * @org.apache.xbean.XBean element="wine"
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-
-// START SNIPPET: bean
-public class WineService {
- private String id;
- private String name;
-
- public WineService(String id, String name) {
- this.id = id;
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/generator/ModelTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/generator/ModelTest.java
deleted file mode 100644
index 562030f..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/generator/ModelTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.beans.PropertyEditorManager;
-import java.io.File;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class ModelTest extends TestCase {
- private static final String DEFAULT_NAMESPACE = "http://xbean.apache.org/test";
-
- public void testQdox() throws Exception{
- String basedir = System.getProperties().getProperty("basedir", ".");
- QdoxMappingLoader mappingLoader = new QdoxMappingLoader(DEFAULT_NAMESPACE, new File[] { new File(basedir, "/src/test")});
- Set namespaces = mappingLoader.loadNamespaces();
- validateModel(namespaces);
- }
-
- private void validateModel(Set namespaces) {
- assertFalse(namespaces.isEmpty());
-
- NamespaceMapping defaultNamespace = null;
- for (Iterator iterator = namespaces.iterator(); iterator.hasNext();) {
- NamespaceMapping namespaceMapping = (NamespaceMapping) iterator.next();
- if (namespaceMapping.getNamespace().equals(DEFAULT_NAMESPACE)) {
- defaultNamespace = namespaceMapping;
- break;
- }
- }
- assertNotNull(defaultNamespace);
- ElementMapping element = defaultNamespace.getElement("pizza");
- assertNotNull(element);
- AttributeMapping attribute = element.getAttribute("myTopping");
- assertNotNull(attribute);
- assertEquals("topping", attribute.getPropertyName());
-
- ElementMapping beer = defaultNamespace.getElement("beer");
- assertNotNull(beer);
- AttributeMapping beerId = beer.getAttribute("id");
- assertNotNull(beerId);
- AttributeMapping beerName = beer.getAttribute("name");
- assertNotNull(beerName);
-
- ElementMapping recipeService = defaultNamespace.getElement("recipe-service");
- assertNotNull(recipeService);
-
- Map flatCollections = recipeService.getFlatCollections();
- assertNotNull(flatCollections);
- assertEquals(1, flatCollections.size());
- }
-
- public void testPropertyEditor() {
- List editorSearchPath = new LinkedList(Arrays.asList(PropertyEditorManager.getEditorSearchPath()));
- editorSearchPath.add("org.apache.xbean.spring.context.impl");
- PropertyEditorManager.setEditorSearchPath((String[]) editorSearchPath.toArray(new String[editorSearchPath.size()]));
- assertTrue(Utils.isSimpleType(Type.newSimpleType("java.net.URI")));
- }
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/jndi/DefaultContextTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/jndi/DefaultContextTest.java
deleted file mode 100644
index 1a78822..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/jndi/DefaultContextTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.jndi;
-
-import javax.naming.Context;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-import java.util.Hashtable;
-
-import junit.framework.TestCase;
-
-/**
- * @version $Revision: 657 $
- */
-public class DefaultContextTest extends TestCase {
- Context context = new DefaultContext(new Hashtable());
-
- public void testSimpleName() throws Exception {
- assertContextNamed("name");
- }
-
- public void testNestedName() throws Exception {
- assertContextNamed("jdbc/name");
- }
-
- public void testDoubleNestedName() throws Exception {
- assertContextNamed("jdbc/foo/name");
- }
-
- protected void assertContextNamed(String name) throws NamingException {
- context.bind(name, "James");
- assertJNDILookup(name, "James");
-
- context.rebind(name, "Rob");
- assertJNDILookup(name, "Rob");
-
- context.unbind(name);
-
- try {
- context.lookup(name);
- fail("Should ave thrown NameNotFoundException!");
- }
- catch (NameNotFoundException e) {
- System.out.println("Caught expected exception: " + e);
- }
- }
-
- protected void assertJNDILookup(String name, String expected) throws NamingException {
- Object value = context.lookup(name);
- assertEquals("Lookup failed for: " + name, expected, value);
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/jndi/JndiTest.java b/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/jndi/JndiTest.java
deleted file mode 100644
index bc2c7ee..0000000
--- a/trunk/xbean-spring-v1/src/test/java/org/apache/xbean/spring/jndi/JndiTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.jndi;
-
-import org.springframework.beans.factory.BeanFactory;
-import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import java.util.Hashtable;
-
-import junit.framework.TestCase;
-
-public class JndiTest extends TestCase {
-
- protected InitialContext createInitialContext() throws Exception {
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, SpringInitialContextFactory.class.getName());
- env.put(Context.PROVIDER_URL, "classpath:org/apache/xbean/spring/jndi/jndi.xml");
- return new InitialContext(env);
- }
-
- public void testSpringJNDILookup() throws Exception {
- InitialContext context = createInitialContext();
- assertEntryExists(context, "test");
- assertEntryExists(context, "test/restaurant");
- }
-
- public void testConfigureJndiInsideSpringXml() throws Exception {
- // lets load a spring context
-
- BeanFactory factory = new ClassPathXmlApplicationContext("org/apache/xbean/spring/jndi/spring.xml");
- Object test = factory.getBean("restaurant");
- assertNotNull("Should have found the test object", test);
- Object jndi = factory.getBean("jndi");
- assertNotNull("Should have found the jndi object", jndi);
-
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, SpringInitialContextFactory.class.getName());
- InitialContext context = new InitialContext(env);
- assertEntryExists(context, "test");
- assertEntryExists(context, "test/restaurant");
- assertSame(test, context.lookup("test/restaurant"));
- }
-
- protected void assertEntryExists(InitialContext context, String name) throws NamingException {
- Object value = context.lookup(name);
- assertNotNull(name + " should not be null", value);
- }
-
-}
diff --git a/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/pizza-simple b/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/pizza-simple
deleted file mode 100644
index e4d950d..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/pizza-simple
+++ /dev/null
@@ -1,10 +0,0 @@
-# START SNIPPET: config
-
-# the default package that POJOs are in
-package = org.apache.xbean.spring.example
-
-# Mapping of XML Element localNames to classes
-pizza = org.apache.xbean.spring.example.PizzaService
-restaurant = org.apache.xbean.spring.example.RestaurantService
-
-# END SNIPPET: config
diff --git a/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/restaurant b/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/restaurant
deleted file mode 100644
index 46f8601..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/restaurant
+++ /dev/null
@@ -1,17 +0,0 @@
-# START SNIPPET: config
-
-# the default package that POJOs are in
-package = org.apache.xbean.spring.example
-
-# Mapping of XML Element localNames to classes
-pizza = org.apache.xbean.spring.example.PizzaService
-restaurant = org.apache.xbean.spring.example.RestaurantService
-
-# Mapping of XML Attributes to property names
-pizza.alias.myTopping = topping
-
-# Mapping of nested bean properties
-restaurant.dinnerMenu.list = dinnerMenu
-restaurant.favourite = favourite
-
-# END SNIPPET: config
diff --git a/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/salad b/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/salad
deleted file mode 100644
index 9e2712e..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/salad
+++ /dev/null
@@ -1,15 +0,0 @@
-# START SNIPPET: config
-
-# the default package that POJOs are in
-package = org.apache.xbean.spring.example
-
-# Mapping of XML Element localNames to classes
-salad = org.apache.xbean.spring.example.SaladService
-
-# Mapping of XML Attributes to property names
-salad.alias.addCroutons = crouton
-
-# Mapping of constructor argument names
-org.apache.xbean.spring.example.SaladService(java.lang.String,java.lang.String,boolean).parameterNames=dressing size crouton
-
-# END SNIPPET: config
diff --git a/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/soup b/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/soup
deleted file mode 100644
index 91f5a74..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/soup
+++ /dev/null
@@ -1,17 +0,0 @@
-# START SNIPPET: config
-
-# the default package that POJOs are in
-package = org.apache.xbean.spring.example
-
-# Mapping of XML Element localNames to classes
-soup = org.apache.xbean.spring.example.SoupService
-
-# Mapping of life-cycle methods
-soup.initMethod = make
-soup.destroyMethod = eat
-soup.factoryMethod = newSoup
-
-# Mapping of constructor argument names
-org.apache.xbean.spring.example.SoupService.newSoup(java.lang.String).parameterNames=type
-
-# END SNIPPET: config
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/bad-attribute.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/bad-attribute.xml
deleted file mode 100644
index 2353f72..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/bad-attribute.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
-
- <b:beer id="123" unknown="Stella" />
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/bad-element.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/bad-element.xml
deleted file mode 100644
index 4b01aaa..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/bad-element.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
-
- <b:unknown id="123" name="Stella" />
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/bad-namespace.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/bad-namespace.xml
deleted file mode 100644
index f90f135..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/bad-namespace.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:b="http://bad-namespace">
-
- <b:beer name="Stella" />
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-normal.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-normal.xml
deleted file mode 100644
index fc4758a..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-normal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="beerService" class="org.apache.xbean.spring.example.BeerService">
- <property name="id" value="123" />
- <property name="name" value="Stella" />
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-xbean-ns.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-xbean-ns.xml
deleted file mode 100644
index b42a123..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-xbean-ns.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza"
- xmlns:s="http://xbean.apache.org/schemas/spring/1.0"
- xmlns="http://xbean.apache.org/schemas/pizza">
-
- <beer b:id="123" id="beerService" name="Stella"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-xbean-system-prop.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-xbean-system-prop.xml
deleted file mode 100644
index a47dbc0..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-xbean-system-prop.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza" xmlns:s="http://xbean.apache.org/schemas/spring/1.0">
-
- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
-
- <b:beer s:id="beerService" id="123" name="${beerType}"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-xbean.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-xbean.xml
deleted file mode 100644
index e29e5c3..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/beer-xbean.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza" xmlns:s="http://xbean.apache.org/schemas/spring/1.0">
-
- <b:beer s:id="beerService" id="123" name="Stella"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/favorite-normal.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/favorite-normal.xml
deleted file mode 100644
index 66d2aee..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/favorite-normal.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="favoriteService" class="org.apache.xbean.spring.example.FavoriteService">
- <property name="favorites">
- <map>
- <entry key="Dan">
- <value>Grey Goose</value>
- </entry>
- </map>
- </property>
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/favorite-xbean.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/favorite-xbean.xml
deleted file mode 100644
index f345c42..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/favorite-xbean.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza" xmlns:s="http://xbean.apache.org/schemas/spring/1.0">
-
- <b:favorite s:id="favoriteService">
- <b:favorites>
- <b:favorite-item person="Dan">Grey Goose</b:favorite-item>
- </b:favorites>
- </b:favorite>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/gin.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/gin.xml
deleted file mode 100644
index 8aaa102..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/gin.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
-
- <b:gin id="ginService">Bombay Sapphire</b:gin>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-normal.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-normal.xml
deleted file mode 100644
index 029d0f3..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-normal.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="pizzaService" class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Salami"/>
- <property name="cheese" value="Edam"/>
- <property name="size" value="17"/>
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-bean-ref.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-bean-ref.xml
deleted file mode 100644
index 2ea5078..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-bean-ref.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:p="http://xbean.apache.org/schemas/pizza">
-
- <bean id="topping" class="java.lang.String">
- <constructor-arg>
- <value>Salami</value>
- </constructor-arg>
- </bean>
-
- <p:pizza id="pizzaService" myTopping="#topping" cheese="##Edam" size="17"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-java.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-java.xml
deleted file mode 100644
index a36974b..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-java.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:p="java://org.apache.xbean.spring.example">
-
- <p:PizzaService id="pizzaService" topping="Salami" cheese="Edam" size="17"/>
-
-</beans>
-
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-properties.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-properties.xml
deleted file mode 100644
index 14ed3fa..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-properties.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:p="java://org.apache.xbean.spring.example">
-
- <p:PizzaService id="pizzaService">
- topping Salami
- cheese Edam
- size 17
- </p:PizzaService>
-
-</beans>
-
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean.xml
deleted file mode 100644
index b43bfb9..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/pizza-xbean.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:p="http://xbean.apache.org/schemas/pizza">
-
- <p:pizza id="pizzaService" myTopping="Salami" cheese="Edam" size="17"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/qname-normal.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/qname-normal.xml
deleted file mode 100644
index dd84adc..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/qname-normal.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="qnameService" class="org.apache.xbean.spring.example.QNameService">
- <property name="services">
- <list>
- <bean class="javax.xml.namespace.QName">
- <constructor-arg value="urn:foo"/>
- <constructor-arg value="test"/>
- </bean>
- <bean class="javax.xml.namespace.QName">
- <constructor-arg value="urn:foo"/>
- <constructor-arg value="bar"/>
- </bean>
- </list>
- </property>
- <property name="list">
- <list>
- <bean class="javax.xml.namespace.QName">
- <constructor-arg value="urn:foo"/>
- <constructor-arg value="list"/>
- </bean>
- </list>
- </property>
- </bean>
-
-</beans>
\ No newline at end of file
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/qname-xbean.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/qname-xbean.xml
deleted file mode 100644
index ca024cf..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/qname-xbean.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:x="http://xbean.apache.org/schemas/pizza"
- xmlns:foo="urn:foo">
-
- <x:qname-service id="qnameService">
- <x:services>
- <qname>foo:test</qname>
- <qname>foo:bar</qname>
- </x:services>
- <x:list>
- <qname>foo:list</qname>
- </x:list>
- </x:qname-service>
-
-</beans>
\ No newline at end of file
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/recipe-normal.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/recipe-normal.xml
deleted file mode 100644
index 9e6c2dc..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/recipe-normal.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
- <bean id="recipeService" class="org.apache.xbean.spring.example.RecipeService">
- <property name="recipes">
- <list>
- <bean class="org.apache.xbean.spring.example.Recipe">
- <property name="instructions" value="Mash together" />
- <property name="ingredients" value="Food" />
- </bean>
- <bean class="org.apache.xbean.spring.example.Recipe">
- <property name="instructions" value="Mash together" />
- <property name="ingredients" value="Food" />
- </bean>
- </list>
- </property>
- <property name="topRecipe">
- <bean class="org.apache.xbean.spring.example.Recipe">
- <property name="instructions" value="Mash together" />
- <property name="ingredients" value="Food" />
- </bean>
- </property>
- </bean>
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/recipe-xbean.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/recipe-xbean.xml
deleted file mode 100644
index 9c0db0e..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/recipe-xbean.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:x="http://xbean.apache.org/schemas/pizza" xmlns:foo="urn:foo">
-
- <x:recipe-service id="recipeService">
- <x:topRecipe>
- <x:instructions>Mash together</x:instructions>
- <x:ingredients>Food</x:ingredients>
- </x:topRecipe>
- <x:recipe>
- <x:instructions>Mash together</x:instructions>
- <x:ingredients>Food</x:ingredients>
- </x:recipe>
- <x:recipe>
- <x:instructions>Mash together</x:instructions>
- <x:ingredients>Food</x:ingredients>
- </x:recipe>
- </x:recipe-service>
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-normal.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-normal.xml
deleted file mode 100644
index 7c20dc5..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-normal.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <!-- tests using nested beans -->
-
- <bean id="restaurant"
- class="org.apache.xbean.spring.example.RestaurantService">
- <property name="serviceName">
- <bean class="javax.xml.namespace.QName">
- <constructor-arg value="http://acme.com"/>
- <constructor-arg value="xyz"/>
- </bean>
- </property>
- <property name="favourite">
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Salami" />
- <property name="cheese" value="Edam" />
- <property name="size" value="17" />
- </bean>
- </property>
- <property name="dinnerMenu">
- <list>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Ham" />
- <property name="cheese" value="Mozzarella" />
- <property name="size" value="15" />
- </bean>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Eggs" />
- <property name="cheese" value="Mozzarella" />
- <property name="size" value="16" />
- </bean>
- </list>
- </property>
- <property name="lunchMenu">
- <list>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Chicken" />
- <property name="cheese" value="Brie" />
- <property name="size" value="17" />
- </bean>
- </list>
- </property>
- </bean>
-
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-spring-extended.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-spring-extended.xml
deleted file mode 100644
index 653015d..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-spring-extended.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:foo="http://acme.com">
-
- <!-- tests using nested beans -->
-
- <bean id="restaurant"
- class="org.apache.xbean.spring.example.RestaurantService">
- <property name="serviceName" value="foo:xyz"/>
- <property name="favourite">
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Salami" />
- <property name="cheese" value="Edam" />
- <property name="size" value="17" />
- </bean>
- </property>
- <property name="dinnerMenu">
- <list>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Ham" />
- <property name="cheese" value="Mozzarella" />
- <property name="size" value="15" />
- </bean>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Eggs" />
- <property name="cheese" value="Mozzarella" />
- <property name="size" value="16" />
- </bean>
- </list>
- </property>
- <property name="lunchMenu">
- <list>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Chicken" />
- <property name="cheese" value="Brie" />
- <property name="size" value="17" />
- </bean>
- </list>
- </property>
- </bean>
-
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-mixed.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-mixed.xml
deleted file mode 100644
index f95fcfe..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-mixed.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:foo="http://acme.com">
-
- <restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/pizza"
- serviceName="foo:xyz">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <bean xmlns="http://xbean.apache.org/schemas/spring/1.0" class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Eggs"/>
- <property name="cheese" value="Mozzarella"/>
- <property name="size" value="16"/>
- </bean>
- </dinnerMenu>
-
- <lunchMenu>
- <bean xmlns="" class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Chicken"/>
- <property name="cheese" value="Brie"/>
- <property name="size" value="17"/>
- </bean>
- </lunchMenu>
-
- <favourite>
- <bean xmlns="http://xbean.apache.org/schemas/spring/1.0" class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Salami"/>
- <property name="cheese" value="Edam"/>
- <property name="size" value="17"/>
- </bean>
- </favourite>
- </restaurant>
-</beans>
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-root.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-root.xml
deleted file mode 100644
index 0b1f7aa..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-root.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/restaurant" xmlns:foo="http://acme.com" serviceName="foo:xyz" uri="http://cheese.com">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <pizza myTopping="Eggs" cheese="Mozzarella" size="16"/>
- </dinnerMenu>
-
- <lunchMenu>
- <pizza myTopping="Chicken" cheese="Brie" size="17"/>
- </lunchMenu>
-
- <favourite>
- <pizza myTopping="Salami" cheese="Edam" size="17"/>
- </favourite>
-</restaurant>
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-simple.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-simple.xml
deleted file mode 100644
index 3df2aa2..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-simple.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans >
-
- <restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/pizza-simple">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <pizza myTopping="Eggs" cheese="Mozzarella" size="16"/>
- </dinnerMenu>
-
- <lunchMenu>
- <pizza myTopping="Chicken" cheese="Brie" size="17"/>
- </lunchMenu>
-
- <favourite>
- <pizza myTopping="Salami" cheese="Edam" size="17"/>
- </favourite>
- </restaurant>
-</beans>
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean.xml
deleted file mode 100644
index baee015..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans>
-
- <restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/pizza" xmlns:foo="http://acme.com" serviceName="foo:xyz" uri="http://cheese.com">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <pizza myTopping="Eggs" cheese="Mozzarella" size="16"/>
- </dinnerMenu>
-
- <lunchMenu>
- <pizza myTopping="Chicken" cheese="Brie" size="17"/>
- </lunchMenu>
-
- <favourite>
- <pizza myTopping="Salami" cheese="Edam" size="17"/>
- </favourite>
- </restaurant>
-</beans>
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/salad-normal.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/salad-normal.xml
deleted file mode 100644
index 40fc060..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/salad-normal.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="saladService" class="org.apache.xbean.spring.example.SaladService">
- <constructor-arg index="0" value="Cesar"/>
- <constructor-arg index="1" value="Small"/>
- <constructor-arg index="2" value="true"/>
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/salad-xbean.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/salad-xbean.xml
deleted file mode 100644
index ae1c8f7..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/salad-xbean.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:s="http://xbean.apache.org/schemas/salad">
-
- <s:salad id="saladService" dressing="Cesar" size="Small" addCroutons="true"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/soup-normal.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/soup-normal.xml
deleted file mode 100644
index 89a0d6a..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/soup-normal.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="soupService" class="org.apache.xbean.spring.example.SoupService"
- init-method="make"
- destroy-method="eat"
- factory-method="newSoup"
- >
- <constructor-arg index="0" value="French Onion"/>
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/soup-xbean.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/soup-xbean.xml
deleted file mode 100644
index 8bf1600..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/soup-xbean.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:s="http://xbean.apache.org/schemas/soup">
-
- <s:soup id="soupService" type="French Onion"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/vodka-normal.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/vodka-normal.xml
deleted file mode 100644
index 50129e1..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/vodka-normal.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="vodkaService" class="org.apache.xbean.spring.example.VodkaService">
- <property name="id" value="vodkaService" />
- <property name="name" value="Grey Goose" />
- <property name="vodkaClass" value="org.apache.xbean.spring.example.VodkaService" />
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/vodka-xbean.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/vodka-xbean.xml
deleted file mode 100644
index 4b3b45c..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/vodka-xbean.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
-
- <b:vodka id="vodkaService">
- <b:name>Grey Goose</b:name>
- <b:vodkaClass>org.apache.xbean.spring.example.VodkaService</b:vodkaClass>
- </b:vodka>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/wine-normal.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/wine-normal.xml
deleted file mode 100644
index 443c014..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/wine-normal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="wineService" class="org.apache.xbean.spring.example.WineService">
- <constructor-arg value="wineService" />
- <constructor-arg value="Amarone" />
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/wine-xbean.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/wine-xbean.xml
deleted file mode 100644
index a777af2..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/context/wine-xbean.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
-
- <b:wine id="wineService" name="Amarone"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/jndi/jndi.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/jndi/jndi.xml
deleted file mode 100644
index 1a605b2..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/jndi/jndi.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: jndi -->
-<beans>
- <bean id="jndi" class="org.apache.xbean.spring.jndi.DefaultContext" singleton="true">
- <property name="entries">
- <map>
- <entry key="test/restaurant">
-
- <restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/pizza" xmlns:foo="http://acme.com" serviceName="foo:xyz" uri="http://cheese.com">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <pizza myTopping="Eggs" cheese="Mozzarella" size="16"/>
- </dinnerMenu>
-
- <lunchMenu>
- <pizza myTopping="Chicken" cheese="Brie" size="17"/>
- </lunchMenu>
-
- <favourite>
- <pizza myTopping="Salami" cheese="Edam" size="17"/>
- </favourite>
- </restaurant>
-
- </entry>
- </map>
- </property>
- </bean>
-</beans>
-<!-- END SNIPPET: jndi -->
diff --git a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/jndi/spring.xml b/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/jndi/spring.xml
deleted file mode 100644
index a43a052..0000000
--- a/trunk/xbean-spring-v1/src/test/resources/org/apache/xbean/spring/jndi/spring.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans>
-
- <restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/pizza" xmlns:foo="http://acme.com" serviceName="foo:xyz" uri="http://cheese.com">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <pizza myTopping="Eggs" cheese="Mozzarella" size="16"/>
- </dinnerMenu>
-
- <lunchMenu>
- <pizza myTopping="Chicken" cheese="Brie" size="17"/>
- </lunchMenu>
-
- <favourite>
- <pizza myTopping="Salami" cheese="Edam" size="17"/>
- </favourite>
- </restaurant>
-
- <!-- lets initialise JNDI here -->
- <bean id="jndi" class="org.apache.xbean.spring.jndi.SpringInitialContextFactory" factory-method="makeInitialContext" singleton="true">
- <property name="entries">
- <map>
- <entry key="test/restaurant" value-ref="restaurant" />
- </map>
- </property>
- </bean>
-</beans>
diff --git a/trunk/xbean-spring-v2/LICENSE.txt b/trunk/xbean-spring-v2/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-spring-v2/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-spring-v2/NOTICE.txt b/trunk/xbean-spring-v2/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-spring-v2/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-spring-v2/README.txt b/trunk/xbean-spring-v2/README.txt
deleted file mode 100644
index 826ba9f..0000000
--- a/trunk/xbean-spring-v2/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-This module contains the Spring additions for XBean which
-
-* provide a custom XML extension mechanism, allowing more concise XML to be used
- along with XSDs so that they can be more easily validated with off the shelf XML tooling
-
-* LDAP enhancements to Spring's configuration mechanism.
diff --git a/trunk/xbean-spring-v2/pom.xml b/trunk/xbean-spring-v2/pom.xml
deleted file mode 100644
index 7fcec3f..0000000
--- a/trunk/xbean-spring-v2/pom.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring-v2</artifactId>
- <name>XBean :: Spring :: V2</name>
- <version>2.4-SNAPSHOT</version>
- <build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- <testResource>
- <directory>target/test-generated</directory>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <taskdef classname="org.apache.xbean.spring.generator.MappingGeneratorTask" name="mapping">
- <classpath>
- <pathelement path="${basedir}/target/classes"></pathelement>
- <pathelement path="${basedir}/target/test-classes"></pathelement>
- <path refid="maven.runtime.classpath"></path>
- </classpath>
- </taskdef>
- <mapping namespace="http://xbean.apache.org/schemas/pizza" srcdir="src/test/java" destFile="target/restaurant.xsd" metaInfDir="${basedir}/target/test-generated/"></mapping>
- <copy todir="${basedir}/target/test-classes">
- <fileset dir="${basedir}/target/test-generated"></fileset>
- </copy>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- <version>2.0-m5</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>qdox</groupId>
- <artifactId>qdox</artifactId>
- <optional>true</optional>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java b/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java
deleted file mode 100644
index ad4db6b..0000000
--- a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.v2;
-
-import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
-import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
-import org.springframework.beans.factory.xml.XmlReaderContext;
-import org.springframework.util.xml.DomUtils;
-import org.w3c.dom.Element;
-
-public class XBeanBeanDefinitionDocumentReader extends DefaultBeanDefinitionDocumentReader {
-
- protected BeanDefinitionParserDelegate createHelper(XmlReaderContext readerContext, Element root) {
- BeanDefinitionParserDelegate delegate = new XBeanBeanDefinitionParserDelegate(readerContext);
- delegate.initDefaults(root);
- return delegate;
- }
-
- protected void parseBeanDefinitions(Element root, BeanDefinitionParserDelegate delegate) {
- String namespaceUri = root.getNamespaceURI();
- if (!DomUtils.nodeNameEquals(root, "beans") &&
- !delegate.isDefaultNamespace(namespaceUri)) {
- delegate.parseCustomElement(root, false);
- } else {
- super.parseBeanDefinitions(root, delegate);
- }
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionParserDelegate.java b/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionParserDelegate.java
deleted file mode 100644
index fce6736..0000000
--- a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionParserDelegate.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.v2;
-
-import java.lang.reflect.Field;
-
-import org.apache.xbean.spring.context.impl.PropertyEditorHelper;
-import org.apache.xbean.spring.context.impl.QNameReflectionHelper;
-import org.springframework.beans.factory.ParseState;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
-import org.springframework.beans.factory.xml.XmlReaderContext;
-import org.springframework.util.StringUtils;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class XBeanBeanDefinitionParserDelegate extends BeanDefinitionParserDelegate {
-
- public static final String QNAME_ELEMENT = "qname";
-
- private XBeanQNameHelper qnameHelper;
-
- static {
- PropertyEditorHelper.registerCustomEditors();
- }
-
- public XBeanBeanDefinitionParserDelegate(XmlReaderContext readerContext) {
- super(readerContext);
- qnameHelper = new XBeanQNameHelper(readerContext);
- }
-
- public Object parsePropertySubElement(Element ele, String defaultTypeClassName) {
- if (!isDefaultNamespace(ele.getNamespaceURI())) {
- return parseNestedCustomElement(ele);
- }
- else if (ele.getTagName().equals(QNAME_ELEMENT)) {
- return parseQNameElement(ele);
- }
- else {
- return super.parsePropertySubElement(ele, defaultTypeClassName);
- }
- }
-
- public BeanDefinition parseBeanDefinitionElement(Element ele, String beanName) {
- BeanDefinition bd = super.parseBeanDefinitionElement(ele, beanName);
- qnameHelper.coerceNamespaceAwarePropertyValues(bd, ele);
- return bd;
- }
-
- public boolean isDefaultNamespace(String namespaceUri) {
- return (!StringUtils.hasLength(namespaceUri) ||
- BEANS_NAMESPACE_URI.equals(namespaceUri)) ||
- XBeanNamespaceHandler.SPRING_SCHEMA.equals(namespaceUri) ||
- XBeanNamespaceHandler.SPRING_SCHEMA_COMPAT.equals(namespaceUri);
- }
-
- protected Object parseQNameElement(Element element) {
- return QNameReflectionHelper.createQName(element, getElementText(element));
- }
-
- protected String getElementText(Element element) {
- StringBuffer buffer = new StringBuffer();
- NodeList nodeList = element.getChildNodes();
- for (int i = 0, size = nodeList.getLength(); i < size; i++) {
- Node node = nodeList.item(i);
- if (node.getNodeType() == Node.TEXT_NODE) {
- buffer.append(node.getNodeValue());
- }
- }
- return buffer.toString();
- }
-
- private Object parseNestedCustomElement(Element candidateEle) {
- BeanDefinition innerDefinition = parseCustomElement(candidateEle, true);
- if(innerDefinition == null) {
- error("Incorrect usage of element '" + candidateEle.getNodeName()
- + "' in a nested manner. This tag cannot be used nested inside <property>.", candidateEle);
- return null;
- }
- return innerDefinition;
- }
-
- private void error(String message, Object source) {
- ParseState parseState = null;
- try {
- Field f = getClass().getField("parseState");
- f.setAccessible(true);
- ParseState ps = (ParseState) f.get(this);
- parseState = ps.snapshot();
- } catch (Exception e) {}
- getReaderContext().error(message, source, parseState);
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandler.java b/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandler.java
deleted file mode 100644
index 6e6cc29..0000000
--- a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandler.java
+++ /dev/null
@@ -1,818 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context.v2;
-
-import java.beans.BeanInfo;
-import java.beans.PropertyDescriptor;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.xbean.spring.context.impl.MappingMetaData;
-import org.apache.xbean.spring.context.impl.NamedConstructorArgs;
-import org.apache.xbean.spring.context.impl.NamespaceHelper;
-import org.apache.xbean.spring.context.impl.PropertyEditorHelper;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.PropertyValue;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.BeanComponentDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.support.ManagedList;
-import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
-import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
-import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
-import org.springframework.beans.factory.xml.NamespaceHandler;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-
-/**
- * An enhanced XML parser capable of handling custom XML schemas.
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class XBeanNamespaceHandler implements NamespaceHandler {
-
- public static final String SPRING_SCHEMA = "http://xbean.apache.org/schemas/spring/1.0";
- public static final String SPRING_SCHEMA_COMPAT = "http://xbean.org/schemas/spring/1.0";
-
- static {
- PropertyEditorHelper.registerCustomEditors();
- }
-
- private static final Log log = LogFactory.getLog(XBeanNamespaceHandler.class);
-
- private static final String QNAME_ELEMENT = "qname";
-
- private static final String DESCRIPTION_ELEMENT = "description";
-
- /**
- * All the reserved Spring XML element names which cannot be overloaded by
- * an XML extension
- */
- protected static final String[] RESERVED_ELEMENT_NAMES = {
- "beans",
- DESCRIPTION_ELEMENT,
- DefaultBeanDefinitionDocumentReader.IMPORT_ELEMENT,
- DefaultBeanDefinitionDocumentReader.ALIAS_ELEMENT,
- DefaultBeanDefinitionDocumentReader.BEAN_ELEMENT,
- BeanDefinitionParserDelegate.CONSTRUCTOR_ARG_ELEMENT,
- BeanDefinitionParserDelegate.PROPERTY_ELEMENT,
- BeanDefinitionParserDelegate.LOOKUP_METHOD_ELEMENT,
- BeanDefinitionParserDelegate.REPLACED_METHOD_ELEMENT,
- BeanDefinitionParserDelegate.ARG_TYPE_ELEMENT,
- BeanDefinitionParserDelegate.REF_ELEMENT,
- BeanDefinitionParserDelegate.IDREF_ELEMENT,
- BeanDefinitionParserDelegate.VALUE_ELEMENT,
- BeanDefinitionParserDelegate.NULL_ELEMENT,
- BeanDefinitionParserDelegate.LIST_ELEMENT,
- BeanDefinitionParserDelegate.SET_ELEMENT,
- BeanDefinitionParserDelegate.MAP_ELEMENT,
- BeanDefinitionParserDelegate.ENTRY_ELEMENT,
- BeanDefinitionParserDelegate.KEY_ELEMENT,
- BeanDefinitionParserDelegate.PROPS_ELEMENT,
- BeanDefinitionParserDelegate.PROP_ELEMENT,
- QNAME_ELEMENT };
-
- protected static final String[] RESERVED_BEAN_ATTRIBUTE_NAMES = {
- AbstractBeanDefinitionParser.ID_ATTRIBUTE,
- BeanDefinitionParserDelegate.NAME_ATTRIBUTE,
- BeanDefinitionParserDelegate.CLASS_ATTRIBUTE,
- BeanDefinitionParserDelegate.PARENT_ATTRIBUTE,
- BeanDefinitionParserDelegate.DEPENDS_ON_ATTRIBUTE,
- BeanDefinitionParserDelegate.FACTORY_METHOD_ATTRIBUTE,
- BeanDefinitionParserDelegate.FACTORY_BEAN_ATTRIBUTE,
- BeanDefinitionParserDelegate.DEPENDENCY_CHECK_ATTRIBUTE,
- BeanDefinitionParserDelegate.AUTOWIRE_ATTRIBUTE,
- BeanDefinitionParserDelegate.INIT_METHOD_ATTRIBUTE,
- BeanDefinitionParserDelegate.DESTROY_METHOD_ATTRIBUTE,
- BeanDefinitionParserDelegate.ABSTRACT_ATTRIBUTE,
- BeanDefinitionParserDelegate.SINGLETON_ATTRIBUTE,
- BeanDefinitionParserDelegate.LAZY_INIT_ATTRIBUTE };
-
- private static final String JAVA_PACKAGE_PREFIX = "java://";
-
- private static final String BEAN_REFERENCE_PREFIX = "#";
-
- private Set reservedElementNames = new HashSet(Arrays.asList(RESERVED_ELEMENT_NAMES));
- private Set reservedBeanAttributeNames = new HashSet(Arrays.asList(RESERVED_BEAN_ATTRIBUTE_NAMES));
- protected final NamedConstructorArgs namedConstructorArgs = new NamedConstructorArgs();
-
- private ParserContext parserContext;
-
- private XBeanQNameHelper qnameHelper;
-
- public void init() {
- }
-
- public BeanDefinition parse(Element element, ParserContext parserContext) {
- this.parserContext = parserContext;
- this.qnameHelper = new XBeanQNameHelper(parserContext.getReaderContext());
- BeanDefinitionHolder holder = parseBeanFromExtensionElement(element);
- BeanDefinitionReaderUtils.registerBeanDefinition(holder, parserContext.getRegistry());
- BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
- parserContext.getReaderContext().fireComponentRegistered(componentDefinition);
- return holder.getBeanDefinition();
- }
-
- public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
- throw new IllegalArgumentException("Cannot locate BeanDefinitionDecorator for "
- + (node instanceof Element ? "element" : "attribute") + " [" +
- node.getLocalName() + "].");
- }
-
- /**
- * Configures the XmlBeanDefinitionReader to work nicely with extensible XML
- * using this reader implementation.
- */
- public static void configure(AbstractApplicationContext context, XmlBeanDefinitionReader reader) {
- reader.setNamespaceAware(true);
- reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
- }
-
- /**
- * Registers whatever custom editors we need
- */
- public static void registerCustomEditors(DefaultListableBeanFactory beanFactory) {
- PropertyEditorHelper.registerCustomEditors();
- }
-
- /**
- * Parses the non-standard XML element as a Spring bean definition
- */
- protected BeanDefinitionHolder parseBeanFromExtensionElement(Element element, String parentClass, String property) {
- String uri = element.getNamespaceURI();
- String localName = getLocalName(element);
-
- MappingMetaData metadata = findNamespaceProperties(uri, localName);
- if (metadata != null) {
- // lets see if we configured the localName to a bean class
- String className = getPropertyDescriptor(parentClass, property).getPropertyType().getName();
- if (className != null) {
- return parseBeanFromExtensionElement(element, metadata, className);
- }
- }
- return null;
- }
-
- private BeanDefinitionHolder parseBeanFromExtensionElement(Element element, MappingMetaData metadata, String className) {
- Element original = cloneElement(element);
- // lets assume the class name == the package name plus the
- element.setAttributeNS(null, "class", className);
- addSpringAttributeValues(className, element);
- BeanDefinitionHolder definition = parserContext.getDelegate().parseBeanDefinitionElement(element, false);
- addAttributeProperties(definition, metadata, className, original);
- addContentProperty(definition, metadata, element);
- addNestedPropertyElements(definition, metadata, className, element);
- qnameHelper.coerceNamespaceAwarePropertyValues(definition.getBeanDefinition(), element);
- declareLifecycleMethods(definition, metadata, element);
- resolveBeanClass((AbstractBeanDefinition) definition.getBeanDefinition(), definition.getBeanName());
- namedConstructorArgs.processParameters(definition, metadata);
- return definition;
- }
-
- protected Class resolveBeanClass(AbstractBeanDefinition bd, String beanName) {
- if (bd.hasBeanClass()) {
- return bd.getBeanClass();
- }
- try {
- ClassLoader cl = parserContext.getReaderContext().getReader().getBeanClassLoader();
- if (cl == null) {
- cl = Thread.currentThread().getContextClassLoader();
- }
- if (cl == null) {
- cl = getClass().getClassLoader();
- }
- return bd.resolveBeanClass(cl);
- }
- catch (ClassNotFoundException ex) {
- throw new BeanDefinitionStoreException(bd.getResourceDescription(),
- beanName, "Bean class [" + bd.getBeanClassName() + "] not found", ex);
- }
- catch (NoClassDefFoundError err) {
- throw new BeanDefinitionStoreException(bd.getResourceDescription(),
- beanName, "Class that bean class [" + bd.getBeanClassName() + "] depends on not found", err);
- }
- }
-
-
- /**
- * Parses the non-standard XML element as a Spring bean definition
- */
- protected BeanDefinitionHolder parseBeanFromExtensionElement(Element element) {
- String uri = element.getNamespaceURI();
- String localName = getLocalName(element);
-
- MappingMetaData metadata = findNamespaceProperties(uri, localName);
- if (metadata != null) {
- // lets see if we configured the localName to a bean class
- String className = metadata.getClassName(localName);
- if (className != null) {
- return parseBeanFromExtensionElement(element, metadata, className);
- } else {
- throw new BeanDefinitionStoreException("Unrecognized xbean element mapping: " + localName + " in namespace " + uri);
- }
- } else {
- if (uri == null) throw new BeanDefinitionStoreException("Unrecognized Spring element: " + localName);
- else throw new BeanDefinitionStoreException("Unrecognized xbean namespace mapping: " + uri);
- }
- }
-
- protected void addSpringAttributeValues(String className, Element element) {
- NamedNodeMap attributes = element.getAttributes();
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- String localName = attribute.getLocalName();
-
- if (uri != null && (uri.equals(SPRING_SCHEMA) || uri.equals(SPRING_SCHEMA_COMPAT))) {
- element.setAttributeNS(null, localName, attribute.getNodeValue());
- }
- }
- }
-
- /**
- * Creates a clone of the element and its attribute (though not its content)
- */
- protected Element cloneElement(Element element) {
- Element answer = element.getOwnerDocument().createElementNS(element.getNamespaceURI(), element.getNodeName());
- NamedNodeMap attributes = element.getAttributes();
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- answer.setAttributeNS(uri, attribute.getName(), attribute.getNodeValue());
- }
- return answer;
- }
-
- /**
- * Parses attribute names and values as being bean property expressions
- */
- protected void addAttributeProperties(BeanDefinitionHolder definition, MappingMetaData metadata, String className,
- Element element) {
- NamedNodeMap attributes = element.getAttributes();
- // First pass on attributes with no namespaces
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- String localName = attribute.getLocalName();
- // Skip namespaces
- if (localName == null || localName.equals("xmlns") || localName.startsWith("xmlns:")) {
- continue;
- }
- // Add attributes with no namespaces
- if (isEmpty(uri) && !localName.equals("class")) {
- boolean addProperty = true;
- if (reservedBeanAttributeNames.contains(localName)) {
- // should we allow the property to shine through?
- PropertyDescriptor descriptor = getPropertyDescriptor(className, localName);
- addProperty = descriptor != null;
- }
- if (addProperty) {
- addAttributeProperty(definition, metadata, element, attribute);
- }
- }
- }
- // Second pass on attributes with namespaces
- for (int i = 0, size = attributes.getLength(); i < size; i++) {
- Attr attribute = (Attr) attributes.item(i);
- String uri = attribute.getNamespaceURI();
- String localName = attribute.getLocalName();
- // Skip namespaces
- if (localName == null || localName.equals("xmlns") || localName.startsWith("xmlns:")) {
- continue;
- }
- // Add attributs with namespaces matching the element ns
- if (!isEmpty(uri) && uri.equals(element.getNamespaceURI())) {
- boolean addProperty = true;
- if (reservedBeanAttributeNames.contains(localName)) {
- // should we allow the property to shine through?
- PropertyDescriptor descriptor = getPropertyDescriptor(className, localName);
- addProperty = descriptor != null;
- }
- if (addProperty) {
- addAttributeProperty(definition, metadata, element, attribute);
- }
- }
- }
- }
-
- protected void addContentProperty(BeanDefinitionHolder definition, MappingMetaData metadata, Element element) {
- String name = metadata.getContentProperty(getLocalName(element));
- if (name != null) {
- String value = getElementText(element);
- addProperty(definition, metadata, element, name, value);
- }
- else {
- // lets stry parse a nested properties file
- NodeList childNodes = element.getChildNodes();
- if (childNodes.getLength() == 1 && childNodes.item(0) instanceof Text) {
- Text text = (Text) childNodes.item(0);
- ByteArrayInputStream in = new ByteArrayInputStream(text.getData().getBytes());
- Properties properties = new Properties();
- try {
- properties.load(in);
- }
- catch (IOException e) {
- return;
- }
- Enumeration enumeration = properties.propertyNames();
- while (enumeration.hasMoreElements()) {
- name = (String) enumeration.nextElement();
- Object value = properties.getProperty(name);
- definition.getBeanDefinition().getPropertyValues().addPropertyValue(name, value);
- }
- }
- }
- }
-
- protected void addAttributeProperty(BeanDefinitionHolder definition, MappingMetaData metadata, Element element,
- Attr attribute) {
- String localName = attribute.getLocalName();
- String value = attribute.getValue();
- addProperty(definition, metadata, element, localName, value);
- }
-
- /**
- * Add a property onto the current BeanDefinition.
- */
- protected void addProperty(BeanDefinitionHolder definition, MappingMetaData metadata, Element element,
- String localName, String value) {
- String propertyName = metadata.getPropertyName(getLocalName(element), localName);
- if (propertyName != null) {
- definition.getBeanDefinition().getPropertyValues().addPropertyValue(
- propertyName, getValue(value));
- }
- }
-
- protected Object getValue(String value) {
- if (value == null) return null;
-
- boolean reference = false;
- if (value.startsWith(BEAN_REFERENCE_PREFIX)) {
- value = value.substring(BEAN_REFERENCE_PREFIX.length());
-
- // we could be an escaped string
- if (!value.startsWith(BEAN_REFERENCE_PREFIX)) {
- reference = true;
- }
- }
-
- if (reference) {
- // TOOD handle custom reference types like local or queries etc
- return new RuntimeBeanReference(value);
- }
- else {
- return value;
- }
- }
-
- protected String getLocalName(Element element) {
- String localName = element.getLocalName();
- if (localName == null) {
- localName = element.getNodeName();
- }
- return localName;
- }
-
- /**
- * Lets iterate through the children of this element and create any nested
- * child properties
- */
- protected void addNestedPropertyElements(BeanDefinitionHolder definition, MappingMetaData metadata,
- String className, Element element) {
- NodeList nl = element.getChildNodes();
-
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element childElement = (Element) node;
- String uri = childElement.getNamespaceURI();
- String localName = childElement.getLocalName();
-
- if (!isEmpty(uri) || !reservedElementNames.contains(localName)) {
- // we could be one of the following
- // * the child element maps to a <property> tag with inner
- // tags being the bean
- // * the child element maps to a <property><list> tag with
- // inner tags being the contents of the list
- // * the child element maps to a <property> tag and is the
- // bean tag too
- // * the child element maps to a <property> tag and is a simple
- // type (String, Class, int, etc).
- Object value = null;
- String propertyName = metadata.getNestedListProperty(getLocalName(element), localName);
- if (propertyName != null) {
- value = parseListElement(childElement, propertyName);
- }
- else {
- propertyName = metadata.getFlatCollectionProperty(getLocalName(element), localName);
- if (propertyName != null) {
- Object def = parseBeanFromExtensionElement(childElement);
- PropertyValue pv = definition.getBeanDefinition().getPropertyValues().getPropertyValue(propertyName);
- if (pv != null) {
- Collection l = (Collection) pv.getValue();
- l.add(def);
- continue;
- } else {
- ManagedList l = new ManagedList();
- l.add(def);
- value = l;
- }
- } else {
- propertyName = metadata.getNestedProperty(getLocalName(element), localName);
- if (propertyName != null) {
- // lets find the first child bean that parses fine
- value = parseChildExtensionBean(childElement);
- }
- }
- }
-
- if (propertyName == null && metadata.isFlatProperty(getLocalName(element), localName)) {
- value = parseBeanFromExtensionElement(childElement, className, localName);
- propertyName = localName;
- }
-
- if (propertyName == null) {
- value = tryParseNestedPropertyViaIntrospection(metadata, className, childElement);
- propertyName = localName;
- }
-
- if (value != null) {
- definition.getBeanDefinition().getPropertyValues().addPropertyValue(propertyName, value);
- }
- else
- {
- /**
- * In this case there is no nested property, so just do a normal
- * addProperty like we do with attributes.
- */
- String text = getElementText(childElement);
-
- if (text != null) {
- addProperty(definition, metadata, element, localName, text);
- }
- }
- }
- }
- }
- }
-
- /**
- * Attempts to use introspection to parse the nested property element.
- */
- protected Object tryParseNestedPropertyViaIntrospection(MappingMetaData metadata, String className, Element element) {
- String localName = getLocalName(element);
- PropertyDescriptor descriptor = getPropertyDescriptor(className, localName);
- if (descriptor != null) {
- return parseNestedPropertyViaIntrospection(metadata, className, element, descriptor);
- }
- return null;
- }
-
- /**
- * Looks up the property decriptor for the given class and property name
- */
- protected PropertyDescriptor getPropertyDescriptor(String className, String localName) {
- BeanInfo beanInfo = qnameHelper.getBeanInfo(className);
- if (beanInfo != null) {
- PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- PropertyDescriptor descriptor = descriptors[i];
- String name = descriptor.getName();
- if (name.equals(localName)) {
- return descriptor;
- }
- }
- }
- return null;
- }
-
- /**
- * Attempts to use introspection to parse the nested property element.
- */
- protected Object parseNestedPropertyViaIntrospection(MappingMetaData metadata, String className, Element element,
- PropertyDescriptor descriptor) {
- String name = descriptor.getName();
- if (isMap(descriptor.getPropertyType())) {
- return parseCustomMapElement(metadata, element, name);
- }
- else if (isCollection(descriptor.getPropertyType())) {
- return parseListElement(element, name);
- }
- else {
- return parseChildExtensionBean(element);
- }
- }
-
- protected Object parseListElement(Element element, String name) {
- return parserContext.getDelegate().parseListElement(element);
- }
-
- protected Object parseCustomMapElement(MappingMetaData metadata, Element element, String name) {
- Map map = new HashMap();
-
- Element parent = (Element) element.getParentNode();
- String entryName = metadata.getMapEntryName(getLocalName(parent), name);
- String keyName = metadata.getMapKeyName(getLocalName(parent), name);
-
- if (entryName == null) entryName = "property";
- if (keyName == null) keyName = "key";
-
- // TODO : support further customizations
- //String valueName = "value";
- //boolean keyIsAttr = true;
- //boolean valueIsAttr = false;
- NodeList nl = element.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element childElement = (Element) node;
-
- String localName = childElement.getLocalName();
- String uri = childElement.getNamespaceURI();
- if (localName == null || localName.equals("xmlns") || localName.startsWith("xmlns:")) {
- continue;
- }
-
- // we could use namespaced attributes to differentiate real spring
- // attributes from namespace-specific attributes
- if (!isEmpty(uri) && localName.equals(entryName)) {
- String key = childElement.getAttribute(keyName);
- if (key == null) throw new RuntimeException("No key defined for map " + entryName);
-
- Object keyValue = getValue(key);
-
- Object value = getValue(getElementText(childElement));
-
- map.put(keyValue, value);
- }
- }
- }
- return map;
- }
-
- protected boolean isMap(Class type) {
- return Map.class.isAssignableFrom(type);
- }
-
- /**
- * Returns true if the given type is a collection type or an array
- */
- protected boolean isCollection(Class type) {
- return type.isArray() || Collection.class.isAssignableFrom(type);
- }
-
- /**
- * Iterates the children of this element to find the first nested bean
- */
- protected Object parseChildExtensionBean(Element element) {
- NodeList nl = element.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element childElement = (Element) node;
- String uri = childElement.getNamespaceURI();
- String localName = childElement.getLocalName();
-
- if (uri == null ||
- uri.equals(SPRING_SCHEMA) ||
- uri.equals(SPRING_SCHEMA_COMPAT) ||
- uri.equals(BeanDefinitionParserDelegate.BEANS_NAMESPACE_URI)) {
- if (BeanDefinitionParserDelegate.BEAN_ELEMENT.equals(localName)) {
- return parserContext.getDelegate().parseBeanDefinitionElement(childElement, true);
- }
- } else {
- Object value = parseBeanFromExtensionElement(childElement);
- if (value != null) {
- return value;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Uses META-INF/services discovery to find a Properties file with the XML
- * marshaling configuration
- *
- * @param namespaceURI
- * the namespace URI of the element
- * @param localName
- * the local name of the element
- * @return the properties configuration of the namespace or null if none
- * could be found
- */
- protected MappingMetaData findNamespaceProperties(String namespaceURI, String localName) {
- // lets look for the magic prefix
- if (namespaceURI != null && namespaceURI.startsWith(JAVA_PACKAGE_PREFIX)) {
- String packageName = namespaceURI.substring(JAVA_PACKAGE_PREFIX.length());
- return new MappingMetaData(packageName);
- }
-
- String uri = NamespaceHelper.createDiscoveryPathName(namespaceURI, localName);
- InputStream in = loadResource(uri);
- if (in == null) {
- if (namespaceURI != null && namespaceURI.length() > 0) {
- uri = NamespaceHelper.createDiscoveryPathName(namespaceURI);
- in = loadResource(uri);
- if (in == null) {
- uri = NamespaceHelper.createDiscoveryOldPathName(namespaceURI);
- in = loadResource(uri);
- }
- }
- }
-
- if (in != null) {
- try {
- Properties properties = new Properties();
- properties.load(in);
- return new MappingMetaData(properties);
- }
- catch (IOException e) {
- log.warn("Failed to load resource from uri: " + uri, e);
- }
- }
- return null;
- }
-
- /**
- * Loads the resource from the given URI
- */
- protected InputStream loadResource(String uri) {
- // lets try the thread context class loader first
- InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri);
- if (in == null) {
- in = getClass().getClassLoader().getResourceAsStream(uri);
- if (in == null) {
- log.debug("Could not find resource: " + uri);
- }
- }
- return in;
- }
-
- protected boolean isEmpty(String uri) {
- return uri == null || uri.length() == 0;
- }
-
- protected void declareLifecycleMethods(BeanDefinitionHolder definitionHolder, MappingMetaData metaData,
- Element element) {
- BeanDefinition definition = definitionHolder.getBeanDefinition();
- if (definition instanceof AbstractBeanDefinition) {
- AbstractBeanDefinition beanDefinition = (AbstractBeanDefinition) definition;
- if (beanDefinition.getInitMethodName() == null) {
- beanDefinition.setInitMethodName(metaData.getInitMethodName(getLocalName(element)));
- }
- if (beanDefinition.getDestroyMethodName() == null) {
- beanDefinition.setDestroyMethodName(metaData.getDestroyMethodName(getLocalName(element)));
- }
- if (beanDefinition.getFactoryMethodName() == null) {
- beanDefinition.setFactoryMethodName(metaData.getFactoryMethodName(getLocalName(element)));
- }
- }
- }
-
- // -------------------------------------------------------------------------
- //
- // TODO we could apply the following patches into the Spring code -
- // though who knows if it'll ever make it into a release! :)
- //
- // -------------------------------------------------------------------------
- /*
- protected int parseBeanDefinitions(Element root) throws BeanDefinitionStoreException {
- int beanDefinitionCount = 0;
- if (isEmpty(root.getNamespaceURI()) || root.getLocalName().equals("beans")) {
- NodeList nl = root.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node instanceof Element) {
- Element ele = (Element) node;
- if (IMPORT_ELEMENT.equals(node.getNodeName())) {
- importBeanDefinitionResource(ele);
- }
- else if (ALIAS_ELEMENT.equals(node.getNodeName())) {
- String name = ele.getAttribute(NAME_ATTRIBUTE);
- String alias = ele.getAttribute(ALIAS_ATTRIBUTE);
- getBeanDefinitionReader().getBeanFactory().registerAlias(name, alias);
- }
- else if (BEAN_ELEMENT.equals(node.getNodeName())) {
- beanDefinitionCount++;
- BeanDefinitionHolder bdHolder = parseBeanDefinitionElement(ele, false);
- BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
- .getBeanFactory());
- }
- else {
- BeanDefinitionHolder bdHolder = parseBeanFromExtensionElement(ele);
- if (bdHolder != null) {
- beanDefinitionCount++;
- BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
- .getBeanFactory());
- }
- else {
- log.debug("Ignoring unknown element namespace: " + ele.getNamespaceURI() + " localName: "
- + ele.getLocalName());
- }
- }
- }
- }
- } else {
- BeanDefinitionHolder bdHolder = parseBeanFromExtensionElement(root);
- if (bdHolder != null) {
- beanDefinitionCount++;
- BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader()
- .getBeanFactory());
- }
- else {
- log.debug("Ignoring unknown element namespace: " + root.getNamespaceURI() + " localName: " + root.getLocalName());
- }
- }
- return beanDefinitionCount;
- }
-
- protected BeanDefinitionHolder parseBeanDefinitionElement(Element ele, boolean isInnerBean) throws BeanDefinitionStoreException {
-
- BeanDefinitionHolder bdh = super.parseBeanDefinitionElement(ele, isInnerBean);
- coerceNamespaceAwarePropertyValues(bdh, ele);
- return bdh;
- }
-
- protected Object parsePropertySubElement(Element element, String beanName) throws BeanDefinitionStoreException {
- String uri = element.getNamespaceURI();
- String localName = getLocalName(element);
-
- if ((!isEmpty(uri) && !(uri.equals(SPRING_SCHEMA) || uri.equals(SPRING_SCHEMA_COMPAT)))
- || !reservedElementNames.contains(localName)) {
- Object answer = parseBeanFromExtensionElement(element);
- if (answer != null) {
- return answer;
- }
- }
- if (QNAME_ELEMENT.equals(localName) && isQnameIsOnClassPath()) {
- Object answer = parseQNameElement(element);
- if (answer != null) {
- return answer;
- }
- }
- return super.parsePropertySubElement(element, beanName);
- }
-
- protected Object parseQNameElement(Element element) {
- return QNameReflectionHelper.createQName(element, getElementText(element));
- }
- */
-
- /**
- * Returns the text of the element
- */
- protected String getElementText(Element element) {
- StringBuffer buffer = new StringBuffer();
- NodeList nodeList = element.getChildNodes();
- for (int i = 0, size = nodeList.getLength(); i < size; i++) {
- Node node = nodeList.item(i);
- if (node.getNodeType() == Node.TEXT_NODE) {
- buffer.append(node.getNodeValue());
- }
- }
- return buffer.toString();
- }
-}
diff --git a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java b/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java
deleted file mode 100644
index 114452d..0000000
--- a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanNamespaceHandlerResolver.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.v2;
-
-import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;
-import org.springframework.beans.factory.xml.NamespaceHandler;
-
-
-public class XBeanNamespaceHandlerResolver extends DefaultNamespaceHandlerResolver {
-
- public XBeanNamespaceHandlerResolver(ClassLoader classLoader) {
- super(classLoader);
- }
-
- public NamespaceHandler resolve(String namespaceUri) {
- NamespaceHandler handler = super.resolve(namespaceUri);
- if (handler == null) {
- handler = new XBeanNamespaceHandler();
- }
- return handler;
- }
-}
diff --git a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanQNameHelper.java b/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanQNameHelper.java
deleted file mode 100644
index 5bc6955..0000000
--- a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanQNameHelper.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.v2;
-
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-
-import org.apache.xbean.spring.context.impl.PropertyEditorHelper;
-import org.apache.xbean.spring.context.impl.QNameReflectionHelper;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.xml.XmlReaderContext;
-import org.w3c.dom.Element;
-
-public class XBeanQNameHelper {
-
- private XmlReaderContext readerContext;
-
- private boolean qnameIsOnClassPath;
-
- private boolean initQNameOnClassPath;
-
- public XBeanQNameHelper(XmlReaderContext readerContext) {
- this.readerContext = readerContext;
- }
-
- /**
- * Any namespace aware property values (such as QNames) need to be coerced
- * while we still have access to the XML Element from which its value comes -
- * so lets do that now before we trash the DOM and just have the bean
- * definition.
- */
- public void coerceNamespaceAwarePropertyValues(BeanDefinition definition, Element element) {
- if (definition instanceof AbstractBeanDefinition && isQnameIsOnClassPath()) {
- AbstractBeanDefinition bd = (AbstractBeanDefinition) definition;
- // lets check for any QName types
- BeanInfo beanInfo = getBeanInfo(bd.getBeanClassName());
- if (beanInfo != null) {
- PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- QNameReflectionHelper.coerceNamespaceAwarePropertyValues(bd, element, descriptors, i);
- }
- }
- }
- }
-
- public BeanInfo getBeanInfo(String className) throws BeanDefinitionStoreException {
- if (className == null) {
- return null;
- }
-
- BeanInfo info = null;
- Class type = null;
- try {
- type = loadClass(className);
- }
- catch (ClassNotFoundException e) {
- throw new BeanDefinitionStoreException("Failed to load type: " + className + ". Reason: " + e, e);
- }
- try {
- info = Introspector.getBeanInfo(type);
- }
- catch (IntrospectionException e) {
- throw new BeanDefinitionStoreException("Failed to introspect type: " + className + ". Reason: " + e, e);
- }
- return info;
- }
-
- /**
- * Attempts to load the class on the current thread context class loader or
- * the class loader which loaded us
- */
- protected Class loadClass(String name) throws ClassNotFoundException {
- ClassLoader beanClassLoader = readerContext.getReader().getBeanClassLoader();
- if (beanClassLoader != null) {
- try {
- return beanClassLoader.loadClass(name);
- }
- catch (ClassNotFoundException e) {
- }
- }
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- if (contextClassLoader != null) {
- try {
- return contextClassLoader.loadClass(name);
- }
- catch (ClassNotFoundException e) {
- }
- }
- return getClass().getClassLoader().loadClass(name);
- }
-
- protected boolean isQnameIsOnClassPath() {
- if (initQNameOnClassPath == false) {
- qnameIsOnClassPath = PropertyEditorHelper.loadClass("javax.xml.namespace.QName") != null;
- initQNameOnClassPath = true;
- }
- return qnameIsOnClassPath;
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanXmlBeanDefinitionReader.java b/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanXmlBeanDefinitionReader.java
deleted file mode 100644
index 842f19d..0000000
--- a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanXmlBeanDefinitionReader.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.v2;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.xbean.spring.context.SpringApplicationContext;
-import org.apache.xbean.spring.context.SpringXmlPreprocessor;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.xml.NamespaceHandlerResolver;
-import org.springframework.beans.factory.xml.ResourceEntityResolver;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.core.io.Resource;
-import org.w3c.dom.Document;
-
-/**
- * XBeanXmlBeanDefinitionReader extends XmlBeanDefinitionReader adds support for SpringXMLPreprocessors which can
- * modify the DOM before it is passed to Spring for reading. This allows for extra information to be added into the
- * Spring configuration file that is processed and removed before Spring sees the xml.
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class XBeanXmlBeanDefinitionReader extends XmlBeanDefinitionReader {
- private final SpringApplicationContext applicationContext;
- private final List xmlPreprocessors;
-
- /**
- * Creates a XBeanXmlBeanDefinitionReader for the specified applicationContext and beanFactory which will apply
- * the xmlPreprocessors before passing the DOM to Spring for processing.
- * @param applicationContext the application context for which the bean definitons will be loaded
- * @param beanFactory the beanFactory that services will be loaded
- * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
- */
- public XBeanXmlBeanDefinitionReader(SpringApplicationContext applicationContext, BeanDefinitionRegistry beanFactory, List xmlPreprocessors) {
- super(beanFactory);
- this.applicationContext = applicationContext;
- this.xmlPreprocessors = xmlPreprocessors;
- setNamespaceAware(true);
- setValidationMode(VALIDATION_NONE);
- setResourceLoader(applicationContext);
- setEntityResolver(new ResourceEntityResolver(applicationContext));
- setDocumentReaderClass(XBeanBeanDefinitionDocumentReader.class);
- }
-
- /**
- * Gets the application context for which the bean definitons will be loaded.
- * @return the application context for which the bean definitons will be loaded
- */
- public ApplicationContext getApplicationContext() {
- return applicationContext;
- }
-
- /**
- * {@inheritDoc}
- */
- public int registerBeanDefinitions(Document doc, Resource resource) throws BeansException {
- preprocess(doc);
- return super.registerBeanDefinitions(doc, resource);
- }
-
- protected NamespaceHandlerResolver createDefaultNamespaceHandlerResolver() {
- return new XBeanNamespaceHandlerResolver(getBeanClassLoader());
- }
-
- private void preprocess(Document doc) {
- for (Iterator iterator = xmlPreprocessors.iterator(); iterator.hasNext();) {
- SpringXmlPreprocessor preprocessor = (SpringXmlPreprocessor) iterator.next();
- preprocessor.preprocess(applicationContext, this, doc);
- }
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanXmlBeanFactory.java b/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanXmlBeanFactory.java
deleted file mode 100644
index 26b2a2b..0000000
--- a/trunk/xbean-spring-v2/src/main/java/org/apache/xbean/spring/context/v2/XBeanXmlBeanFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.v2;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.core.io.Resource;
-
-import java.util.Collections;
-import java.util.List;
-
-public class XBeanXmlBeanFactory extends DefaultListableBeanFactory {
-
- /**
- * Create a new XBeanXmlBeanFactory with the given resource,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource) throws BeansException {
- this(resource, null, Collections.EMPTY_LIST);
- }
-
- /**
- * Create a new XBeanXmlBeanFactory with the given input stream,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @param parentBeanFactory parent bean factory
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory) throws BeansException {
- this(resource, parentBeanFactory, Collections.EMPTY_LIST);
- }
-
- /**
- * Create a new XBeanXmlBeanFactory with the given input stream,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource, List xmlPreprocessors) throws BeansException {
- this(resource, null, xmlPreprocessors);
- }
-
- /**
- * Create a new XBeanXmlBeanFactory with the given input stream,
- * which must be parsable using DOM.
- * @param resource XML resource to load bean definitions from
- * @param parentBeanFactory parent bean factory
- * @param xmlPreprocessors the preprocessors to apply the DOM before passing to Spring for processing
- * @throws BeansException in case of loading or parsing errors
- */
- public XBeanXmlBeanFactory(Resource resource, BeanFactory parentBeanFactory, List xmlPreprocessors) throws BeansException {
- super(parentBeanFactory);
- XBeanXmlBeanDefinitionReader reader = new XBeanXmlBeanDefinitionReader(null, this, xmlPreprocessors);
- reader.loadBeanDefinitions(resource);
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/main/resources/META-INF/LICENSE b/trunk/xbean-spring-v2/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-spring-v2/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-spring-v2/src/main/resources/META-INF/NOTICE b/trunk/xbean-spring-v2/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-spring-v2/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BadAttributeTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BadAttributeTest.java
deleted file mode 100644
index f21e026..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BadAttributeTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import junit.framework.TestCase;
-
-/**
- * @author Guillaume Nodet
- * @version $Id$
- * @since 2.3
- */
-public class BadAttributeTest extends TestCase {
-
- public void testBadNs() throws Exception {
- try {
- new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/bad-attribute.xml");
- fail("This should have thrown an exception");
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BadElementTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BadElementTest.java
deleted file mode 100644
index dde11b1..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BadElementTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import junit.framework.TestCase;
-
-/**
- * @author Guillaume Nodet
- * @version $Id$
- * @since 2.3
- */
-public class BadElementTest extends TestCase {
-
- public void testBadNs() throws Exception {
- try {
- new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/bad-element.xml");
- fail("This should have thrown an exception");
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BadNamespaceTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BadNamespaceTest.java
deleted file mode 100644
index 339d388..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BadNamespaceTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import junit.framework.TestCase;
-
-/**
- * @author Guillaume Nodet
- * @version $Id$
- * @since 2.3
- */
-public class BadNamespaceTest extends TestCase {
-
- public void testBadNs() throws Exception {
- try {
- new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/bad-namespace.xml");
- fail("This should have thrown an exception");
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingSpringTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingSpringTest.java
deleted file mode 100644
index 06afa3f..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingSpringTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.BeerService;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 1.0
- */
-public class BeerUsingSpringTest extends SpringTestSupport {
-
- public void testBeer() throws Exception {
- BeerService soup = (BeerService) getBean("beerService");
-
- assertEquals("name", "Stella", soup.getName());
- assertEquals("id", "123", soup.getId());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/beer-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanNSTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanNSTest.java
deleted file mode 100644
index ab2a814..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanNSTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author Guillaume Nodet
- * @version $Id$
- * @since 2.2
- */
-public class BeerUsingXBeanNSTest extends BeerUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/beer-xbean-ns.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanSystemPropTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanSystemPropTest.java
deleted file mode 100644
index e1f6198..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanSystemPropTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author Hiram Chirino
- * @version $Id$
- * @since 2.0
- */
-public class BeerUsingXBeanSystemPropTest extends BeerUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- ClassPathXmlApplicationContext rc = new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/beer-xbean-system-prop.xml");
-//
-// PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
-// cfg.postProcessBeanFactory(rc.getBeanFactory());
-//
- return rc;
- }
-
- protected void setUp() throws Exception {
- System.setProperty("beerType", "Stella");
- super.setUp();
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanTest.java
deleted file mode 100644
index 0993174..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/BeerUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class BeerUsingXBeanTest extends BeerUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/beer-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/FavoriteUsingSpringTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/FavoriteUsingSpringTest.java
deleted file mode 100644
index 2290867..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/FavoriteUsingSpringTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import java.util.Map;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.FavoriteService;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 1.0
- */
-public class FavoriteUsingSpringTest extends SpringTestSupport {
-
- public void testFavs() throws Exception {
- FavoriteService fs = (FavoriteService) getBean("favoriteService");
-
- Map favorites = fs.getFavorites();
- assertNotNull(favorites);
- assertEquals(1, favorites.size());
-
- assertEquals("Grey Goose", favorites.get("Dan"));
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/favorite-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/FavoriteUsingXBeanTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/FavoriteUsingXBeanTest.java
deleted file mode 100644
index 5a84683..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/FavoriteUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class FavoriteUsingXBeanTest extends FavoriteUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/favorite-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/GinUsingSpringTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/GinUsingSpringTest.java
deleted file mode 100644
index 8f65ce2..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/GinUsingSpringTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.GinService;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 1.0
- */
-public class GinUsingSpringTest extends SpringTestSupport {
-
- public void testWine() throws Exception {
- GinService service = (GinService) getBean("ginService");
-
- assertEquals("name", "Bombay Sapphire", service.getName());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/gin.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingSpringTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingSpringTest.java
deleted file mode 100644
index 8cae8ad..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingSpringTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.PizzaService;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class PizzaUsingSpringTest extends SpringTestSupport {
-
- public void testPizza() throws Exception {
- PizzaService pizza = (PizzaService) getBean("pizzaService");
- pizza.makePizza();
-
- assertEquals("topping", "Salami", pizza.getTopping());
- assertEquals("cheese", "Edam", pizza.getCheese());
- assertEquals("size", 17, pizza.getSize());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanTest.java
deleted file mode 100644
index 7308dea..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class PizzaUsingXBeanTest extends PizzaUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWinBeanRefTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWinBeanRefTest.java
deleted file mode 100644
index 78b1dbd..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWinBeanRefTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.PizzaService;
-
-/**
- *
- * @version $Revision: 1.1 $
- */
-public class PizzaUsingXBeanWinBeanRefTest extends PizzaUsingSpringTest {
-
- public void testPizza() throws Exception {
- PizzaService pizza = (PizzaService) getBean("pizzaService");
- pizza.makePizza();
-
- assertEquals("topping", "Salami", pizza.getTopping());
- assertEquals("cheese", "#Edam", pizza.getCheese());
- assertEquals("size", 17, pizza.getSize());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean-bean-ref.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithJavaNamespaceTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithJavaNamespaceTest.java
deleted file mode 100644
index b4b281b..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithJavaNamespaceTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class PizzaUsingXBeanWithJavaNamespaceTest extends PizzaUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean-java.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithPropertiesTextNodeTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithPropertiesTextNodeTest.java
deleted file mode 100644
index ee621fc..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithPropertiesTextNodeTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- * Copyright 2005 David Blevins
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- *
- * @version $Revision: 1.1 $
- */
-public class PizzaUsingXBeanWithPropertiesTextNodeTest extends PizzaUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean-properties.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/QNameUsingSpringTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/QNameUsingSpringTest.java
deleted file mode 100644
index bca9f8c..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/QNameUsingSpringTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xbean.spring.example.QNameService;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-public class QNameUsingSpringTest extends SpringTestSupport {
-
- public void testQName() throws Exception {
- QNameService svc = (QNameService) getBean("qnameService");
-
- QName[] services = svc.getServices();
- assertNotNull(services);
- assertEquals(2, services.length);
- assertEquals(new QName("urn:foo", "test"), services[0]);
- assertEquals(new QName("urn:foo", "bar"), services[1]);
-
- List list = svc.getList();
- assertNotNull(list);
- assertEquals(1, list.size());
- assertEquals(new QName("urn:foo", "list"), list.get(0));
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/qname-normal.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/QNameUsingXBeanTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/QNameUsingXBeanTest.java
deleted file mode 100644
index a0c6e75..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/QNameUsingXBeanTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-public class QNameUsingXBeanTest extends QNameUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/qname-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RecipeUsingSpringTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RecipeUsingSpringTest.java
deleted file mode 100644
index 3b9a2e8..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RecipeUsingSpringTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import java.util.List;
-
-import org.apache.xbean.spring.example.Recipe;
-import org.apache.xbean.spring.example.RecipeService;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-public class RecipeUsingSpringTest extends SpringTestSupport {
-
- public void testRecipes() throws Exception {
- RecipeService svc = (RecipeService) getBean("recipeService");
-
- List list = svc.getRecipes();
- assertNotNull(list);
- assertEquals(2, list.size());
- Recipe r = (Recipe) list.get(0);
- assertEquals("Food", r.getIngredients());
- assertEquals("Mash together", r.getInstructions());
-
- r = (Recipe) list.get(1);
- assertEquals("Food", r.getIngredients());
- assertEquals("Mash together", r.getInstructions());
-
- assertNotNull(svc.getTopRecipe());
- assertEquals("Food", svc.getTopRecipe().getIngredients());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/recipe-normal.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RecipeUsingXBeanTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RecipeUsingXBeanTest.java
deleted file mode 100644
index 6267707..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RecipeUsingXBeanTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-public class RecipeUsingXBeanTest extends RecipeUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/recipe-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingResourceXmlApplicationContextTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingResourceXmlApplicationContextTest.java
deleted file mode 100644
index 8d2c5d1..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingResourceXmlApplicationContextTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingResourceXmlApplicationContextTest extends RestaurantUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ResourceXmlApplicationContext(new ClassPathResource("org/apache/xbean/spring/context/restaurant-xbean.xml"));
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringExtendedTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringExtendedTest.java
deleted file mode 100644
index cd3d4d9..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringExtendedTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-import java.util.List;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingSpringExtendedTest extends RestaurantUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-spring-extended.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringTest.java
deleted file mode 100644
index b8c60aa..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.PizzaService;
-import org.apache.xbean.spring.example.RestaurantService;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingSpringTest extends SpringTestSupport {
-
- public void testPizza() throws Exception {
- RestaurantService restaurant = (RestaurantService) getBean("restaurant");
-
- QName service = restaurant.getServiceName();
- assertEquals(new QName("http://acme.com", "xyz"), service);
-
- // dinners (1-many using list)
- List dinners = restaurant.getDinnerMenu();
- assertNotNull("dinners is null!", dinners);
- assertEquals("dinners size: " + dinners, 2, dinners.size());
-
- PizzaService pizza = (PizzaService) dinners.get(0);
- assertEquals("topping", "Ham", pizza.getTopping());
- assertEquals("cheese", "Mozzarella", pizza.getCheese());
- assertEquals("size", 15, pizza.getSize());
-
- pizza = (PizzaService) dinners.get(1);
- assertEquals("topping", "Eggs", pizza.getTopping());
- assertEquals("cheese", "Mozzarella", pizza.getCheese());
- assertEquals("size", 16, pizza.getSize());
-
- // lunches (1-many using array)
- PizzaService[] lunches = restaurant.getLunchMenu();
- assertNotNull("lunches is null!", lunches);
- assertEquals("lunches size: " + lunches, 1, lunches.length);
-
- pizza = lunches[0];
- assertEquals("topping", "Chicken", pizza.getTopping());
- assertEquals("cheese", "Brie", pizza.getCheese());
- assertEquals("size", 17, pizza.getSize());
-
-
- // favourite (1-1)
- pizza = restaurant.getFavourite();
- assertNotNull("Pizza is null!", pizza);
- pizza.makePizza();
-
- assertEquals("topping", "Salami", pizza.getTopping());
- assertEquals("cheese", "Edam", pizza.getCheese());
- assertEquals("size", 17, pizza.getSize());
-
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanAsRootTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanAsRootTest.java
deleted file mode 100644
index a5b56db..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanAsRootTest.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-public class RestaurantUsingXBeanAsRootTest extends RestaurantUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean-root.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanMixedTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanMixedTest.java
deleted file mode 100644
index ba2bb2b..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanMixedTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingXBeanMixedTest extends RestaurantUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean-mixed.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java
deleted file mode 100644
index 31e0bb6..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.RestaurantService;
-
-import javax.xml.namespace.QName;
-
-import java.net.URI;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingXBeanTest extends RestaurantUsingSpringTest {
- private static final Log log = LogFactory.getLog(RestaurantUsingXBeanTest.class);
-
- public void testPizza() throws Exception {
- super.testPizza();
-
- RestaurantService restaurant = (RestaurantService) getBean("restaurant");
- QName name = restaurant.getServiceName();
- assertNotNull("Name is null", name);
-
- assertEquals("Namespace URI", "http://acme.com", name.getNamespaceURI());
- assertEquals("localName", "xyz", name.getLocalPart());
- assertEquals("prefix", "foo", name.getPrefix());
-
- log.info("Successfully converted the property to a QName: " + name);
-
- URI uri = restaurant.getUri();
- assertNotNull("URI is null", uri);
- assertEquals("URI", new URI("http://cheese.com"), uri);
-
- log.info("Successfully converted the property to a URI: " + uri);
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanWithSimplerConfigTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanWithSimplerConfigTest.java
deleted file mode 100644
index ab47d5e..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanWithSimplerConfigTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantUsingXBeanWithSimplerConfigTest extends RestaurantUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SaladUsingSpringTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SaladUsingSpringTest.java
deleted file mode 100644
index bd6934b..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SaladUsingSpringTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.SaladService;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class SaladUsingSpringTest extends SpringTestSupport {
- public void testSalad() throws Exception {
- SaladService salad = (SaladService) getBean("saladService");
-
- assertEquals("dressing", "Cesar", salad.getDressing());
- assertEquals("size", "Small", salad.getSize());
- assertEquals("crouton", true, salad.isCrouton());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/salad-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SaladUsingXBeanTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SaladUsingXBeanTest.java
deleted file mode 100644
index f92ffeb..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SaladUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class SaladUsingXBeanTest extends SaladUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/salad-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SoupUsingSpringTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SoupUsingSpringTest.java
deleted file mode 100644
index 89ffa98..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SoupUsingSpringTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.SoupService;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class SoupUsingSpringTest extends SpringTestSupport {
- private static final long time = System.currentTimeMillis();
-
- public void testSoup() throws Exception {
- SoupService soup = (SoupService) getBean("soupService");
-
- assertEquals("type", "French Onion", soup.getType());
- assertTrue(soup.getCreateTime() >= time);
- assertTrue(soup.exists());
-
- context.close();
- assertFalse(soup.exists());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/soup-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SoupUsingXBeanTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SoupUsingXBeanTest.java
deleted file mode 100644
index ecbf24d..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SoupUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-public class SoupUsingXBeanTest extends SoupUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/soup-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SpringTestSupport.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SpringTestSupport.java
deleted file mode 100644
index f57ea50..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/SpringTestSupport.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-import junit.framework.TestCase;
-
-/**
- * A useful base class for testing spring based utilities.
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public abstract class SpringTestSupport extends TestCase {
- protected transient Log log = LogFactory.getLog(getClass());
-
- protected AbstractXmlApplicationContext context;
-
- protected void setUp() throws Exception {
- context = createApplicationContext();
- assertNotNull("ApplicationContext is null!", context);
- }
-
- protected void tearDown() throws Exception {
- if (context != null) {
- log.info("Closing down the spring context");
- context.destroy();
- }
- }
-
- protected Object getBean(String name) {
- Object answer = answer = context.getBean(name);
- assertNotNull("Could not find object in Spring for key: " + name, answer);
- return answer;
- }
-
- protected abstract AbstractXmlApplicationContext createApplicationContext();
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/VodkaUsingSpringTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/VodkaUsingSpringTest.java
deleted file mode 100644
index 3680bc4..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/VodkaUsingSpringTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.VodkaService;
-
-/**
- * @author Dan Diephouse
- * @version $Id$
- * @since 1.0
- */
-public class VodkaUsingSpringTest extends SpringTestSupport {
-
- public void testWine() throws Exception {
- VodkaService vodka = (VodkaService) getBean("vodkaService");
-
- assertEquals("name", "Grey Goose", vodka.getName());
- assertEquals("id", "vodkaService", vodka.getId());
-
- // Test more complex classes
- assertEquals("class", VodkaService.class, vodka.getClass());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/vodka-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/VodkaUsingXBeanTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/VodkaUsingXBeanTest.java
deleted file mode 100644
index 3d0c229..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/VodkaUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class VodkaUsingXBeanTest extends VodkaUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/vodka-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/WineUsingSpringTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/WineUsingSpringTest.java
deleted file mode 100644
index d89f0d5..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/WineUsingSpringTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.example.WineService;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 1.0
- */
-public class WineUsingSpringTest extends SpringTestSupport {
-
- public void testWine() throws Exception {
- WineService soup = (WineService) getBean("wineService");
-
- assertEquals("name", "Amarone", soup.getName());
- assertEquals("id", "wineService", soup.getId());
- }
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/wine-normal.xml");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/WineUsingXBeanTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/WineUsingXBeanTest.java
deleted file mode 100644
index 4257618..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/WineUsingXBeanTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.context;
-
-import org.springframework.context.support.AbstractXmlApplicationContext;
-
-/**
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class WineUsingXBeanTest extends WineUsingSpringTest {
-
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/wine-xbean.xml");
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/impl/NamedConstructorArgsTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/impl/NamedConstructorArgsTest.java
deleted file mode 100644
index 1d8105e..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/context/impl/NamedConstructorArgsTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.context.impl;
-
-import java.io.ByteArrayInputStream;
-import java.lang.reflect.Constructor;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Arrays;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class NamedConstructorArgsTest extends TestCase {
- private Properties properties = new Properties();
-
- public void testPropertyParsing() {
- assertEquals("bar", properties.getProperty("foo"));
- assertEquals("blah", properties.getProperty("foo,chese"));
- assertEquals("StringBuffer", properties.getProperty("java.lang.String(java.lang.StringBuffer)"));
- assertEquals("char[]", properties.getProperty("java.lang.String([C)"));
- assertEquals("byte[],int,int", properties.getProperty("java.lang.String([B,int,int)"));
- assertEquals("URL[],ClassLoader", properties.getProperty("java.net.URLClassLoader([Ljava.net.URL;,java.lang.ClassLoader)"));
- }
-
- public void testMappingMetaData() throws Exception {
- MappingMetaData mappingMetaData = new MappingMetaData(properties);
- Constructor constructor = URLClassLoader.class.getConstructor(new Class[] { URL[].class, ClassLoader.class});
- assertTrue(mappingMetaData.isDefaultConstructor(constructor));
- assertEquals(Arrays.asList(new String[] { "urls", "parent" }),
- Arrays.asList(mappingMetaData.getParameterNames(constructor)));
-
- constructor = String.class.getConstructor(new Class[] { byte[].class, int.class, int.class});
- assertFalse(mappingMetaData.isDefaultConstructor(constructor));
- assertEquals(Arrays.asList(new String[] { "bytes", "offset", "length" }),
- Arrays.asList(mappingMetaData.getParameterNames(constructor)));
- }
-
- protected void setUp() throws Exception {
- StringBuffer buf = new StringBuffer();
- buf.append("# test properties\n");
- buf.append("foo=bar\n");
- buf.append("foo,chese=blah\n");
- Constructor constructor = String.class.getConstructor(new Class[] { StringBuffer.class});
- buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=StringBuffer\n");
- constructor = String.class.getConstructor(new Class[] { char[].class});
- buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=char[]\n");
- constructor = String.class.getConstructor(new Class[] { byte[].class, int.class, int.class});
- buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=byte[],int,int\n");
- constructor = URLClassLoader.class.getConstructor(new Class[] { URL[].class, ClassLoader.class});
- buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=URL[],ClassLoader\n");
-
- properties.load(new ByteArrayInputStream(buf.toString().getBytes()));
-
- constructor = URLClassLoader.class.getConstructor(new Class[] { URL[].class, ClassLoader.class});
- properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".default", "true");
- properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".parameterNames", "urls,parent");
- constructor = String.class.getConstructor(new Class[] { byte[].class, int.class, int.class});
- properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".default", "false");
- properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".parameterNames", "bytes,offset,length");
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/BeerService.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/BeerService.java
deleted file mode 100644
index c85ab54..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/BeerService.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-
-/**
- * @org.apache.xbean.XBean element="beer" description="Mmmmm beer"
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-
-// START SNIPPET: bean
-public class BeerService {
- private String id;
- private String name;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/FavoriteService.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/FavoriteService.java
deleted file mode 100644
index 1c1b8b8..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/FavoriteService.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import java.util.Map;
-
-
-/**
- * @org.apache.xbean.XBean element="favorite"
- *
- * @author Dan Diephouse
- * @version $Id$
- */
-
-// START SNIPPET: bean
-public class FavoriteService {
- private Map favorites;
-
- /**
- * @org.apache.xbean.Map entryName="favorite-item" keyName="person"
- * @return
- */
- public Map getFavorites() {
- return favorites;
- }
-
- public void setFavorites(Map favorites) {
- this.favorites = favorites;
- }
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/GinService.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/GinService.java
deleted file mode 100644
index 05a3141..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/GinService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-/**
- * Gin is made from the distillation of white grain spirit and juniper berries.
- * @org.apache.xbean.XBean element="gin" contentProperty="name"
- *
- * @version $Revision: 1.1 $
- */
-public class GinService {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/PizzaService.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/PizzaService.java
deleted file mode 100644
index 0c57936..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/PizzaService.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @org.apache.xbean.XBean element="pizza"
- * description="This is a tasty Pizza"
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-
-// START SNIPPET: bean
-public class PizzaService {
-
- private static final Log log = LogFactory.getLog(PizzaService.class);
-
- private String topping;
- private String cheese;
- private int size;
- private double price;
-
- public void makePizza() {
- log.info("Making a pizza with topping: " + topping + " cheese: " + cheese + " with size: " + size);
- }
-
- public String getCheese() {
- return cheese;
- }
-
- public void setCheese(String cheese) {
- this.cheese = cheese;
- }
-
- public double getPrice() {
- return price;
- }
-
- public void setPrice(double price) {
- this.price = price;
- }
-
- public int getSize() {
- return size;
- }
-
- public void setSize(int size) {
- this.size = size;
- }
-
- /**
- * @org.apache.xbean.Property alias="myTopping"
- */
- public String getTopping() {
- return topping;
- }
-
- public void setTopping(String topping) {
- this.topping = topping;
- }
-
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/QNameService.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/QNameService.java
deleted file mode 100644
index 2ea873f..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/QNameService.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * @org.apache.xbean.XBean element="qname-service"
- * @author gnodet
- */
-public class QNameService {
-
- private QName[] services;
- private List list;
-
- public QName[] getServices() {
- return services;
- }
-
- public void setServices(QName[] services) {
- this.services = services;
- }
-
- public List getList() {
- return list;
- }
-
- public void setList(List list) {
- this.list = list;
- }
-
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/Recipe.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/Recipe.java
deleted file mode 100644
index caf46fa..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/Recipe.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-/**
- * @org.apache.xbean.XBean element="recipe"
- * @author Dan Diephouse
- */
-public class Recipe
-{
- private String ingredients;
- private String instructions;
-
- public String getInstructions()
- {
- return instructions;
- }
-
- public void setInstructions(String instructions)
- {
- this.instructions = instructions;
- }
-
- public String getIngredients()
- {
- return ingredients;
- }
-
- public void setIngredients(String ingredients)
- {
- this.ingredients = ingredients;
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/RecipeService.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/RecipeService.java
deleted file mode 100644
index 2dc5576..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/RecipeService.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import java.util.List;
-/**
- * @org.apache.xbean.XBean element="recipe-service"
- * @author Dan Diephouse
- */
-public class RecipeService
-{
- private List recipes;
- private Recipe topRecipe;
-
- /**
- * @org.apache.xbean.FlatCollection childElement="recipe"
- * @return
- */
- public List getRecipes()
- {
- return recipes;
- }
-
- public void setRecipes(List recipes)
- {
- this.recipes = recipes;
- }
-
- /**
- * @org.apache.xbean.Flat
- * @return
- */
- public Recipe getTopRecipe() {
- return topRecipe;
- }
-
- public void setTopRecipe(Recipe topRecipe) {
- this.topRecipe = topRecipe;
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/RestaurantService.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/RestaurantService.java
deleted file mode 100644
index 20985c5..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/RestaurantService.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import javax.xml.namespace.QName;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * An owner POJO used for testing out nested properties
- *
- * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/pizza" element="restaurant"
- * description="A Restaurant thingy"
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-public class RestaurantService {
-
- private PizzaService favourite;
- private List dinnerMenu;
- private PizzaService[] lunchMenu;
- private QName serviceName;
- private URI uri;
-
- /**
- * @org.apache.xbean.Property nestedType="org.apache.xbean.spring.example.PizzaService"
- */
- public List getDinnerMenu() {
- return dinnerMenu;
- }
-
- public void setDinnerMenu(List dinnerMenu) {
- this.dinnerMenu = dinnerMenu;
- }
-
- public PizzaService[] getLunchMenu() {
- return lunchMenu;
- }
-
- public void setLunchMenu(PizzaService[] lunchMenu) {
- this.lunchMenu = lunchMenu;
- }
-
- public PizzaService getFavourite() {
- return favourite;
- }
-
- public void setFavourite(PizzaService favourite) {
- this.favourite = favourite;
- }
-
- public QName getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(QName name) {
- this.serviceName = name;
- }
-
- public URI getUri() {
- return uri;
- }
-
- public void setUri(URI uri) {
- this.uri = uri;
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/SaladService.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/SaladService.java
deleted file mode 100644
index 157ec14..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/SaladService.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.example;
-
-/**
- * Basic salad.
- * @org.apache.xbean.XBean
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-
-// START SNIPPET: bean
-public class SaladService {
- private final String dressing;
- private final String size;
- private final boolean crouton;
-
- public SaladService(String dressing, String size, boolean crouton) {
- this.dressing = dressing;
- this.size = size;
- this.crouton = crouton;
- }
-
- /**
- * Dressing What type of dressing do you want?
- */
- public String getDressing() {
- return dressing;
- }
-
- /**
- * What size do you want?
- */
- public String getSize() {
- return size;
- }
-
- /**
- * Do you want crutons on that?
- * @org.apache.xbean.Property alias="addCroutons"
- */
- public boolean isCrouton() {
- return crouton;
- }
-}
-// END SNIPPET: bean
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/SoupService.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/SoupService.java
deleted file mode 100644
index 6aaa7da..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/SoupService.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @org.apache.xbean.XBean element="soup"
- * description="This is a tasty soup"
- *
- * @author Dain Sundstrom
- * @version $Id$
- * @since 2.0
- */
-
-// START SNIPPET: bean
-public class SoupService {
- private static final Log log = LogFactory.getLog(SoupService.class);
-
- /**
- * @org.apache.xbean.FactoryMethod
- */
- public static SoupService newSoup(String type) {
- return new SoupService(type, System.currentTimeMillis());
- }
-
- private final String type;
- private final long createTime;
- private boolean exists = false;
-
- private SoupService(String type, long createTime) {
- this.type = type;
- this.createTime = createTime;
- }
-
- /**
- * @org.apache.xbean.InitMethod
- */
- public void make() {
- log.info("Making " + type + "soup");
- exists = true;
- }
-
- /**
- * @org.apache.xbean.DestroyMethod
- */
- public void eat() {
- log.info("Mummmm " + type + "soup is yummie!");
- exists = false;
- }
-
- public boolean exists() {
- return exists;
- }
-
- /**
- * What type of soup would you like?
- */
- public String getType() {
- return type;
- }
-
- public long getCreateTime() {
- return createTime;
- }
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/VodkaService.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/VodkaService.java
deleted file mode 100644
index 94cc23b..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/VodkaService.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-/**
- * It comes from a potatoe, it must be good.
- *
- * @org.apache.xbean.XBean element="vodka"
- *
- * @author Dan Diephouse
- * @version $Id$
- * @since 2.0
- */
-
-// START SNIPPET: bean
-public class VodkaService {
- private String id;
- private String name;
- private Class vodkaClass;
-
- public VodkaService() {
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Class getVodkaClass() {
- return vodkaClass;
- }
-
- public void setVodkaClass(Class vodkaClass) {
- this.vodkaClass = vodkaClass;
- }
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/WineService.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/WineService.java
deleted file mode 100644
index 143a02f..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/example/WineService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.example;
-
-/**
- * A drop of nice
- *
- * @org.apache.xbean.XBean element="wine"
- *
- * @author James Strachan
- * @version $Id$
- * @since 2.0
- */
-
-// START SNIPPET: bean
-public class WineService {
- private String id;
- private String name;
-
- public WineService(String id, String name) {
- this.id = id;
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-}
-// END SNIPPET: bean
-
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/generator/ModelTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/generator/ModelTest.java
deleted file mode 100644
index 562030f..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/generator/ModelTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.spring.generator;
-
-import java.beans.PropertyEditorManager;
-import java.io.File;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-/**
- * @author Dain Sundstrom
- * @version $Id$
- * @since 1.0
- */
-public class ModelTest extends TestCase {
- private static final String DEFAULT_NAMESPACE = "http://xbean.apache.org/test";
-
- public void testQdox() throws Exception{
- String basedir = System.getProperties().getProperty("basedir", ".");
- QdoxMappingLoader mappingLoader = new QdoxMappingLoader(DEFAULT_NAMESPACE, new File[] { new File(basedir, "/src/test")});
- Set namespaces = mappingLoader.loadNamespaces();
- validateModel(namespaces);
- }
-
- private void validateModel(Set namespaces) {
- assertFalse(namespaces.isEmpty());
-
- NamespaceMapping defaultNamespace = null;
- for (Iterator iterator = namespaces.iterator(); iterator.hasNext();) {
- NamespaceMapping namespaceMapping = (NamespaceMapping) iterator.next();
- if (namespaceMapping.getNamespace().equals(DEFAULT_NAMESPACE)) {
- defaultNamespace = namespaceMapping;
- break;
- }
- }
- assertNotNull(defaultNamespace);
- ElementMapping element = defaultNamespace.getElement("pizza");
- assertNotNull(element);
- AttributeMapping attribute = element.getAttribute("myTopping");
- assertNotNull(attribute);
- assertEquals("topping", attribute.getPropertyName());
-
- ElementMapping beer = defaultNamespace.getElement("beer");
- assertNotNull(beer);
- AttributeMapping beerId = beer.getAttribute("id");
- assertNotNull(beerId);
- AttributeMapping beerName = beer.getAttribute("name");
- assertNotNull(beerName);
-
- ElementMapping recipeService = defaultNamespace.getElement("recipe-service");
- assertNotNull(recipeService);
-
- Map flatCollections = recipeService.getFlatCollections();
- assertNotNull(flatCollections);
- assertEquals(1, flatCollections.size());
- }
-
- public void testPropertyEditor() {
- List editorSearchPath = new LinkedList(Arrays.asList(PropertyEditorManager.getEditorSearchPath()));
- editorSearchPath.add("org.apache.xbean.spring.context.impl");
- PropertyEditorManager.setEditorSearchPath((String[]) editorSearchPath.toArray(new String[editorSearchPath.size()]));
- assertTrue(Utils.isSimpleType(Type.newSimpleType("java.net.URI")));
- }
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/jndi/DefaultContextTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/jndi/DefaultContextTest.java
deleted file mode 100644
index 1a78822..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/jndi/DefaultContextTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.jndi;
-
-import javax.naming.Context;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-import java.util.Hashtable;
-
-import junit.framework.TestCase;
-
-/**
- * @version $Revision: 657 $
- */
-public class DefaultContextTest extends TestCase {
- Context context = new DefaultContext(new Hashtable());
-
- public void testSimpleName() throws Exception {
- assertContextNamed("name");
- }
-
- public void testNestedName() throws Exception {
- assertContextNamed("jdbc/name");
- }
-
- public void testDoubleNestedName() throws Exception {
- assertContextNamed("jdbc/foo/name");
- }
-
- protected void assertContextNamed(String name) throws NamingException {
- context.bind(name, "James");
- assertJNDILookup(name, "James");
-
- context.rebind(name, "Rob");
- assertJNDILookup(name, "Rob");
-
- context.unbind(name);
-
- try {
- context.lookup(name);
- fail("Should ave thrown NameNotFoundException!");
- }
- catch (NameNotFoundException e) {
- System.out.println("Caught expected exception: " + e);
- }
- }
-
- protected void assertJNDILookup(String name, String expected) throws NamingException {
- Object value = context.lookup(name);
- assertEquals("Lookup failed for: " + name, expected, value);
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/jndi/JndiTest.java b/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/jndi/JndiTest.java
deleted file mode 100644
index bc2c7ee..0000000
--- a/trunk/xbean-spring-v2/src/test/java/org/apache/xbean/spring/jndi/JndiTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-package org.apache.xbean.spring.jndi;
-
-import org.springframework.beans.factory.BeanFactory;
-import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import java.util.Hashtable;
-
-import junit.framework.TestCase;
-
-public class JndiTest extends TestCase {
-
- protected InitialContext createInitialContext() throws Exception {
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, SpringInitialContextFactory.class.getName());
- env.put(Context.PROVIDER_URL, "classpath:org/apache/xbean/spring/jndi/jndi.xml");
- return new InitialContext(env);
- }
-
- public void testSpringJNDILookup() throws Exception {
- InitialContext context = createInitialContext();
- assertEntryExists(context, "test");
- assertEntryExists(context, "test/restaurant");
- }
-
- public void testConfigureJndiInsideSpringXml() throws Exception {
- // lets load a spring context
-
- BeanFactory factory = new ClassPathXmlApplicationContext("org/apache/xbean/spring/jndi/spring.xml");
- Object test = factory.getBean("restaurant");
- assertNotNull("Should have found the test object", test);
- Object jndi = factory.getBean("jndi");
- assertNotNull("Should have found the jndi object", jndi);
-
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, SpringInitialContextFactory.class.getName());
- InitialContext context = new InitialContext(env);
- assertEntryExists(context, "test");
- assertEntryExists(context, "test/restaurant");
- assertSame(test, context.lookup("test/restaurant"));
- }
-
- protected void assertEntryExists(InitialContext context, String name) throws NamingException {
- Object value = context.lookup(name);
- assertNotNull(name + " should not be null", value);
- }
-
-}
diff --git a/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/pizza-simple b/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/pizza-simple
deleted file mode 100644
index e4d950d..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/pizza-simple
+++ /dev/null
@@ -1,10 +0,0 @@
-# START SNIPPET: config
-
-# the default package that POJOs are in
-package = org.apache.xbean.spring.example
-
-# Mapping of XML Element localNames to classes
-pizza = org.apache.xbean.spring.example.PizzaService
-restaurant = org.apache.xbean.spring.example.RestaurantService
-
-# END SNIPPET: config
diff --git a/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/restaurant b/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/restaurant
deleted file mode 100644
index 46f8601..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/restaurant
+++ /dev/null
@@ -1,17 +0,0 @@
-# START SNIPPET: config
-
-# the default package that POJOs are in
-package = org.apache.xbean.spring.example
-
-# Mapping of XML Element localNames to classes
-pizza = org.apache.xbean.spring.example.PizzaService
-restaurant = org.apache.xbean.spring.example.RestaurantService
-
-# Mapping of XML Attributes to property names
-pizza.alias.myTopping = topping
-
-# Mapping of nested bean properties
-restaurant.dinnerMenu.list = dinnerMenu
-restaurant.favourite = favourite
-
-# END SNIPPET: config
diff --git a/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/salad b/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/salad
deleted file mode 100644
index 9e2712e..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/salad
+++ /dev/null
@@ -1,15 +0,0 @@
-# START SNIPPET: config
-
-# the default package that POJOs are in
-package = org.apache.xbean.spring.example
-
-# Mapping of XML Element localNames to classes
-salad = org.apache.xbean.spring.example.SaladService
-
-# Mapping of XML Attributes to property names
-salad.alias.addCroutons = crouton
-
-# Mapping of constructor argument names
-org.apache.xbean.spring.example.SaladService(java.lang.String,java.lang.String,boolean).parameterNames=dressing size crouton
-
-# END SNIPPET: config
diff --git a/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/soup b/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/soup
deleted file mode 100644
index 91f5a74..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/META-INF/services/org/apache/xbean/spring/http/xbean.apache.org/schemas/soup
+++ /dev/null
@@ -1,17 +0,0 @@
-# START SNIPPET: config
-
-# the default package that POJOs are in
-package = org.apache.xbean.spring.example
-
-# Mapping of XML Element localNames to classes
-soup = org.apache.xbean.spring.example.SoupService
-
-# Mapping of life-cycle methods
-soup.initMethod = make
-soup.destroyMethod = eat
-soup.factoryMethod = newSoup
-
-# Mapping of constructor argument names
-org.apache.xbean.spring.example.SoupService.newSoup(java.lang.String).parameterNames=type
-
-# END SNIPPET: config
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/bad-attribute.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/bad-attribute.xml
deleted file mode 100644
index 2353f72..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/bad-attribute.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
-
- <b:beer id="123" unknown="Stella" />
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/bad-element.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/bad-element.xml
deleted file mode 100644
index 4b01aaa..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/bad-element.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
-
- <b:unknown id="123" name="Stella" />
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/bad-namespace.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/bad-namespace.xml
deleted file mode 100644
index f90f135..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/bad-namespace.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:b="http://bad-namespace">
-
- <b:beer name="Stella" />
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-normal.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-normal.xml
deleted file mode 100644
index fc4758a..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-normal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="beerService" class="org.apache.xbean.spring.example.BeerService">
- <property name="id" value="123" />
- <property name="name" value="Stella" />
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-xbean-ns.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-xbean-ns.xml
deleted file mode 100644
index b42a123..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-xbean-ns.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza"
- xmlns:s="http://xbean.apache.org/schemas/spring/1.0"
- xmlns="http://xbean.apache.org/schemas/pizza">
-
- <beer b:id="123" id="beerService" name="Stella"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-xbean-system-prop.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-xbean-system-prop.xml
deleted file mode 100644
index a47dbc0..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-xbean-system-prop.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza" xmlns:s="http://xbean.apache.org/schemas/spring/1.0">
-
- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
-
- <b:beer s:id="beerService" id="123" name="${beerType}"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-xbean.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-xbean.xml
deleted file mode 100644
index e29e5c3..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/beer-xbean.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza" xmlns:s="http://xbean.apache.org/schemas/spring/1.0">
-
- <b:beer s:id="beerService" id="123" name="Stella"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/favorite-normal.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/favorite-normal.xml
deleted file mode 100644
index 66d2aee..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/favorite-normal.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="favoriteService" class="org.apache.xbean.spring.example.FavoriteService">
- <property name="favorites">
- <map>
- <entry key="Dan">
- <value>Grey Goose</value>
- </entry>
- </map>
- </property>
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/favorite-xbean.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/favorite-xbean.xml
deleted file mode 100644
index f345c42..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/favorite-xbean.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza" xmlns:s="http://xbean.apache.org/schemas/spring/1.0">
-
- <b:favorite s:id="favoriteService">
- <b:favorites>
- <b:favorite-item person="Dan">Grey Goose</b:favorite-item>
- </b:favorites>
- </b:favorite>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/gin.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/gin.xml
deleted file mode 100644
index 8aaa102..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/gin.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
-
- <b:gin id="ginService">Bombay Sapphire</b:gin>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-normal.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-normal.xml
deleted file mode 100644
index 029d0f3..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-normal.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="pizzaService" class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Salami"/>
- <property name="cheese" value="Edam"/>
- <property name="size" value="17"/>
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-bean-ref.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-bean-ref.xml
deleted file mode 100644
index 2ea5078..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-bean-ref.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:p="http://xbean.apache.org/schemas/pizza">
-
- <bean id="topping" class="java.lang.String">
- <constructor-arg>
- <value>Salami</value>
- </constructor-arg>
- </bean>
-
- <p:pizza id="pizzaService" myTopping="#topping" cheese="##Edam" size="17"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-java.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-java.xml
deleted file mode 100644
index a36974b..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-java.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:p="java://org.apache.xbean.spring.example">
-
- <p:PizzaService id="pizzaService" topping="Salami" cheese="Edam" size="17"/>
-
-</beans>
-
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-properties.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-properties.xml
deleted file mode 100644
index 14ed3fa..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean-properties.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:p="java://org.apache.xbean.spring.example">
-
- <p:PizzaService id="pizzaService">
- topping Salami
- cheese Edam
- size 17
- </p:PizzaService>
-
-</beans>
-
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean.xml
deleted file mode 100644
index b43bfb9..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/pizza-xbean.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:p="http://xbean.apache.org/schemas/pizza">
-
- <p:pizza id="pizzaService" myTopping="Salami" cheese="Edam" size="17"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/qname-normal.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/qname-normal.xml
deleted file mode 100644
index dd84adc..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/qname-normal.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="qnameService" class="org.apache.xbean.spring.example.QNameService">
- <property name="services">
- <list>
- <bean class="javax.xml.namespace.QName">
- <constructor-arg value="urn:foo"/>
- <constructor-arg value="test"/>
- </bean>
- <bean class="javax.xml.namespace.QName">
- <constructor-arg value="urn:foo"/>
- <constructor-arg value="bar"/>
- </bean>
- </list>
- </property>
- <property name="list">
- <list>
- <bean class="javax.xml.namespace.QName">
- <constructor-arg value="urn:foo"/>
- <constructor-arg value="list"/>
- </bean>
- </list>
- </property>
- </bean>
-
-</beans>
\ No newline at end of file
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/qname-xbean.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/qname-xbean.xml
deleted file mode 100644
index ca024cf..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/qname-xbean.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:x="http://xbean.apache.org/schemas/pizza"
- xmlns:foo="urn:foo">
-
- <x:qname-service id="qnameService">
- <x:services>
- <qname>foo:test</qname>
- <qname>foo:bar</qname>
- </x:services>
- <x:list>
- <qname>foo:list</qname>
- </x:list>
- </x:qname-service>
-
-</beans>
\ No newline at end of file
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/recipe-normal.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/recipe-normal.xml
deleted file mode 100644
index 9e6c2dc..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/recipe-normal.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
- <bean id="recipeService" class="org.apache.xbean.spring.example.RecipeService">
- <property name="recipes">
- <list>
- <bean class="org.apache.xbean.spring.example.Recipe">
- <property name="instructions" value="Mash together" />
- <property name="ingredients" value="Food" />
- </bean>
- <bean class="org.apache.xbean.spring.example.Recipe">
- <property name="instructions" value="Mash together" />
- <property name="ingredients" value="Food" />
- </bean>
- </list>
- </property>
- <property name="topRecipe">
- <bean class="org.apache.xbean.spring.example.Recipe">
- <property name="instructions" value="Mash together" />
- <property name="ingredients" value="Food" />
- </bean>
- </property>
- </bean>
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/recipe-xbean.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/recipe-xbean.xml
deleted file mode 100644
index 9c0db0e..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/recipe-xbean.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:x="http://xbean.apache.org/schemas/pizza" xmlns:foo="urn:foo">
-
- <x:recipe-service id="recipeService">
- <x:topRecipe>
- <x:instructions>Mash together</x:instructions>
- <x:ingredients>Food</x:ingredients>
- </x:topRecipe>
- <x:recipe>
- <x:instructions>Mash together</x:instructions>
- <x:ingredients>Food</x:ingredients>
- </x:recipe>
- <x:recipe>
- <x:instructions>Mash together</x:instructions>
- <x:ingredients>Food</x:ingredients>
- </x:recipe>
- </x:recipe-service>
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-normal.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-normal.xml
deleted file mode 100644
index 7c20dc5..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-normal.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <!-- tests using nested beans -->
-
- <bean id="restaurant"
- class="org.apache.xbean.spring.example.RestaurantService">
- <property name="serviceName">
- <bean class="javax.xml.namespace.QName">
- <constructor-arg value="http://acme.com"/>
- <constructor-arg value="xyz"/>
- </bean>
- </property>
- <property name="favourite">
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Salami" />
- <property name="cheese" value="Edam" />
- <property name="size" value="17" />
- </bean>
- </property>
- <property name="dinnerMenu">
- <list>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Ham" />
- <property name="cheese" value="Mozzarella" />
- <property name="size" value="15" />
- </bean>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Eggs" />
- <property name="cheese" value="Mozzarella" />
- <property name="size" value="16" />
- </bean>
- </list>
- </property>
- <property name="lunchMenu">
- <list>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Chicken" />
- <property name="cheese" value="Brie" />
- <property name="size" value="17" />
- </bean>
- </list>
- </property>
- </bean>
-
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-spring-extended.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-spring-extended.xml
deleted file mode 100644
index 653015d..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-spring-extended.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:foo="http://acme.com">
-
- <!-- tests using nested beans -->
-
- <bean id="restaurant"
- class="org.apache.xbean.spring.example.RestaurantService">
- <property name="serviceName" value="foo:xyz"/>
- <property name="favourite">
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Salami" />
- <property name="cheese" value="Edam" />
- <property name="size" value="17" />
- </bean>
- </property>
- <property name="dinnerMenu">
- <list>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Ham" />
- <property name="cheese" value="Mozzarella" />
- <property name="size" value="15" />
- </bean>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Eggs" />
- <property name="cheese" value="Mozzarella" />
- <property name="size" value="16" />
- </bean>
- </list>
- </property>
- <property name="lunchMenu">
- <list>
- <bean class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Chicken" />
- <property name="cheese" value="Brie" />
- <property name="size" value="17" />
- </bean>
- </list>
- </property>
- </bean>
-
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-mixed.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-mixed.xml
deleted file mode 100644
index f95fcfe..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-mixed.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:foo="http://acme.com">
-
- <restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/pizza"
- serviceName="foo:xyz">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <bean xmlns="http://xbean.apache.org/schemas/spring/1.0" class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Eggs"/>
- <property name="cheese" value="Mozzarella"/>
- <property name="size" value="16"/>
- </bean>
- </dinnerMenu>
-
- <lunchMenu>
- <bean xmlns="" class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Chicken"/>
- <property name="cheese" value="Brie"/>
- <property name="size" value="17"/>
- </bean>
- </lunchMenu>
-
- <favourite>
- <bean xmlns="http://xbean.apache.org/schemas/spring/1.0" class="org.apache.xbean.spring.example.PizzaService">
- <property name="topping" value="Salami"/>
- <property name="cheese" value="Edam"/>
- <property name="size" value="17"/>
- </bean>
- </favourite>
- </restaurant>
-</beans>
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-root.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-root.xml
deleted file mode 100644
index 0b1f7aa..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-root.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/restaurant" xmlns:foo="http://acme.com" serviceName="foo:xyz" uri="http://cheese.com">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <pizza myTopping="Eggs" cheese="Mozzarella" size="16"/>
- </dinnerMenu>
-
- <lunchMenu>
- <pizza myTopping="Chicken" cheese="Brie" size="17"/>
- </lunchMenu>
-
- <favourite>
- <pizza myTopping="Salami" cheese="Edam" size="17"/>
- </favourite>
-</restaurant>
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-simple.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-simple.xml
deleted file mode 100644
index 3df2aa2..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean-simple.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans >
-
- <restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/pizza-simple">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <pizza myTopping="Eggs" cheese="Mozzarella" size="16"/>
- </dinnerMenu>
-
- <lunchMenu>
- <pizza myTopping="Chicken" cheese="Brie" size="17"/>
- </lunchMenu>
-
- <favourite>
- <pizza myTopping="Salami" cheese="Edam" size="17"/>
- </favourite>
- </restaurant>
-</beans>
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean.xml
deleted file mode 100644
index baee015..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/restaurant-xbean.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans>
-
- <restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/pizza" xmlns:foo="http://acme.com" serviceName="foo:xyz" uri="http://cheese.com">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <pizza myTopping="Eggs" cheese="Mozzarella" size="16"/>
- </dinnerMenu>
-
- <lunchMenu>
- <pizza myTopping="Chicken" cheese="Brie" size="17"/>
- </lunchMenu>
-
- <favourite>
- <pizza myTopping="Salami" cheese="Edam" size="17"/>
- </favourite>
- </restaurant>
-</beans>
-<!-- END SNIPPET: xml -->
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/salad-normal.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/salad-normal.xml
deleted file mode 100644
index 40fc060..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/salad-normal.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="saladService" class="org.apache.xbean.spring.example.SaladService">
- <constructor-arg index="0" value="Cesar"/>
- <constructor-arg index="1" value="Small"/>
- <constructor-arg index="2" value="true"/>
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/salad-xbean.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/salad-xbean.xml
deleted file mode 100644
index ae1c8f7..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/salad-xbean.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:s="http://xbean.apache.org/schemas/salad">
-
- <s:salad id="saladService" dressing="Cesar" size="Small" addCroutons="true"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/soup-normal.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/soup-normal.xml
deleted file mode 100644
index 89a0d6a..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/soup-normal.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="soupService" class="org.apache.xbean.spring.example.SoupService"
- init-method="make"
- destroy-method="eat"
- factory-method="newSoup"
- >
- <constructor-arg index="0" value="French Onion"/>
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/soup-xbean.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/soup-xbean.xml
deleted file mode 100644
index 8bf1600..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/soup-xbean.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:s="http://xbean.apache.org/schemas/soup">
-
- <s:soup id="soupService" type="French Onion"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/vodka-normal.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/vodka-normal.xml
deleted file mode 100644
index 50129e1..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/vodka-normal.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="vodkaService" class="org.apache.xbean.spring.example.VodkaService">
- <property name="id" value="vodkaService" />
- <property name="name" value="Grey Goose" />
- <property name="vodkaClass" value="org.apache.xbean.spring.example.VodkaService" />
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/vodka-xbean.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/vodka-xbean.xml
deleted file mode 100644
index 4b3b45c..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/vodka-xbean.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
-
- <b:vodka id="vodkaService">
- <b:name>Grey Goose</b:name>
- <b:vodkaClass>org.apache.xbean.spring.example.VodkaService</b:vodkaClass>
- </b:vodka>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/wine-normal.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/wine-normal.xml
deleted file mode 100644
index 443c014..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/wine-normal.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<beans>
-
- <bean id="wineService" class="org.apache.xbean.spring.example.WineService">
- <constructor-arg value="wineService" />
- <constructor-arg value="Amarone" />
- </bean>
-
-</beans>
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/wine-xbean.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/wine-xbean.xml
deleted file mode 100644
index a777af2..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/context/wine-xbean.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: xml -->
-<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
-
- <b:wine id="wineService" name="Amarone"/>
-
-</beans>
-<!-- END SNIPPET: xml -->
-
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/jndi/jndi.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/jndi/jndi.xml
deleted file mode 100644
index 1a605b2..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/jndi/jndi.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- START SNIPPET: jndi -->
-<beans>
- <bean id="jndi" class="org.apache.xbean.spring.jndi.DefaultContext" singleton="true">
- <property name="entries">
- <map>
- <entry key="test/restaurant">
-
- <restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/pizza" xmlns:foo="http://acme.com" serviceName="foo:xyz" uri="http://cheese.com">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <pizza myTopping="Eggs" cheese="Mozzarella" size="16"/>
- </dinnerMenu>
-
- <lunchMenu>
- <pizza myTopping="Chicken" cheese="Brie" size="17"/>
- </lunchMenu>
-
- <favourite>
- <pizza myTopping="Salami" cheese="Edam" size="17"/>
- </favourite>
- </restaurant>
-
- </entry>
- </map>
- </property>
- </bean>
-</beans>
-<!-- END SNIPPET: jndi -->
diff --git a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/jndi/spring.xml b/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/jndi/spring.xml
deleted file mode 100644
index a43a052..0000000
--- a/trunk/xbean-spring-v2/src/test/resources/org/apache/xbean/spring/jndi/spring.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans>
-
- <restaurant id="restaurant" xmlns="http://xbean.apache.org/schemas/pizza" xmlns:foo="http://acme.com" serviceName="foo:xyz" uri="http://cheese.com">
- <dinnerMenu>
- <pizza myTopping="Ham" cheese="Mozzarella" size="15"/>
- <pizza myTopping="Eggs" cheese="Mozzarella" size="16"/>
- </dinnerMenu>
-
- <lunchMenu>
- <pizza myTopping="Chicken" cheese="Brie" size="17"/>
- </lunchMenu>
-
- <favourite>
- <pizza myTopping="Salami" cheese="Edam" size="17"/>
- </favourite>
- </restaurant>
-
- <!-- lets initialise JNDI here -->
- <bean id="jndi" class="org.apache.xbean.spring.jndi.SpringInitialContextFactory" factory-method="makeInitialContext" singleton="true">
- <property name="entries">
- <map>
- <entry key="test/restaurant" value-ref="restaurant" />
- </map>
- </property>
- </bean>
-</beans>
diff --git a/trunk/xbean-spring/pom.xml b/trunk/xbean-spring/pom.xml
deleted file mode 100644
index 81e9689..0000000
--- a/trunk/xbean-spring/pom.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-spring</artifactId>
- <name>XBean :: Spring</name>
- <version>2.4-SNAPSHOT</version>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>dependency-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-components</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <outputDirectory>target/classes</outputDirectory>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-common</artifactId>
- </artifactItem>
- <artifactItem>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-v1</artifactId>
- </artifactItem>
- <artifactItem>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-v2</artifactId>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-v1</artifactId>
- <scope>optional</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring-v2</artifactId>
- <scope>optional</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-telnet/LICENSE.txt b/trunk/xbean-telnet/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-telnet/LICENSE.txt
+++ /dev/null
@@ -1,203 +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/trunk/xbean-telnet/NOTICE.txt b/trunk/xbean-telnet/NOTICE.txt
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-telnet/NOTICE.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-telnet/pom.xml b/trunk/xbean-telnet/pom.xml
deleted file mode 100644
index 45bd50a..0000000
--- a/trunk/xbean-telnet/pom.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-telnet</artifactId>
- <name>XBean :: Telnet</name>
- <version>2.4-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>groovy</groupId>
- <artifactId>groovy</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Command.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Command.java
deleted file mode 100755
index 24598e0..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Command.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.command;
-
-import java.io.InputStream;
-import java.io.PrintStream;
-
-public interface Command {
-
- /**
- * HRC: if we really want to simulate a command line style environment,
- * I think think entry point needs more context data: an std error print stream and
- * a environment map.
- *
- * @param args
- * @param in
- * @param out
- * @return
- */
- public int main(String[] args, InputStream in, PrintStream out);
-
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/CommandRegistry.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/CommandRegistry.java
deleted file mode 100644
index 644c381..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/CommandRegistry.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.command;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-public class CommandRegistry {
-
- protected static final HashMap commands = new HashMap();
-
- static {
- loadCommandList();
- }
-
- protected static final CommandRegistry unknownCommand = new CommandRegistry();
-
- public static Map getCommandMap() {
- HashMap rc = new HashMap();
- for (Iterator iter = commands.keySet().iterator(); iter.hasNext();) {
- String name = (String) iter.next();
- Command command = getCommand(name);
- rc.put(name, command);
- }
- return rc;
- }
-
- public static void register(String name, Command cmd) {
- commands.put(name, cmd);
- }
-
- public static void register(String name, Class cmd) {
- commands.put(name, cmd);
- }
-
- public static Command getCommand(String name) {
- Object cmd = commands.get(name);
- if (cmd instanceof Class) {
- cmd = loadCommand((Class) cmd);
- register(name, (Command) cmd);
- }
- return (Command) cmd;
- }
-
-
- // - Protected methods - //
- protected static Command loadCommand(Class commandClass) {
- Command cmd = null;
- try {
- cmd = (Command) commandClass.newInstance();
- } catch (Exception e) {
- //throw new IOException("Cannot instantiate command class "+commandClass+"\n"+e.getClass().getName()+":\n"+e.getMessage());
- }
- return cmd;
- }
-
- /**
- * TODO: Replace this part with the classpath magic
- */
- protected static void loadCommandList() {
- Exit.register();
- Help.register();
- Lookup.register();
- Version.register();
- GroovySh.register();
- }
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/CommandShell.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/CommandShell.java
deleted file mode 100755
index 7431fdb..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/CommandShell.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.command;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-
-public class CommandShell implements Command {
-
- private final String prompt;
-
- public CommandShell(String serverName) {
- serverName = serverName.toLowerCase();
- prompt = TTY_Reset + TTY_Bright + "["+serverName+"]$ " + TTY_Reset;
- }
-
- private boolean stop = false;
- private int rc = 0;
-
- public static final char ESC = (char) 27;
- public static final String TTY_Reset = ESC + "[0m";
- public static final String TTY_Bright = ESC + "[1m";
- public static final String TTY_Dim = ESC + "[2m";
- public static final String TTY_Underscore = ESC + "[4m";
- public static final String TTY_Blink = ESC + "[5m";
- public static final String TTY_Reverse = ESC + "[7m";
- public static final String TTY_Hidden = ESC + "[8m";
- /* Foreground Colors */
- public static final String TTY_FG_Black = ESC + "[30m";
- public static final String TTY_FG_Red = ESC + "[31m";
- public static final String TTY_FG_Green = ESC + "[32m";
- public static final String TTY_FG_Yellow = ESC + "[33m";
- public static final String TTY_FG_Blue = ESC + "[34m";
- public static final String TTY_FG_Magenta = ESC + "[35m";
- public static final String TTY_FG_Cyan = ESC + "[36m";
- public static final String TTY_FG_White = ESC + "[37m";
- /* Background Colors */
- public static final String TTY_BG_Black = ESC + "[40m";
- public static final String TTY_BG_Red = ESC + "[41m";
- public static final String TTY_BG_Green = ESC + "[42m";
- public static final String TTY_BG_Yellow = ESC + "[43m";
- public static final String TTY_BG_Blue = ESC + "[44m";
- public static final String TTY_BG_Magenta = ESC + "[45m";
- public static final String TTY_BG_Cyan = ESC + "[46m";
- public static final String TTY_BG_White = ESC + "[47m";
-
- public int main(String[] args, InputStream input, PrintStream out) {
-
- DataInputStream in = new DataInputStream(input);
- while (!stop) {
- prompt(in, out);
- }
- return rc;
- }
-
- protected void prompt(DataInputStream in, PrintStream out) {
- try {
- out.print(prompt);
- out.flush();
-
- String commandline = in.readLine();
- if( commandline == null ) {
- this.stop = true;
- return;
- }
- commandline = commandline.trim();
- if (commandline.length() < 1) {
- return;
- }
-
- String command = commandline;
-
- StringTokenizer cmdstr = new StringTokenizer(command);
- command = cmdstr.nextToken();
-
- // Get parameters
- Vector p = new Vector();
- while ( cmdstr.hasMoreTokens() ) {
- p.add(cmdstr.nextToken());
- }
- String[] args = new String[p.size()];
- p.copyInto(args);
-
- Command cmd = CommandRegistry.getCommand(command);
-
- if (cmd == null) {
- out.print(command);
- out.println(": command not found");
- } else {
- cmd.main(args, in, out);
- }
- } catch (UnsupportedOperationException e) {
- this.rc=-1;
- this.stop = true;
- } catch (Throwable e) {
- e.printStackTrace(out);
- this.rc=-1;
- this.stop = true;
- }
- }
-
- protected void badCommand(DataInputStream in, PrintStream out) throws IOException {
- //asdf: command not found
- }
-
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Exit.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Exit.java
deleted file mode 100755
index a91045e..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Exit.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.command;
-
-import java.io.InputStream;
-import java.io.PrintStream;
-
-public class Exit implements Command {
-
- public static void register() {
- CommandRegistry.register("exit", Exit.class);
- }
-
- public int main(String[] args, InputStream in, PrintStream out) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/GroovySh.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/GroovySh.java
deleted file mode 100755
index 79dbeeb..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/GroovySh.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.command;
-
-import groovy.lang.GroovyShell;
-import org.codehaus.groovy.runtime.InvokerHelper;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-
-public class GroovySh implements Command {
- public static void register() {
- CommandRegistry.register("groovysh", GroovySh.class);
- }
-
- public int main(String[] args, InputStream in, PrintStream out) {
- GroovyShell shell = new GroovyShell();
- BufferedReader reader = new BufferedReader(new InputStreamReader(in));
- String version = InvokerHelper.getVersion();
- out.println("Lets get Groovy!");
- out.println("================");
- out.println("Version: " + version + " JVM: " + System.getProperty("java.vm.version"));
- out.println("Hit carriage return twice to execute a command");
- out.println("The command 'quit' will terminate the shell");
- int counter = 1;
- while (true) {
- StringBuffer buffer = new StringBuffer();
- while (true) {
- out.print("groovy> ");
- String line;
- try {
- line = reader.readLine();
- } catch (IOException e) {
- out.println("Caught: " + e);
- e.printStackTrace();
- return -1;
- }
- if (line != null) {
- buffer.append(line);
- buffer.append('\n');
- }
- if (line == null || line.trim().length() == 0) {
- break;
- }
- }
- String command = buffer.toString().trim();
- if (command == null || command.equals("quit")) {
- break;
- }
- try {
- Object answer = shell.evaluate(command, "CommandLine" + counter++ + ".groovy");
- out.println(InvokerHelper.inspect(answer));
- } catch (Exception e) {
- out.println("Caught: " + e);
- e.printStackTrace();
- }
- }
- return 0;
- }
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Help.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Help.java
deleted file mode 100755
index dbd2c5e..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Help.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.command;
-
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-public class Help implements Command {
- public static void register() {
- CommandRegistry.register("help", Help.class);
- }
-
- public int main(String[] args, InputStream in, PrintStream out) {
- Map hash = CommandRegistry.getCommandMap();;
- Set set = hash.keySet();
- Iterator cmds = set.iterator();
- while (cmds.hasNext()) {
- out.print(" " + cmds.next());
- out.println("");
- }
- return 0;
- }
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Lookup.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Lookup.java
deleted file mode 100755
index 958535a..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Lookup.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.command;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameClassPair;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingEnumeration;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-
-public class Lookup implements Command {
-
- private final javax.naming.Context ctx;
-
- public Lookup() throws Exception {
- this(new InitialContext());
- }
-
- public Lookup(Context ctx) {
- this.ctx = ctx;
- }
-
- public static void register() {
- try {
- Lookup cmd = new Lookup();
- CommandRegistry.register("lookup", cmd);
- } catch (Exception e) {
- }
- }
-
- private static String PWD = "";
-
- // execute jndi lookups
- public int main(String[] args, InputStream in, PrintStream out) {
- try {
- String name = "";
- if (args == null || args.length == 0) {
- name = PWD;
- } else {
- name = args[0];
- }
- Object obj = null;
- try {
- obj = ctx.lookup(name);
- } catch (NameNotFoundException e) {
- out.print("lookup: ");
- out.print(name);
- out.println(": No such object or subcontext");
- return -1;
- } catch (Throwable e) {
- out.print("lookup: error: ");
- e.printStackTrace(new PrintStream(out));
- return -1;
- }
- if (obj instanceof Context) {
- list(name, in, out);
- return 0;
- }
- // TODO:1: Output the different data types differently
- out.println("" + obj);
- return 0;
-
- } catch (Exception e) {
- e.printStackTrace(new PrintStream(out));
- return -2;
- }
- }
-
- public void list(String name, InputStream in, PrintStream out) throws IOException {
- try {
- NamingEnumeration names = null;
- try {
- names = ctx.list(name);
- } catch (NameNotFoundException e) {
- out.print("lookup: ");
- out.print(name);
- out.println(": No such object or subcontext");
- return;
- } catch (Throwable e) {
- out.print("lookup: error: ");
- e.printStackTrace(new PrintStream(out));
- return;
- }
- if (names == null) {
- return;
- }
- while (names.hasMore()) {
- NameClassPair entry = (NameClassPair) names.next();
- out.println(entry.getName());
- }
- } catch (Exception e) {
- e.printStackTrace(new PrintStream(out));
- }
- }
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Test.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Test.java
deleted file mode 100755
index 005d49e..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Test.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.command;
-
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.PrintStream;
-
-/**
- * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
- */
-public class Test implements Command {
-
- public static void _DONT_register() {
- CommandRegistry.register("test", Test.class);
- }
-
- public int main(String[] args, InputStream in, PrintStream out) {
- try {
- InputStream file = new FileInputStream("print.txt");
- int b = file.read();
- while (b != -1) {
- out.write(b);
- b = file.read();
- }
- } catch (Exception e) {
- e.printStackTrace();
- return -1;
- }
- return 0;
- }
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Version.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Version.java
deleted file mode 100755
index 7db9518..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/command/Version.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.command;
-
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.net.URL;
-import java.util.Properties;
-
-public class Version implements Command {
-
- public static void register() {
- CommandRegistry.register("version", Version.class);
- }
-
- public int main(String[] args, InputStream in, PrintStream out) {
- /*
- * Output startup message
- */
- Properties versionInfo = new Properties();
- try {
- versionInfo.load(new URL("resource:/openejb-version.properties").openConnection().getInputStream());
- } catch (java.io.IOException e) {
- }
- out.print("OpenEJB Remote Server ");
- out.print(versionInfo.getProperty("version"));
- out.print(" build: ");
- out.print(versionInfo.getProperty("date"));
- out.print("-");
- out.println(versionInfo.getProperty("time"));
- out.println(versionInfo.getProperty("url"));
- return 0;
- }
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/console/Main.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/console/Main.java
deleted file mode 100644
index 57f8671..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/console/Main.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.apache.xbean.terminal.console;
-
-import org.apache.xbean.command.CommandShell;
-
-public class Main {
-
- public static void main(String[] args) {
- CommandShell shell = new CommandShell("localhost");
- System.exit(shell.main(new String[]{}, System.in, System.out));
- }
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetCodes.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetCodes.java
deleted file mode 100755
index 0506133..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetCodes.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.terminal.telnet;
-
-public interface TelnetCodes {
- /**
- * End of subnegotiation parameters.
- * <p/>
- * Name: SE
- * Code: 240
- */
- public static final int SE = 240;
- /**
- * No operation.
- * <p/>
- * Name: NOP
- * Code: 241
- */
- public static final int NOP = 241;
- /**
- * The data stream portion of a Synch.
- * This should always be accompanied
- * by a TCP Urgent notification.
- * <p/>
- * Name: Data Mark
- * Code: 242
- */
- public static final int Data_Mark = 242;
- /**
- * NVT character BRK.
- * <p/>
- * Name: Break
- * Code: 243
- */
- public static final int Break = 243;
- /**
- * The function IP.
- * <p/>
- * Name: Interrupt Process
- * Code: 244
- */
- public static final int Interrupt_Process = 244;
- /**
- * The function AO.
- * <p/>
- * Name: Abort output
- * Code: 245
- */
- public static final int Abort_output = 245;
- /**
- * The function AYT.
- * <p/>
- * Name: Are You There
- * Code: 246
- */
- public static final int Are_You_There = 246;
- /**
- * The function EC.
- * <p/>
- * Name: Erase character
- * Code: 247
- */
- public static final int Erase_character = 247;
- /**
- * The function EL.
- * <p/>
- * Name: Erase Line
- * Code: 248
- */
- public static final int Erase_Line = 248;
- /**
- * The GA signal.
- * <p/>
- * Name: Go ahead
- * Code: 249
- */
- public static final int Go_ahead = 249;
- /**
- * Indicates that what follows is
- * subnegotiation of the indicated
- * option.
- * <p/>
- * Name: SB
- * Code: 250
- */
- public static final int SB = 250;
- /**
- * Indicates the desire to begin
- * performing, or confirmation that
- * you are now performing, the
- * indicated option.
- * <p/>
- * Name: WILL (option code)
- * Code: 251
- */
- public static final int WILL = 251;
- /**
- * Indicates the refusal to perform,
- * or continue performing, the
- * indicated option.
- * <p/>
- * Name: WON'T (option code)
- * Code: 252
- */
- public static final int WONT = 252;
- /**
- * Indicates the request that the
- * other party perform, or
- * confirmation that you are expecting
- * he other party to perform, the
- * ndicated option.
- * <p/>
- * Name: DO (option code)
- * Code: 253
- */
- public static final int DO = 253;
- /**
- * Indicates the demand that the
- * other party stop performing,
- * or confirmation that you are no
- * longer expecting the other party
- * to perform, the indicated option.
- * <p/>
- * Name: DON'T (option code)
- * Code: 254
- */
- public static final int DONT = 254;
- /**
- * Interpret as command
- * aka Data Byte
- * <p/>
- * Name: IAC
- * Code: 255
- */
- public static final int IAC = 255;
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetDaemon.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetDaemon.java
deleted file mode 100644
index 6f6036c..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetDaemon.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.terminal.telnet;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-public class TelnetDaemon implements Runnable {
-
- private final TelnetShell shell;
- private final int port;
-
- private ServerSocket serverSocket;
-
- /**
- * We start out in a "stopped" state until someone calls the start method.
- */
- private boolean stop = true;
-
- public TelnetDaemon(String serverName, int port) {
- this.port = port;
- this.shell = new TelnetShell(serverName);
- }
-
- public void start() throws Exception {
- synchronized (this) {
- // Don't bother if we are already started/starting
- if (!stop)
- return;
-
- stop = false;
-
- // Do our stuff
- try {
- serverSocket = new ServerSocket(port, 20);
- Thread d = new Thread(this);
- d.setName("service.shell@" + d.hashCode());
- d.setDaemon(true);
- d.start();
- } catch (Exception e) {
- throw new Exception("Service failed to start.", e);
- }
- }
- }
-
- public void stop() throws Exception {
- synchronized (this) {
- if (stop) {
- return;
- }
- stop = true;
- try {
- this.notifyAll();
- } catch (Throwable t) {
- t.printStackTrace();
- }
- }
- }
-
- public synchronized void service(final Socket socket) throws IOException {
- Thread d = new Thread(new Runnable() {
- public void run() {
- try {
- shell.service(socket);
- } catch (SecurityException e) {
- } catch (Throwable e) {
- } finally {
- try {
- if (socket != null)
- socket.close();
- } catch (Throwable t) {
- }
- }
- }
- });
- d.setDaemon(true);
- d.start();
- }
-
- public void run() {
-
- Socket socket = null;
-
- while (!stop) {
- try {
- socket = serverSocket.accept();
- socket.setTcpNoDelay(true);
- if (!stop) service(socket);
- } catch (SecurityException e) {
- } catch (Throwable e) {
- }
- }
- }
-
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetInputStream.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetInputStream.java
deleted file mode 100755
index e17d268..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetInputStream.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.terminal.telnet;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class TelnetInputStream extends FilterInputStream implements TelnetCodes {
- // state table for what options have been negotiated
- private TelnetOption[] options = new TelnetOption[256];
- private OutputStream out = null;
-
- /**
- * We haven yet implemented any Telnet options, so we just explicitly
- * disable some common options for safety sake.
- * <p/>
- * Certain Telnet clients (MS Windows Telnet) are enabling options without
- * asking first. Shame, shame, shame.
- *
- * @throws IOException
- */
- public TelnetInputStream(InputStream in, OutputStream out) throws IOException {
- super(in);
- this.out = out;
- negotiateOption(DONT, 1);
- negotiateOption(DONT, 6);
- negotiateOption(DONT, 24);
- negotiateOption(DONT, 33);
- negotiateOption(DONT, 34);
- }
-
- public int read() throws IOException {
- int b = super.read();
- if (b == IAC) {
- // The cosole has a reference
- // to this input stream
- processCommand();
- // Call read recursively as
- // the next character could
- // also be a command
- b = this.read();
- }
- //System.out.println("B="+b);
- return b;
- }
-
- /**
- * This is only called by TelnetInputStream
- * it is assumed that the IAC byte has already been read from the stream.
- *
- * @throws IOException
- */
- private void processCommand() throws IOException {
- // Debug statement
- print("C: IAC ");
- int command = super.read();
- switch (command) {
- case WILL:
- senderWillEnableOption(super.read());
- break;
- case DO:
- pleaseDoEnableOption(super.read());
- break;
- case WONT:
- senderWontEnableOption(super.read());
- break;
- case DONT:
- pleaseDontEnableOption(super.read());
- break;
- default:
- unimplementedCommand(command);
- break;
- }
- }
-
- private void unimplementedCommand(int command) {
- println(command + ": command not found");
- }
-
- /**
- * Client says: I will enable OptionX
- * <p/>
- * If the sender initiated the negotiation of the
- * option, we must send a reply. Replies can be DO or DON'T.
- *
- * @param optionID
- * @throws IOException
- */
- private void senderWillEnableOption(int optionID) throws IOException {
- // Debug statement
- println("WILL " + optionID);
- TelnetOption option = getOption(optionID);
- if (option.hasBeenNegotiated()) return;
- if (option.isInNegotiation()) {
- option.enable();
- } else if (!option.isInNegotiation() && option.isSupported()) {
- negotiateOption(DO, optionID);
- option.enable();
- } else if (!option.isInNegotiation() && !option.isSupported()) {
- negotiateOption(DONT, optionID);
- option.disable();
- }
- }
-
- /**
- * Client says: Please, do enable OptionX
- * <p/>
- * If the sender initiated the negotiation of the
- * option, we must send a reply.
- * <p/>
- * Replies can be WILL or WON'T.
- *
- * @param optionID
- * @throws IOException
- */
- private void pleaseDoEnableOption(int optionID) throws IOException {
- // Debug statement
- println("DO " + optionID);
- TelnetOption option = getOption(optionID);
- if (option.hasBeenNegotiated()) return;
- if (option.isInNegotiation()) {
- option.enable();
- } else if (!option.isInNegotiation() && option.isSupported()) {
- negotiateOption(WILL, optionID);
- option.enable();
- } else if (!option.isInNegotiation() && !option.isSupported()) {
- negotiateOption(WONT, optionID);
- option.disable();
- }
- }
-
- /**
- * Client says: I won't enable OptionX
- * <p/>
- * <p/>
- * If the sender initiated the negotiation of the
- * option, we must send a reply.
- * <p/>
- * Replies can only be DON'T.
- *
- * @param optionID
- * @throws IOException
- */
- private void senderWontEnableOption(int optionID) throws IOException {
- println("WONT " + optionID);
- TelnetOption option = getOption(optionID);
- if (option.hasBeenNegotiated()) return;
- if (!option.isInNegotiation()) {
- negotiateOption(DONT, optionID);
- }
- option.disable();
- }
-
- /**
- * Client says: Please, don't enable OptionX
- * <p/>
- * If the sender initiated the negotiation of the
- * option, we must send a reply.
- * <p/>
- * Replies can only be WON'T.
- *
- * @param optionID
- * @throws IOException
- */
- private void pleaseDontEnableOption(int optionID) throws IOException {
- // Debug statement
- println("DONT " + optionID);
- TelnetOption option = getOption(optionID);
- if (option.hasBeenNegotiated()) return;
- if (!option.isInNegotiation()) {
- negotiateOption(WONT, optionID);
- }
- option.disable();
- }
-
- // TODO:0: Replace with actual logging
- private void println(String s) {
- // System.out.println(s);
- }
-
- // TODO:0: Replace with actual logging
- private void print(String s) {
- // System.out.print(s);
- }
-
- /**
- * Send an option negitiation command to the client
- *
- * @param negotiate
- * @param optionID
- * @throws IOException
- */
- private void negotiateOption(int negotiate, int optionID)
- throws IOException {
- TelnetOption option = getOption(optionID);
- option.isInNegotiation(true);
- String n = null;
- switch (negotiate) {
- case WILL:
- n = "WILL ";
- break;
- case DO:
- n = "DO ";
- break;
- case WONT:
- n = "WONT ";
- break;
- case DONT:
- n = "DONT ";
- break;
- }
- // Debug statement
- println("S: IAC " + n + optionID);
- synchronized (out) {
- out.write(IAC);
- out.write(negotiate);
- out.write(optionID);
- }
- }
-
- private TelnetOption getOption(int optionID) {
- TelnetOption opt = options[optionID];
- if (opt == null) {
- opt = new TelnetOption(optionID);
- options[optionID] = opt;
- }
- return opt;
- }
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetOption.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetOption.java
deleted file mode 100755
index d1e28dd..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetOption.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.terminal.telnet;
-
-public class TelnetOption {
-
- private int optionCode;
- private boolean supported;
- private boolean enabled;
- private boolean negotiated;
- private boolean inNegotiation;
-
- public TelnetOption(int optionCode) {
- this.optionCode = optionCode;
- }
-
- public int getOptionId() {
- return optionCode;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void enable() {
- enabled = true;
- negotiated = true;
- }
-
- public void disable() {
- enabled = false;
- negotiated = true;
- }
-
- public boolean isSupported() {
- return supported;
- }
-
- public boolean isInNegotiation() {
- return inNegotiation;
- }
-
- public void isInNegotiation(boolean inNegotiation) {
- this.inNegotiation = inNegotiation;
- }
-
- public boolean hasBeenNegotiated() {
- return negotiated;
- }
-
- public void hasBeenNegotiated(boolean negotiated) {
- this.negotiated = negotiated;
- this.inNegotiation = false;
- }
-}
\ No newline at end of file
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetPrintStream.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetPrintStream.java
deleted file mode 100755
index b6e96e1..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetPrintStream.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.terminal.telnet;
-
-import java.io.OutputStream;
-import java.io.PrintStream;
-
-public class TelnetPrintStream extends PrintStream {
- private final byte[] CRLF = new byte[]{(byte) '\r', (byte) '\n'};
-
- public TelnetPrintStream(OutputStream out) {
- super(out);
- }
-
- public void println() {
- newLine();
- }
-
- public void println(String x) {
- synchronized (this) {
- print(x);
- newLine();
- }
- }
-
- public void println(long x) {
- synchronized (this) {
- print(x);
- newLine();
- }
- }
-
- public void println(char x) {
- synchronized (this) {
- print(x);
- newLine();
- }
- }
-
- public void println(boolean x) {
- synchronized (this) {
- print(x);
- newLine();
- }
- }
-
- public void println(float x) {
- synchronized (this) {
- print(x);
- newLine();
- }
- }
-
- public void println(double x) {
- synchronized (this) {
- print(x);
- newLine();
- }
- }
-
- public void println(int x) {
- synchronized (this) {
- print(x);
- newLine();
- }
- }
-
- public void println(char x[]) {
- synchronized (this) {
- print(x);
- newLine();
- }
- }
-
- private void newLine() {
- try {
- this.write(CRLF);
- } catch (Exception e) {
- }
- }
-}
diff --git a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetShell.java b/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetShell.java
deleted file mode 100755
index 9c00859..0000000
--- a/trunk/xbean-telnet/src/main/java/org/apache/xbean/terminal/telnet/TelnetShell.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.terminal.telnet;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.net.Socket;
-
-import org.apache.xbean.command.CommandShell;
-
-public class TelnetShell {
-
- private final String serverName;
-
- public TelnetShell(String serverName) {
- this.serverName = serverName;
- }
-
- public void service(Socket socket) throws IOException {
-
- try {
- service(socket.getInputStream(), socket.getOutputStream());
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- if (socket != null) socket.close();
- }
- }
-
- public void service(InputStream in, OutputStream out) throws IOException {
- InputStream telnetIn = null;
- PrintStream telnetOut = null;
- try {
- telnetIn = new TelnetInputStream(in, out);
- telnetOut = new TelnetPrintStream(out);
-
- telnetOut.println(serverName + " Console");
- telnetOut.println("type \'help\' for a list of commands");
-
- // TODO:1: Login
- //...need a security service first
-
- CommandShell shell = new CommandShell(serverName);
- shell.main(new String[]{}, telnetIn, telnetOut);
-
- } catch (Throwable t) {
- // TODO: log this
- } finally {
- if (telnetIn != null){
- telnetIn.close();
- }
- if (telnetOut != null) {
- telnetOut.close();
- }
- }
- }
-}
diff --git a/trunk/xbean-telnet/src/main/resources/META-INF/LICENSE b/trunk/xbean-telnet/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-telnet/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-telnet/src/main/resources/META-INF/NOTICE b/trunk/xbean-telnet/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-telnet/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/trunk/xbean-telnet/src/test/java/org/apache/xbean/telnet/TelnetShellTest.java b/trunk/xbean-telnet/src/test/java/org/apache/xbean/telnet/TelnetShellTest.java
deleted file mode 100644
index 8e3fe9e..0000000
--- a/trunk/xbean-telnet/src/test/java/org/apache/xbean/telnet/TelnetShellTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.apache.xbean.telnet;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.PrintStream;
-
-import junit.framework.TestCase;
-
-import org.apache.xbean.command.Command;
-import org.apache.xbean.command.CommandRegistry;
-import org.apache.xbean.terminal.telnet.TelnetShell;
-
-public class TelnetShellTest extends TestCase {
-
- public void testService() throws Exception {
- TestCommand.register();
-
- TelnetShell telnetShell = new TelnetShell("acme");
- ByteArrayInputStream in = new ByteArrayInputStream("test hello world\r\n".getBytes());
- ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- telnetShell.service(in, out);
-
- // TODO test case still needs work
- System.out.println(new String(out.toByteArray()));
- }
-
- public static class TestCommand implements Command {
- public static void register() {
- CommandRegistry.register("test", TestCommand.class);
- }
- public int main(String[] args, InputStream in, PrintStream out) {
- out.print(args[0].length());
- out.print(args[1].length());
- return 0;
- }
- }
-}
\ No newline at end of file
diff --git a/trunk/xbean-tiger/pom.xml b/trunk/xbean-tiger/pom.xml
deleted file mode 100644
index 5af1773..0000000
--- a/trunk/xbean-tiger/pom.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project>
- <parent>
- <artifactId>xbean</artifactId>
- <groupId>org.apache.xbean</groupId>
- <version>2.4-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>xbean-tiger</artifactId>
- <name>XBean :: Tiger</name>
- <version>2.4-SNAPSHOT</version>
- <build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- <testResource>
- <directory>target/test-generated</directory>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.xbean</groupId>
- <artifactId>maven-xbean-plugin</artifactId>
- <version>${pom.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>mapping</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <namespace>http://xbean.apache.org/schemas/tiger</namespace>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/xbean-tiger/src/main/java/org/apache/xbean/tiger/MBeanServerFactoryBean.java b/trunk/xbean-tiger/src/main/java/org/apache/xbean/tiger/MBeanServerFactoryBean.java
deleted file mode 100644
index fa652ed..0000000
--- a/trunk/xbean-tiger/src/main/java/org/apache/xbean/tiger/MBeanServerFactoryBean.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xbean.tiger;
-
-import org.springframework.beans.factory.FactoryBean;
-
-import javax.management.MBeanServer;
-
-import java.lang.management.ManagementFactory;
-
-/**
- * A Java 5 specific factory bean to access the platforms {@link MBeanServer}.
- *
- * @org.apache.xbean.XBean element="platformMBeanServer" rootElement="true"
- * description="Creates a reference to the Java 5 platform MBeanServer"
- *
- * @version $Revision$
- */
-public class MBeanServerFactoryBean implements FactoryBean {
-
- public Object getObject() throws Exception {
- return ManagementFactory.getPlatformMBeanServer();
- }
-
- public Class getObjectType() {
- return MBeanServer.class;
- }
-
- public boolean isSingleton() {
- return true;
- }
-
-}
diff --git a/trunk/xbean-tiger/src/main/resources/META-INF/LICENSE b/trunk/xbean-tiger/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/xbean-tiger/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,203 +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/trunk/xbean-tiger/src/main/resources/META-INF/NOTICE b/trunk/xbean-tiger/src/main/resources/META-INF/NOTICE
deleted file mode 100644
index 439eb83..0000000
--- a/trunk/xbean-tiger/src/main/resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-