summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/0.91-rc1-incubating/modules/extension-helper
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/0.91-rc1-incubating/modules/extension-helper')
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/DISCLAIMER8
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/LICENSE205
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/NOTICE6
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/pom.xml69
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/BindingActivator.java67
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/ComponentLifecycle.java28
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/ImplementationActivator.java62
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/InvokerFactory.java29
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/BindingSCDLProcessor.java155
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/BindingsActivator.java207
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/DiscoveryUtils.java134
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/ImplementationImplementationProvider.java91
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/ImplementationsActivator.java138
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/PojoBinding.java36
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/PojoImplementation.java42
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/SCDLProcessor.java241
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractBinding.java77
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractImplementation.java127
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractStAXArtifactProcessor.java114
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/DefaultPropertyValueObjectFactory.java229
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/DynamicImplementation.java92
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/PropertyValueObjectFactory.java29
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/ResourceHelper.java70
-rw-r--r--tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator20
24 files changed, 0 insertions, 2276 deletions
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/DISCLAIMER b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/DISCLAIMER
deleted file mode 100644
index d68a410903..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/DISCLAIMER
+++ /dev/null
@@ -1,8 +0,0 @@
-Apache Tuscany is an effort undergoing incubation at The Apache Software
-Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
-required of all newly accepted projects until a further review indicates that
-the infrastructure, communications, and decision making process have stabilized
-in a manner consistent with other successful ASF projects. While incubation
-status is not necessarily a reflection of the completeness or stability of the
-code, it does indicate that the project has yet to be fully endorsed by the ASF.
-
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/LICENSE b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/LICENSE
+++ /dev/null
@@ -1,205 +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/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/NOTICE b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/NOTICE
deleted file mode 100644
index 94481d6cfa..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2007 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/pom.xml b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/pom.xml
deleted file mode 100644
index 8f000a847b..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project>
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-modules</artifactId>
- <version>0.91-incubating</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-extension-helper</artifactId>
- <name>Apache Tuscany Extension Helper</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>0.91-incubating</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>0.91-incubating</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>0.91-incubating</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-</project>
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/BindingActivator.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/BindingActivator.java
deleted file mode 100644
index dbe60a7312..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/BindingActivator.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * A BindingActivator adds an SCA binding type to the Tuscany runtime.
- *
- * The SCDL XML used for the binding is derived from the name of the
- * class returned from the getBindingClass method - the package name and
- * any trailing "Binding" string is removed, leading upper case characters
- * are converted to lowercase, and the suffix "binding." is added.
- * For example if getBindingClass returns a class named "mypkg.FooBinding"
- * then the SCDL for the binding will be <binding.foo>.
- *
- * Attributes of the <binding.foo> SCDL are based on the getters/setters of
- * the binding class. So if FooBinding had getBar/setBar then there
- * would be an attribute name 'bar', for example, <binding.foo bar="xxx">.
- *
- * BindingActivator implementations may use constructor arguments to have
- * Tuscany ExtensionPointRegistry objects passed in on their constructor.
- * For example:
- *
- * public class MyBindingActivator implements BindingActivator {
- * ServletHost servletHost;
- * public MyBindingActivator(ServletHost servletHost) {
- * this.servletHost = servletHost;
- * }
- * ...
- * }
- *
- * BindingActivator implementations are discovered by the Tuscany runtime
- * using the J2SE jar file extensions for service provider discovery. All
- * that means is packaging the new binding type in a jar which contains a
- * file META-INF/services/org.apache.tuscany.sca.spi.BindingActivator and
- * that file lists the BindingActivator implementation class name.
- */
-public interface BindingActivator<B> {
-
- Class<B> getBindingClass();
-
- InvokerFactory createInvokerFactory(RuntimeComponent rc, RuntimeComponentReference rcr, Binding b, B pojoBinding);
-
- ComponentLifecycle createService(RuntimeComponent rc, RuntimeComponentService rcs, Binding b, B pojoBinding);
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/ComponentLifecycle.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/ComponentLifecycle.java
deleted file mode 100644
index 9506ff7ad3..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/ComponentLifecycle.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi;
-
-
-public interface ComponentLifecycle {
-
- void start();
- void stop();
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/ImplementationActivator.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/ImplementationActivator.java
deleted file mode 100644
index 3b9b82549e..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/ImplementationActivator.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * An ImplementationActivator adds an SCA implementation type to the Tuscany runtime.
- *
- * The SCDL XML used for the implementation is derived from the name of the
- * class returned from the getImplementationClass method - the package name and
- * any trailing "Implementation" string is removed, leading upper case characters
- * are converted to lowercase, and the suffix "implementation." is added. For
- * example if getImplementationClass returns a class named "mypkg.FooImplementation"
- * then the SCDL for the implementation will be <implementation.foo>.
- *
- * Attributes of the <implementation.foo> SCDL are based on the getters/setters of
- * the Implementation class. So if FooImplementation had getBar/setBar then there
- * would be an attribute name 'bar', for example, <implementation.foo bar="xxx">.
- *
- * BindingActivator implementations may use constructor arguments to have
- * Tuscany ExtensionPointRegistry objects passed in on their constructor.
- * For example:
- *
- * public class MyImplementationActivator implements ImplementationActivator {
- * ServletHost servletHost;
- * public MyImplementationActivator(ServletHost servletHost) {
- * this.servletHost = servletHost;
- * }
- * ...
- * }
- *
- * ImplementationActivator implementations are discovered by the Tuscany runtime
- * using the J2SE jar file extensions for service provider discovery. All
- * that means is packaging the new binding type in a jar which contains a
- * file META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator and
- * that file lists the ImplementationActivator implementation class name.
- */
-public interface ImplementationActivator<T> {
-
- Class<T> getImplementationClass();
-
- InvokerFactory createInvokerFactory(RuntimeComponent rc, ComponentType ct, T implementation);
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/InvokerFactory.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/InvokerFactory.java
deleted file mode 100644
index 2c2952463e..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/InvokerFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-
-public interface InvokerFactory {
-
- public Invoker createInvoker(Operation operation);
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/BindingSCDLProcessor.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/BindingSCDLProcessor.java
deleted file mode 100644
index 1e430e43e8..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/BindingSCDLProcessor.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.impl;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.spi.utils.AbstractBinding;
-
-/**
- * An SCDL ArtifactProcessor which uses the Binding class getters/setters
- * to define the SCDL attributes.
- *
- * TODO: merge this with SCDLProcessor
- */
-public class BindingSCDLProcessor implements StAXArtifactProcessor {
-
- protected QName scdlQName;
- protected Class<Binding> bindingClass;
-
- protected Map<String, Method> attributeSetters;
- protected Method elementTextSetter;
-
- public BindingSCDLProcessor(QName scdlQName, Class<Binding> implementationClass) {
- this.scdlQName = scdlQName;
- this.bindingClass = implementationClass;
- initAttributes();
- }
-
- protected void initAttributes() {
- attributeSetters = new HashMap<String, Method>();
- Set<Method> methods = new HashSet<Method>(Arrays.asList(bindingClass.getMethods()));
- methods.removeAll(Arrays.asList(AbstractBinding.class.getMethods()));
- for (Method m : methods) {
- if ("setElementText".equals(m.getName())) {
- elementTextSetter = m;
- } else if ((m.getName().startsWith("set"))) {
- attributeSetters.put(getFieldName(m), m);
- }
- }
- }
-
- /**
- * Remove get/set from method name, set 1st char to lowercase and
- * remove any trailing underscore character
- */
- protected String getFieldName(Method m) {
- StringBuilder sb = new StringBuilder(m.getName().substring(3));
- sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
- String name = sb.toString();
- if (name.endsWith("_")) {
- name = name.substring(0,name.length()-1);
- }
- return name;
- }
-
- public QName getArtifactType() {
- return scdlQName;
- }
-
- public Class<Binding> getModelType() {
- return bindingClass;
- }
-
- public Binding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- Object impl;
- try {
- impl = bindingClass.newInstance();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- for (String attribute : attributeSetters.keySet()) {
- String value = reader.getAttributeValue(null, attribute);
- if (value != null && value.length() > 0) {
- try {
- attributeSetters.get(attribute).invoke(impl, new Object[] {value});
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- //FIXME: none of the attributes of Binding seem to be working with PojoBinding
- // For now at least read the binding URI
- String uri = reader.getAttributeValue(null, "uri");
-
- if (elementTextSetter != null) {
- try {
- String value = reader.getElementText();
- if (value != null && value.length() > 0) {
- elementTextSetter.invoke(impl, value);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- while (!(reader.getEventType() == END_ELEMENT && scdlQName.equals(reader.getName())) && reader.hasNext()) {
- reader.next();
- }
-
- if (!(impl instanceof Binding)) {
- impl = new PojoBinding(impl);
-
- //FIXME: none of the attributes of Binding seem to be working with PojoBinding
- // For now at least read the binding URI
- if (uri != null) {
- ((PojoBinding)impl).setURI(uri);
- }
- }
- return (Binding)impl;
- }
-
- public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
- }
-
- public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
- }
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/BindingsActivator.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/BindingsActivator.java
deleted file mode 100644
index d2de4b6769..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/BindingsActivator.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ProviderFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.spi.BindingActivator;
-import org.apache.tuscany.sca.spi.ComponentLifecycle;
-import org.apache.tuscany.sca.spi.InvokerFactory;
-
-public class BindingsActivator implements ModuleActivator {
-
- protected List<BindingActivator> bindingActivators;
- protected AssemblyFactory assemblyFactory;
-
- public void start(ExtensionPointRegistry registry) {
-
- ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
-
- this.bindingActivators = DiscoveryUtils.discoverActivators(BindingActivator.class, getClass().getClassLoader(), registry);
-
- StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- for (final BindingActivator bindingActivator : bindingActivators) {
-
- QName scdlQName = getBindingQName(bindingActivator.getBindingClass());
- staxProcessors.addArtifactProcessor(new BindingSCDLProcessor(scdlQName, bindingActivator.getBindingClass()));
-
- if (bindingActivator.getBindingClass() != null) {
- // Add a ProviderFactory
- ProviderFactoryExtensionPoint providerFactories =
- registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-
- providerFactories.addProviderFactory(new BindingProviderFactory() {
- public ReferenceBindingProvider createReferenceBindingProvider(final RuntimeComponent rc,
- final RuntimeComponentReference rcr,
- final Binding b) {
- return new ReferenceBindingProvider() {
- List<InvokerProxy> invokers = new ArrayList<InvokerProxy>();
- private InvokerFactory factory;
- public Invoker createInvoker(Operation operation, boolean isCallback) {
- InvokerProxy invoker = new InvokerProxy(operation);
- invokers.add(invoker);
- return invoker;
- }
- public InterfaceContract getBindingInterfaceContract() {
- return null;
- }
- public void start() {
- if (b instanceof PojoBinding) {
- factory = bindingActivator.createInvokerFactory(rc, rcr, b, ((PojoBinding)b).getUserBinding());
- } else {
- factory = bindingActivator.createInvokerFactory(rc, rcr, b, b);
- }
- if (factory instanceof ComponentLifecycle) {
- ((ComponentLifecycle)factory).start();
- }
- for (InvokerProxy invoker : invokers) {
- invoker.start(factory);
- }
- }
- public void stop() {
- if (factory instanceof ComponentLifecycle) {
- ((ComponentLifecycle)factory).stop();
- }
- }};
- }
-
- public ServiceBindingProvider createServiceBindingProvider(final RuntimeComponent rc,
- final RuntimeComponentService rcs,
- final Binding b) {
- final Object pojoBinding;
- if (b instanceof PojoBinding) {
- pojoBinding = ((PojoBinding)b).getUserBinding();
- } else {
- pojoBinding = b;
- }
- return new ServiceBindingProvider(){
- ComponentLifecycle listener = bindingActivator.createService(rc, rcs, b, pojoBinding);
- public InterfaceContract getBindingInterfaceContract() {
- return null;
- }
- public void start() {
- listener.start();
- }
- public void stop() {
- listener.stop();
- }};
- }
-
- public Class getModelType() {
- Class c = bindingActivator.getBindingClass();
- if (Binding.class.isAssignableFrom(c)) {
- return c;
- } else {
- return PojoBinding.class;
- }
- }
- });
- }
- }
- }
-
- public void stop(ExtensionPointRegistry registry) {
- StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-
- for (final BindingActivator bindingActivator : bindingActivators) {
-
- // Remove the binding SCDL processor from the runtime
- if (staxProcessors != null) {
- StAXArtifactProcessor processor = staxProcessors.getProcessor(getBindingQName(bindingActivator.getBindingClass()));
- if (processor != null) {
- staxProcessors.removeArtifactProcessor(processor);
- }
- }
-
- // Remove the ProviderFactory from the runtime
- if (providerFactories != null && bindingActivator.getBindingClass() != null) {
- ProviderFactory factory = providerFactories.getProviderFactory(bindingActivator.getBindingClass());
- if (factory != null) {
- providerFactories.removeProviderFactory(factory);
- }
- }
- }
- }
-
- protected QName getBindingQName(Class bindingClass) {
- String localName = bindingClass.getName();
- if (localName.lastIndexOf('.') > -1) {
- localName = localName.substring(localName.lastIndexOf('.') + 1);
- }
- if (localName.endsWith("Binding")) {
- localName = localName.substring(0, localName.length()-7);
- }
- StringBuilder sb = new StringBuilder(localName);
- for (int i=0; i<sb.length(); i++) {
- if (Character.isUpperCase(sb.charAt(i))) {
- sb.setCharAt(i, Character.toLowerCase(sb.charAt(i)));
- } else {
- break;
- }
- }
- return new QName(Constants.SCA10_NS, "binding." + sb.toString());
- }
-
-
- public Object[] getExtensionPoints() {
- return null; // not used by binding or implementation extensions
- }
-
-}
-class InvokerProxy implements Invoker {
- Invoker invoker;
- Operation op;
- InvokerProxy(Operation op) {
- this.op = op;
- }
- public Message invoke(Message arg0) {
- return invoker.invoke(arg0);
- }
- public void start(InvokerFactory factory) {
- invoker = factory.createInvoker(op);
- }
- }
-
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/DiscoveryUtils.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/DiscoveryUtils.java
deleted file mode 100644
index adf69caf59..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/DiscoveryUtils.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.impl;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.reflect.Constructor;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * Discovers Activators in the classpath using the J2SE
- * jar file extensions for Service Provider discovery
- */
-public class DiscoveryUtils {
-
- public static <T> List<T> discoverActivators(Class<T> activatorClass, ClassLoader classLoader, ExtensionPointRegistry registry) {
- Set<Class> activatorClasses = getServiceClasses(classLoader, activatorClass);
- List<T> activators = new ArrayList<T>();
- for (Class<T> c : activatorClasses) {
- try {
- activators.add(c.cast(instantiateActivator(c, registry)));
- } catch (Throwable e) {
- e.printStackTrace(); // TODO: log
- }
- }
- return activators;
- }
-
- static Object instantiateActivator(Class activator, ExtensionPointRegistry registry) {
- Constructor[] cs = activator.getConstructors();
- if (cs.length != 1) {
- throw new RuntimeException("Activator must have only one constructors");
- }
-
- Class<?>[] paramTypes = cs[0].getParameterTypes();
- Object[] extensions = new Object[paramTypes.length];
-
- for (int i=0; i< paramTypes.length; i++) {
- extensions[i] = registry.getExtensionPoint(paramTypes[i]);
- }
-
- try {
-
- return cs[0].newInstance(extensions);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- static Set<Class> getServiceClasses(ClassLoader classLoader, Class name) {
- try {
-
- Set<Class> set = new HashSet<Class>();
- Enumeration<URL> urls = classLoader.getResources("META-INF/services/" + name.getName());
- while (urls.hasMoreElements()) {
- URL url = urls.nextElement();
- Set<String> services = getServiceClassNames(url);
- if (services != null) {
- for (String className : services) {
- try {
- set.add(Class.forName(className, true, classLoader));
- } catch (Throwable e) {
- // TODO: log
- }
- }
- }
- }
- return set;
-
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- static Set<String> getServiceClassNames(URL url) throws IOException {
- Set<String> names = new HashSet<String>();
- InputStream is = url.openStream();
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(is));
- while (true) {
- String line = reader.readLine();
- if (line == null) {
- break;
- }
- line = line.trim();
- if (!line.startsWith("#") && !"".equals(line)) {
- names.add(line.trim());
- }
- }
- } finally {
- if (reader != null) {
- reader.close();
- }
-
- if (is != null){
- try {
- is.close();
- } catch( IOException ioe) {
- //ignore
- }
- }
- }
- return names;
- }
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/ImplementationImplementationProvider.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/ImplementationImplementationProvider.java
deleted file mode 100644
index 99e2d0fd88..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/ImplementationImplementationProvider.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.spi.ImplementationActivator;
-import org.apache.tuscany.sca.spi.InvokerFactory;
-
-/**
- * The ImplementationProvider createInvoker method is called before the start method
- * but the runtime isn't properly setup until the start method is called. This means
- * that Invoker's can't initialize things like the services, references and properties
- * until start is called. This class tries to get around that by using an Invoker
- * proxy that delays creating the real Invoker till start is called.
- */
-public class ImplementationImplementationProvider implements ImplementationProvider {
-
- ImplementationActivator implementationActivator;
- RuntimeComponent runtimeComponent;
- Implementation impl;
- Object userImpl;
-
- List<InvokerProxy> invokers = new ArrayList<InvokerProxy>();
-
- public ImplementationImplementationProvider(ImplementationActivator implementationActivator, RuntimeComponent rc, Implementation impl, Object userImpl) {
- this.implementationActivator = implementationActivator;
- this.runtimeComponent = rc;
- this.impl = impl;
- this.userImpl = userImpl;
- }
-
- public Invoker createInvoker(RuntimeComponentService arg0, final Operation op) {
- InvokerProxy invoker = new InvokerProxy(op);
- invokers.add(invoker);
- return invoker;
- }
-
- public Invoker createCallbackInvoker(Operation operation) {
- throw new RuntimeException("TODO: callbacks not yet implemented");
- }
-
- public void start() {
- InvokerFactory factory = implementationActivator.createInvokerFactory(runtimeComponent, impl, userImpl);
- for (InvokerProxy invoker : invokers) {
- invoker.start(factory);
- }
- }
-
- public void stop() {
- }
-
- class InvokerProxy implements Invoker {
- Invoker invoker;
- Operation op;
- InvokerProxy(Operation op) {
- this.op = op;
- }
- public Message invoke(Message arg0) {
- return invoker.invoke(arg0);
- }
- public void start(InvokerFactory factory) {
- invoker = factory.createInvoker(op);
- }
- }
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/ImplementationsActivator.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/ImplementationsActivator.java
deleted file mode 100644
index 6285738a40..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/ImplementationsActivator.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.impl;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.spi.ImplementationActivator;
-import org.apache.tuscany.sca.spi.utils.DefaultPropertyValueObjectFactory;
-import org.apache.tuscany.sca.spi.utils.PropertyValueObjectFactory;
-
-/**
- * A Tuscany ModuleActivator which acitvates all the ImplementationActivators
- */
-public class ImplementationsActivator implements ModuleActivator {
-
- protected List<ImplementationActivator> implementationActivators;
-
- public void start(ExtensionPointRegistry registry) {
-
- ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
-
- DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
- TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
- MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
- PropertyValueObjectFactory propertyFactory = new DefaultPropertyValueObjectFactory(mediator);
- registry.addExtensionPoint(propertyFactory);
-
- this.implementationActivators = DiscoveryUtils.discoverActivators(ImplementationActivator.class, getClass().getClassLoader(), registry);
-
- StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-
- for (final ImplementationActivator implementationActivator : implementationActivators) {
-
- Class<Implementation> implClass = implementationActivator.getImplementationClass();
- QName scdlQName = getSCDLQName(implClass);
- staxProcessors.addArtifactProcessor(new SCDLProcessor(assemblyFactory, scdlQName, implClass, registry, factories));
-
- if (implementationActivator.getImplementationClass() != null && providerFactories != null) {
- addImplementationProvider(implementationActivator, providerFactories);
- }
- }
- }
-
- public void stop(ExtensionPointRegistry registry) {
- StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- for (final ImplementationActivator implementationActivator : implementationActivators) {
- if (staxProcessors != null) {
- StAXArtifactProcessor processor = staxProcessors.getProcessor(getSCDLQName(implementationActivator.getImplementationClass()));
- if (processor != null) {
- staxProcessors.removeArtifactProcessor(processor);
- }
- }
- }
- }
-
- private void addImplementationProvider(final ImplementationActivator implementationActivator, ProviderFactoryExtensionPoint providerFactories) {
-
- providerFactories.addProviderFactory(new ImplementationProviderFactory() {
- public ImplementationProvider createImplementationProvider(final RuntimeComponent rc, final Implementation impl) {
- if (impl instanceof PojoImplementation) {
- return new ImplementationImplementationProvider(implementationActivator, rc, impl, ((PojoImplementation)impl).getUserImpl());
- } else {
- return new ImplementationImplementationProvider(implementationActivator, rc, impl, impl);
- }
- }
- public Class getModelType() {
- Class c = implementationActivator.getImplementationClass();
-
- if (Implementation.class.isAssignableFrom(c)) {
- return c;
- } else {
- return PojoImplementation.class;
- }
- }
- });
- }
-
- protected QName getSCDLQName(Class implementationClass) {
- String localName = implementationClass.getName();
- if (localName.lastIndexOf('.') > -1) {
- localName = localName.substring(localName.lastIndexOf('.') + 1);
- }
- if (localName.endsWith("Implementation")) {
- localName = localName.substring(0, localName.length() - 14);
- }
- StringBuilder sb = new StringBuilder(localName);
- for (int i=0; i<sb.length(); i++) {
- if (Character.isUpperCase(sb.charAt(i))) {
- sb.setCharAt(i, Character.toLowerCase(sb.charAt(i)));
- } else {
- break;
- }
- }
- return new QName(Constants.SCA10_NS, "implementation." + sb.toString());
- }
-
-
- public Object[] getExtensionPoints() {
- return null;
- }
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/PojoBinding.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/PojoBinding.java
deleted file mode 100644
index 663f4bc037..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/PojoBinding.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.impl;
-
-import org.apache.tuscany.sca.spi.utils.AbstractBinding;
-
-public class PojoBinding extends AbstractBinding {
-
- Object userBinding;
-
- public PojoBinding(Object userImpl) {
- this.userBinding = userImpl;
- }
-
- public Object getUserBinding() {
- return userBinding;
- }
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/PojoImplementation.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/PojoImplementation.java
deleted file mode 100644
index ff5d0512fc..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/PojoImplementation.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.impl;
-
-import org.apache.tuscany.sca.spi.utils.DynamicImplementation;
-
-/**
- * Enables Implementation extensions to use a simple POJO
- * for the implementation object instead of requiring
- * implementing the Implementation interface.
- */
-public class PojoImplementation<Implementation> extends DynamicImplementation {
-
- Object userImpl;
-
- public PojoImplementation(Object userImpl) {
- this.userImpl = userImpl;
- }
-
- public Object getUserImpl() {
- return userImpl;
- }
-
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/SCDLProcessor.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/SCDLProcessor.java
deleted file mode 100644
index a26ed00920..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/SCDLProcessor.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.impl;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.impl.ModelResolverImpl;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.spi.utils.AbstractStAXArtifactProcessor;
-import org.apache.tuscany.sca.spi.utils.DynamicImplementation;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * An SCDL ArtifactProcessor which uses the Implementation class getters/setters
- * to define the SCDL attributes.
- */
-public class SCDLProcessor extends AbstractStAXArtifactProcessor<Implementation> {
-
- protected QName scdlQName;
- protected Class<Implementation> implementationClass;
- protected ExtensionPointRegistry registry;
- protected ModelFactoryExtensionPoint factories;
-
- protected Map<String, Method> attributeSetters;
- protected Method elementTextSetter;
-
- public SCDLProcessor(AssemblyFactory assemblyFactory, QName scdlQName, Class<Implementation> implementationClass, ExtensionPointRegistry registry, ModelFactoryExtensionPoint factories) {
- super(assemblyFactory);
- this.scdlQName = scdlQName;
- this.implementationClass = implementationClass;
- this.registry = registry;
- this.factories = factories;
- initAttributes();
- }
-
- protected void initAttributes() {
- attributeSetters = new HashMap<String, Method>();
- Set<Method> methods = new HashSet<Method>(Arrays.asList(implementationClass.getMethods()));
- methods.removeAll(Arrays.asList(DynamicImplementation.class.getMethods()));
- for (Method m : methods) {
- if ("setElementText".equals(m.getName())) {
- elementTextSetter = m;
- } else if ((m.getName().startsWith("set"))) {
- attributeSetters.put(getFieldName(m), m);
- }
- }
- }
-
- /**
- * Remove get/set from method name, set 1st char to lowercase and
- * remove any trailing underscore character
- */
- protected String getFieldName(Method m) {
- StringBuilder sb = new StringBuilder(m.getName().substring(3));
- sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
- String name = sb.toString();
- if (name.endsWith("_")) {
- name = name.substring(0,name.length()-1);
- }
- return name;
- }
-
- private Object[] getImplConstrArgs() {
- Constructor[] cs = implementationClass.getConstructors();
- if (cs.length != 1) {
- throw new IllegalArgumentException("Implementation class must have a single constructor: "+ implementationClass.getName());
- }
- List args = new ArrayList();
- for (Class c : cs[0].getParameterTypes()) {
- Object o = factories.getFactory(c);
- if (o == null) {
- o = registry.getExtensionPoint(c);
- }
- args.add(o);
- }
- return args.toArray();
- }
-
-
- public QName getArtifactType() {
- return scdlQName;
- }
-
- public Class<Implementation> getModelType() {
- Class clazz;
- if (Implementation.class.isAssignableFrom(implementationClass)) {
- clazz = implementationClass;
- } else {
- clazz = PojoImplementation.class;
- }
- return clazz;
- }
-
- public Implementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- Object impl;
- try {
- impl = implementationClass.getConstructors()[0].newInstance(getImplConstrArgs());
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- for (String attribute : attributeSetters.keySet()) {
- String value = reader.getAttributeValue(null, attribute);
- if (value != null && value.length() > 0) {
- try {
- attributeSetters.get(attribute).invoke(impl, new Object[] {value});
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- if (elementTextSetter != null) {
- try {
- String value = reader.getElementText();
- if (value != null && value.length() > 0) {
- elementTextSetter.invoke(impl, value);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- while (!(reader.getEventType() == END_ELEMENT && scdlQName.equals(reader.getName())) && reader.hasNext()) {
- reader.next();
- }
-
- if (!(impl instanceof Implementation)) {
- impl = new PojoImplementation(impl);
- }
-
- return (Implementation)impl;
- }
-
- public void write(Implementation arg0, XMLStreamWriter arg1) throws ContributionWriteException, XMLStreamException {
- }
-
- protected void addSideFileComponentType(String name, Implementation impl, ModelResolver resolver) {
-// protected void addSideFileComponentType(Implementation impl, ModelResolver resolver) {
-
- ComponentType componentType;
- try {
- componentType = getComponentType(resolver, impl);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
-
- if (componentType != null && !componentType.isUnresolved()) {
- for (Reference reference : componentType.getReferences()) {
- impl.getReferences().add(reference);
- }
- for (Service service : componentType.getServices()) {
- impl.getServices().add(service);
- }
- for (Property property : componentType.getProperties()) {
- impl.getProperties().add(property);
- }
- if (componentType.getConstrainingType() != null) {
- impl.setConstrainingType(componentType.getConstrainingType());
- }
- }
- }
-
- private ComponentType getComponentType(ModelResolver resolver, Implementation impl) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
- for (Object o :((ModelResolverImpl)resolver).getModels()) {
- if (o instanceof ComponentType) {
- ComponentType ct = (ComponentType)o;
- String uri = ct.getURI();
- if (uri != null && uri.endsWith(".componentType")) {
- String name = uri.substring(0, uri.lastIndexOf('.'));
- for (Method m : getGetters()) {
- String value = (String) m.invoke(impl, new Object[]{});
- if (value != null && name.endsWith(value.substring(0, value.lastIndexOf('.')))) {
- return ct;
- }
- }
- }
- }
- }
- return null;
- }
-
- private List<Method> getGetters() {
- List<Method> ms = new ArrayList<Method>();
- for (Method setter : attributeSetters.values()) {
- String s = getFieldName(setter);
- for (Method m : implementationClass.getMethods()) {
- String name = m.getName();
- if (name.length() > 3 && name.startsWith("get")) {
- if (s.endsWith(name.substring(4))) {
- ms.add(m);
- }
- }
- }
- }
- return ms;
- }
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractBinding.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractBinding.java
deleted file mode 100644
index a80e2d5610..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractBinding.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.utils;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Helper for implementing Bindings, implements all the
- * standard getters and setters on the binding interface.
- */
-public class AbstractBinding implements Binding {
-
- private String name;
- private String uri;
- private List<Object> extensions;
- private boolean unresolved;
- private List<Intent> requiredIntents;
- private List<PolicySet> policySets;
-
- public String getName() {
- return name;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public List<Object> getExtensions() {
- return extensions;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractImplementation.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractImplementation.java
deleted file mode 100644
index 2b08c4b197..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractImplementation.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Helper for implementing Implementations, implements all the
- * standard getters and setters on the Implementation interface.
- */
-public abstract class AbstractImplementation implements Implementation {
-
- private List<Service> services = new ArrayList<Service>();
- private List<Reference> references = new ArrayList<Reference>();
- private List<Property> properties = new ArrayList<Property>();
- private ConstrainingType constrainingType;
- private String uri;
- private boolean unresolved = true;
- private List<Intent> intents;
- private List<PolicySet> policySets;
-
- public AbstractImplementation() {
- }
-
- public List<Property> getProperties() {
- return properties;
- }
-
- public List<Reference> getReferences() {
- return references;
- }
-
- public List<Service> getServices() {
- return services;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public ConstrainingType getConstrainingType() {
- return constrainingType;
- }
-
- public void setConstrainingType(ConstrainingType constrainingType) {
- this.constrainingType = constrainingType;
- }
-
- public List<Intent> getRequiredIntents() {
- return intents;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Object> getExtensions() {
- // TODO what is this for?
- return null;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- public Service getService(String name) {
- for (Service service : getServices()) {
- if (service.getName().equals(name)) {
- return service;
- }
- }
- return null;
- }
-
- public Reference getReference(String name) {
- for (Reference reference : getReferences()) {
- if (reference.getName().equals(name)) {
- return reference;
- }
- }
- return null;
- }
-
- public Property getProptery(String name) {
- for (Property property : getProperties()) {
- if (property.getName().equals(name)) {
- return property;
- }
- }
- return null;
- }
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractStAXArtifactProcessor.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractStAXArtifactProcessor.java
deleted file mode 100644
index b7b0e95c13..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/AbstractStAXArtifactProcessor.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.utils;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
-
-/**
- * TODO: couldn't something like this class be provided by the runtime?
- * Each impl shouldn't have to have their own .componentType merging code
- */
-public abstract class AbstractStAXArtifactProcessor<I extends Implementation> implements StAXArtifactProcessor<I> {
-
- protected AssemblyFactory assemblyFactory;
-
- public AbstractStAXArtifactProcessor(AssemblyFactory assemblyFactory) {
- this.assemblyFactory = assemblyFactory;
- }
-
- public void resolve(I model, ModelResolver resolver) throws ContributionResolveException {
-
- addSideFileComponentType(model.getURI(), model, resolver);
-
- if (model instanceof DynamicImplementation) {
- // if no services have been defined then add a dynamic one
- if (model.getServices().size() < 1) {
- Service dynamicService = createDynamicService();
- model.getServices().add(dynamicService);
- }
- }
-
- model.setUnresolved(false);
- }
-
- protected void addSideFileComponentType(String name, Implementation impl, ModelResolver resolver) {
- if (name == null) {
- return;
- }
- int lastDot = name.lastIndexOf('.');
- if (lastDot < 0) {
- return;
- }
- String sideFileName = name.substring(0, lastDot) + ".componentType";
-
- ComponentType componentType = assemblyFactory.createComponentType();
- componentType.setURI(sideFileName);
- componentType.setUnresolved(true);
-
- componentType = resolver.resolveModel(ComponentType.class, componentType);
-
- if (!componentType.isUnresolved()) {
- for (Reference reference : componentType.getReferences()) {
- impl.getReferences().add(reference);
- }
- for (Service service : componentType.getServices()) {
- impl.getServices().add(service);
- }
- for (Property property : componentType.getProperties()) {
- impl.getProperties().add(property);
- }
- if (componentType.getConstrainingType() != null) {
- impl.setConstrainingType(componentType.getConstrainingType());
- }
- }
- }
-
- protected Service createDynamicService() {
- Service dynamicService = assemblyFactory.createService();
- dynamicService.setName("$dynamic$");
- InterfaceContract dynamicInterfaceContract = new InterfaceContractImpl() {};
- Interface dynamicInterface = new InterfaceImpl() {
- public boolean isDynamic() {
- return true;
- }
- };
- Operation dynamicOperation = assemblyFactory.createOperation();
- dynamicOperation.setDynamic(true);
- dynamicInterface.getOperations().add(dynamicOperation);
- dynamicInterfaceContract.setInterface(dynamicInterface);
- dynamicService.setInterfaceContract(dynamicInterfaceContract);
-
- return dynamicService;
- }
-
-} \ No newline at end of file
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/DefaultPropertyValueObjectFactory.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/DefaultPropertyValueObjectFactory.java
deleted file mode 100644
index b12ec7dae2..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/DefaultPropertyValueObjectFactory.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.spi.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.factory.ObjectCreationException;
-import org.apache.tuscany.sca.factory.ObjectFactory;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * TODO: Shouldn't this class be provided by the runtime?
- */
-public class DefaultPropertyValueObjectFactory implements PropertyValueObjectFactory {
- // protected DataBindingRegistry dbRegistry = new DataBindingRegistryImpl();
- protected Mediator mediator = null;
- protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
- boolean isSimpleType;
-
- public DefaultPropertyValueObjectFactory(Mediator mediator) {
- this.mediator = mediator;
- }
-
- /* (non-Javadoc)
- * @see org.apache.tuscany.sca.spi.utils.PVOF#createValueFactory(org.apache.tuscany.sca.assembly.Property)
- */
- public ObjectFactory createValueFactory(Property property) {
- isSimpleType = isSimpleType(property);
- Document doc = (Document)property.getValue();
- Element rootElement = doc.getDocumentElement();
-
- //FIXME : since scripts use dynamic types we need to generate a dynamic java type using the
- //xml structure of the property value. Should this be done in the JavaBeansDataBinding...
- Class javaType = null;
-
- if (property.isMany()) {
- if (isSimpleType) {
- String value = "";
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
- List<String> values =
- getSimplePropertyValues(value, javaType);
- return new ListObjectFactoryImpl(property,
- values,
- isSimpleType,
- javaType);
- } else {
- return new ListObjectFactoryImpl(property,
- getComplexPropertyValues(doc),
- isSimpleType,
- javaType);
- }
- } else {
- if (isSimpleType) {
- String value = "";
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
- return new ObjectFactoryImpl(property,
- value,
- isSimpleType,
- javaType);
- } else {
- Object value = getComplexPropertyValues(doc).get(0);
- return new ObjectFactoryImpl(property,
- value,
- isSimpleType,
- javaType);
- }
-
- }
- }
-
- private boolean isSimpleType(Property property) {
- if (property.getXSDType() != null) {
- return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType());
- } else {
- if (property instanceof Document) {
- Document doc = (Document)property;
- Element element = doc.getDocumentElement();
- if (element.getChildNodes().getLength() == 1 &&
- element.getChildNodes().item(0).getNodeType() == Element.TEXT_NODE) {
- return true;
- }
- }
- }
- return false;
- }
-
- private List<String> getSimplePropertyValues(String concatenatedValue, Class javaType) {
- List<String> propValues = new ArrayList<String>();
- StringTokenizer st = null;
- if ( javaType.getName().equals("java.lang.String")) {
- st = new StringTokenizer(concatenatedValue, "\"");
- } else {
- st = new StringTokenizer(concatenatedValue);
- }
- String aToken = null;
- while (st.hasMoreTokens()) {
- aToken = st.nextToken();
- if (aToken.trim().length() > 0) {
- propValues.add(aToken);
- }
- }
- return propValues;
- }
-
- private List<Node> getComplexPropertyValues(Document document) {
- Element rootElement = document.getDocumentElement();
- List<Node> propValues = new ArrayList<Node>();
- for (int count = 0 ; count < rootElement.getChildNodes().getLength() ; ++count) {
- if (rootElement.getChildNodes().item(count).getNodeType() == Document.ELEMENT_NODE) {
- propValues.add(rootElement.getChildNodes().item(count));
- }
- }
- return propValues;
- }
-
- public abstract class ObjectFactoryImplBase implements ObjectFactory {
- protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
- protected Property property;
- protected Object propertyValue;
- protected Class javaType;
- protected DataType<XMLType> sourceDataType;
- protected DataType<?> targetDataType;
- boolean isSimpleType;
-
- public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
-
- this.isSimpleType = isSimpleType;
- this.property = property;
- this.propertyValue = propertyValue;
- this.javaType = javaType;
- //FIXME : fix this when we have managed to generate dynamic java types
- /*sourceDataType =
- new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class,
- new XMLType(null, this.property.getXSDType()));
- TypeInfo typeInfo = null;
- if (this.property.getXSDType() != null) {
- if (SimpleTypeMapperExtension.isSimpleXSDType(this.property.getXSDType())) {
- typeInfo = new TypeInfo(property.getXSDType(), true, null);
- } else {
- typeInfo = new TypeInfo(property.getXSDType(), false, null);
- }
- } else {
- typeInfo = new TypeInfo(property.getXSDType(), false, null);
- }
-
- XMLType xmlType = new XMLType(typeInfo);
- String dataBinding = null; //(String)property.getExtensions().get(DataBinding.class.getName());
- if (dataBinding != null) {
- targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
- } else {
- targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
- mediator.getDataBindingRegistry().introspectType(targetDataType, null);
- }*/
- }
- }
-
- public class ObjectFactoryImpl extends ObjectFactoryImplBase {
- public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
- super(property, propertyValue, isSimpleType, javaType);
- }
-
- @SuppressWarnings("unchecked")
- public Object getInstance() throws ObjectCreationException {
- if (isSimpleType) {
- return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
- } else {
- return mediator.mediate(propertyValue, sourceDataType, targetDataType, null);
- //return null;
- }
- }
- }
-
- public class ListObjectFactoryImpl extends ObjectFactoryImplBase {
- public ListObjectFactoryImpl(Property property, List<?>propertyValues, boolean isSimpleType, Class javaType) {
- super(property, propertyValues, isSimpleType, javaType);
- }
-
- @SuppressWarnings("unchecked")
- public List<?> getInstance() throws ObjectCreationException {
- if (isSimpleType) {
- List<Object> values = new ArrayList<Object>();
- for (String aValue : (List<String>)propertyValue) {
- values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
- }
- return values;
- } else {
- List instances = new ArrayList();
- for (Node aValue : (List<Node>)propertyValue) {
- instances.add(mediator.mediate(aValue,
- sourceDataType,
- targetDataType,
- null));
- }
- return instances;
- }
- }
- }
-}
- \ No newline at end of file
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/DynamicImplementation.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/DynamicImplementation.java
deleted file mode 100644
index 2a8d97e5d3..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/DynamicImplementation.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.utils;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-public class DynamicImplementation extends AbstractImplementation implements ComponentPreProcessor {
-
- public void preProcess(Component component) {
- RuntimeComponent rtc = (RuntimeComponent) component;
-
- for (Service service : rtc.getServices()) {
- if (getService(service.getName()) == null) {
- getServices().add(createService(service));
- }
- }
-
- Service dynamicService = getService("$dynamic$");
- if (dynamicService != null && getServices().size() > 1) {
- getServices().remove(dynamicService);
- dynamicService = null;
- }
-
- for (Reference reference : rtc.getReferences()) {
- if (getReference(reference.getName()) == null) {
- getReferences().add(createReference(reference));
- }
- }
-
- for (Property property : rtc.getProperties()) {
- if (getProptery(property.getName()) == null) {
- getProperties().add(createProperty(property));
- }
- }
-
- // TODO: support properties
- }
-
- protected Service createService(Service service) {
- Service newService;
- try {
- newService = (Service)service.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
-
- return newService;
- }
-
- protected Reference createReference(Reference reference) {
- Reference newReference;
- try {
- newReference = (Reference)reference.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
- return newReference;
- }
-
- protected Property createProperty(Property property) {
- Property newProperty;
- try {
- newProperty = (Property)property.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
- return newProperty;
- }
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/PropertyValueObjectFactory.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/PropertyValueObjectFactory.java
deleted file mode 100644
index 5091b8a8a9..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/PropertyValueObjectFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.utils;
-
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.factory.ObjectFactory;
-
-public interface PropertyValueObjectFactory {
-
- public abstract ObjectFactory createValueFactory(Property property);
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/ResourceHelper.java b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/ResourceHelper.java
deleted file mode 100644
index 05c9ae713c..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/utils/ResourceHelper.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.spi.utils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-
-/**
- * TODO: Shouldn't this be using the contrabution service?
- */
-public class ResourceHelper {
-
- public static String readResource(String scriptName) {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- URL scriptSrcUrl = cl.getResource(scriptName);
- if (scriptSrcUrl == null) {
- throw new RuntimeException("No script: " + scriptName);
- }
-
- InputStream is;
- try {
- is = scriptSrcUrl.openStream();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
-
- try {
-
- Reader reader = new InputStreamReader(is, "UTF-8");
- char[] buffer = new char[1024];
- StringBuilder source = new StringBuilder();
- int count;
- while ((count = reader.read(buffer)) > 0) {
- source.append(buffer, 0, count);
- }
-
- return source.toString();
-
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- try {
- is.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
-
-}
diff --git a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index 35787c6cc8..0000000000
--- a/tags/java/sca/0.91-rc1-incubating/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the ExtensionActivator
-org.apache.tuscany.sca.spi.impl.ImplementationsActivator
-org.apache.tuscany.sca.spi.impl.BindingsActivator