You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ad...@apache.org on 2008/05/03 22:52:58 UTC
svn commit: r653133 [5/33] - in /incubator/tuscany/sandbox/mobile-android:
android-jdk-classes/ android-jdk-classes/src/
android-jdk-classes/src/javax/ android-jdk-classes/src/javax/xml/
android-jdk-classes/src/javax/xml/namespace/ android-jdk-classes/...
Added: incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/CalculatorService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/CalculatorService.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/CalculatorService.java (added)
+++ incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/CalculatorService.java Sat May 3 13:52:41 2008
@@ -0,0 +1,35 @@
+/*
+ * 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 calculator;
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
Added: incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/CalculatorServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/CalculatorServiceImpl.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/CalculatorServiceImpl.java (added)
+++ incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/CalculatorServiceImpl.java Sat May 3 13:52:41 2008
@@ -0,0 +1,70 @@
+/*
+ * 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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
Added: incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/DivideService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/DivideService.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/DivideService.java (added)
+++ incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/DivideService.java Sat May 3 13:52:41 2008
@@ -0,0 +1,28 @@
+/*
+ * 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 calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
Added: incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/DivideServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/DivideServiceImpl.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/DivideServiceImpl.java (added)
+++ incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/DivideServiceImpl.java Sat May 3 13:52:41 2008
@@ -0,0 +1,35 @@
+/*
+ * 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 calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
Added: incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/MultiplyService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/MultiplyService.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/MultiplyService.java (added)
+++ incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/MultiplyService.java Sat May 3 13:52:41 2008
@@ -0,0 +1,28 @@
+/*
+ * 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 calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
Added: incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/MultiplyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/MultiplyServiceImpl.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/MultiplyServiceImpl.java (added)
+++ incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/MultiplyServiceImpl.java Sat May 3 13:52:41 2008
@@ -0,0 +1,35 @@
+/*
+ * 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 calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
Added: incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/SubtractService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/SubtractService.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/SubtractService.java (added)
+++ incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/SubtractService.java Sat May 3 13:52:41 2008
@@ -0,0 +1,28 @@
+/*
+ * 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 calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
Added: incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/SubtractServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/SubtractServiceImpl.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/SubtractServiceImpl.java (added)
+++ incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/SubtractServiceImpl.java Sat May 3 13:52:41 2008
@@ -0,0 +1,35 @@
+/*
+ * 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 calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
Added: incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/android/CalculatorClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/android/CalculatorClient.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/android/CalculatorClient.java (added)
+++ incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/android/CalculatorClient.java Sat May 3 13:52:41 2008
@@ -0,0 +1,38 @@
+package calculator.android;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import calculator.CalculatorService;
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.TextView;
+
+public class CalculatorClient extends Activity {
+
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle icicle) {
+
+
+ super.onCreate(icicle);
+ StringBuffer sb = new StringBuffer();
+
+ SCADomain scaDomain = SCADomain.newInstance(this, "dex://calculator.android/raw/calculator.composite");
+
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ sb.append("3 + 2=" + calculatorService.add(3, 2));
+ sb.append("3 - 2=" + calculatorService.subtract(3, 2));
+ sb.append("3 * 2=" + calculatorService.multiply(3, 2));
+ sb.append("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+
+ TextView tv = new TextView(this);
+ tv.setText(sb.toString());
+ setContentView(tv);
+
+ }
+}
\ No newline at end of file
Added: incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/android/R.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/android/R.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/android/R.java (added)
+++ incubator/tuscany/sandbox/mobile-android/calculator-android/src/calculator/android/R.java Sat May 3 13:52:41 2008
@@ -0,0 +1,58 @@
+/* AUTO-GENERATED FILE. DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found. It
+ * should not be modified by hand.
+ */
+
+package calculator.android;
+
+public final class R {
+ public static final class attr {
+ }
+ public static final class drawable {
+ public static final int icon=0x7f020000;
+ }
+ public static final class layout {
+ public static final int main=0x7f030000;
+ }
+ public static final class raw {
+ public static final int calculator_composite=0x7f040000;
+ public static final int sca=0x7f040001;
+ public static final int sca_all=0x7f040002;
+ public static final int sca_binding_ejb=0x7f040003;
+ public static final int sca_binding_jms=0x7f040004;
+ public static final int sca_binding_sca=0x7f040005;
+ public static final int sca_binding_webservice=0x7f040006;
+ public static final int sca_core=0x7f040007;
+ public static final int sca_definitions=0x7f040008;
+ public static final int sca_implementation_bpel=0x7f040009;
+ public static final int sca_implementation_composite_xsd=0x7f04000a;
+ public static final int sca_implementation_cpp=0x7f04000b;
+ public static final int sca_implementation_ejb=0x7f04000c;
+ public static final int sca_implementation_java=0x7f04000d;
+ public static final int sca_implementation_spring=0x7f04000e;
+ public static final int sca_interface_cpp=0x7f04000f;
+ public static final int sca_interface_java=0x7f040010;
+ public static final int sca_interface_wsdl=0x7f040011;
+ public static final int sca_policy=0x7f040012;
+ public static final int tuscany_sca=0x7f040013;
+ public static final int tuscany_sca_binding_atom=0x7f040014;
+ public static final int tuscany_sca_binding_dwr=0x7f040015;
+ public static final int tuscany_sca_binding_http=0x7f040016;
+ public static final int tuscany_sca_binding_jsonrpc=0x7f040017;
+ public static final int tuscany_sca_binding_notification=0x7f040018;
+ public static final int tuscany_sca_binding_rmi=0x7f040019;
+ public static final int tuscany_sca_binding_rss=0x7f04001a;
+ public static final int tuscany_sca_implementation_node=0x7f04001b;
+ public static final int tuscany_sca_implementation_notification=0x7f04001c;
+ public static final int tuscany_sca_implementation_osgi=0x7f04001d;
+ public static final int tuscany_sca_implementation_resource=0x7f04001e;
+ public static final int tuscany_sca_implementation_script=0x7f04001f;
+ public static final int tuscany_sca_implementation_widget=0x7f040020;
+ public static final int tuscany_sca_implementation_xquery=0x7f040021;
+ }
+ public static final class string {
+ public static final int app_name=0x7f050000;
+ }
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/.classpath
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/.classpath?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/.classpath (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/.classpath Sat May 3 13:52:41 2008
@@ -0,0 +1,16 @@
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+ <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.2/junit-4.2.jar"/>
+ <classpathentry kind="src" path="/tuscany-assembly"/>
+ <classpathentry kind="src" path="/tuscany-policy"/>
+ <classpathentry kind="src" path="/tuscany-extensibility"/>
+ <classpathentry kind="src" path="/tuscany-interface"/>
+ <classpathentry kind="src" path="/tuscany-definitions"/>
+ <classpathentry kind="var" path="M2_REPO/org/easymock/easymock/2.2/easymock-2.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.3.03/xml-apis-1.3.03.jar"/>
+</classpath>
\ No newline at end of file
Added: incubator/tuscany/sandbox/mobile-android/contribution/.project
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/.project?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/.project (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/.project Sat May 3 13:52:41 2008
@@ -0,0 +1,19 @@
+<projectDescription>
+ <name>tuscany-contribution</name>
+ <comment>Parent POM defining settings that can be used across Tuscany</comment>
+ <projects>
+ <project>tuscany-assembly</project>
+ <project>tuscany-policy</project>
+ <project>tuscany-extensibility</project>
+ <project>tuscany-interface</project>
+ <project>tuscany-definitions</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: incubator/tuscany/sandbox/mobile-android/contribution/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/.settings/org.eclipse.jdt.core.prefs?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/.settings/org.eclipse.jdt.core.prefs (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/.settings/org.eclipse.jdt.core.prefs Sat May 3 13:52:41 2008
@@ -0,0 +1,5 @@
+#Thu Mar 20 19:19:33 PDT 2008
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Added: incubator/tuscany/sandbox/mobile-android/contribution/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/DISCLAIMER?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/DISCLAIMER (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/DISCLAIMER Sat May 3 13:52:41 2008
@@ -0,0 +1,8 @@
+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.
+
Added: incubator/tuscany/sandbox/mobile-android/contribution/LICENSE
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/LICENSE?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/LICENSE (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/LICENSE Sat May 3 13:52:41 2008
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
Added: incubator/tuscany/sandbox/mobile-android/contribution/NOTICE
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/NOTICE?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/NOTICE (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/NOTICE Sat May 3 13:52:41 2008
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
Added: incubator/tuscany/sandbox/mobile-android/contribution/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/pom.xml?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/pom.xml (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/pom.xml Sat May 3 13:52:41 2008
@@ -0,0 +1,55 @@
+<?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>2.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution</artifactId>
+ <name>Apache Tuscany SCA Contribution Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>2.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>2.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>1.3.03</version>
+ </dependency>
+ </dependencies>
+</project>
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java Sat May 3 13:52:41 2008
@@ -0,0 +1,86 @@
+/*
+ * 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.contribution;
+
+import org.apache.tuscany.sca.assembly.Base;
+
+
+/**
+ * Represents an artifact in an SCA contribution.
+ *
+ * @version $Rev: 618930 $ $Date: 2008-02-06 01:15:49 -0800 (Wed, 06 Feb 2008) $
+ */
+public interface Artifact extends Base {
+
+ /**
+ * Returns the URI that unique identifies the artifact inside the contribution.
+ *
+ * @return The artifact URI
+ */
+ String getURI();
+
+ /**
+ * Sets the URI that uniquely identifies the artifact inside the contribution.
+ *
+ * @param uri The artifact URI
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns the location of the artifact.
+ *
+ * @return The artifact location
+ */
+ String getLocation();
+
+ /**
+ * Set the location of the artifact.
+ *
+ * @param location The artifact location
+ */
+ void setLocation(String location);
+
+
+ /**
+ * Returns the in-memory model representing the artifact.
+ *
+ * @return The model object
+ */
+ Object getModel();
+
+ /**
+ * Sets the in-memory model representing the artifact.
+ *
+ * @param model The model object
+ */
+ void setModel(Object model);
+
+ /**
+ * Returns the contents of the artifact cached here.
+ * @return the contents of the artifact
+ */
+ byte[] getContents();
+
+ /**
+ * Sets the contents of the artifact.
+ * @param contents the contents of the artifact
+ */
+ void setContents(byte[] contents);
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java Sat May 3 13:52:41 2008
@@ -0,0 +1,40 @@
+/*
+ * 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.contribution;
+
+/**
+ * Constants for the main supported contribution package type.
+ *
+ * @version $Rev: 616114 $ $Date: 2008-01-28 16:05:37 -0800 (Mon, 28 Jan 2008) $
+ */
+@Deprecated
+public interface ContentType {
+
+ /**
+ * Java compressed contribution package
+ */
+ String JAR = "application/x-compressed";
+
+ /**
+ * Filesystem folder contribution package
+ */
+ String FOLDER = "application/vnd.tuscany.folder";
+
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java Sat May 3 13:52:41 2008
@@ -0,0 +1,116 @@
+/*
+ * 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.contribution;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an SCA contribution.
+ *
+ * @version $Rev: 639257 $ $Date: 2008-03-20 05:12:00 -0700 (Thu, 20 Mar 2008) $
+ */
+public interface Contribution extends Artifact {
+
+ /**
+ * Default location of contribution metadata in an SCA contribution.
+ */
+ String SCA_CONTRIBUTION_META = "META-INF/sca-contribution.xml";
+
+ /**
+ * Default location of a generated contribution metadata in an SCA contribution.
+ */
+ String SCA_CONTRIBUTION_GENERATED_META = "META-INF/sca-contribution-generated.xml";
+
+ /**
+ * Default location of deployable composites in an SCA contribution.
+ */
+ String SCA_CONTRIBUTION_DEPLOYABLES = "META-INF/sca-deployables/";
+
+
+ /**
+ * Returns a list of exports based on the contribution metadata.
+ *
+ * @return The list of exports in this contribution
+ */
+ List<Export> getExports();
+
+ /**
+ * Returns a list of imports based on the contribution metadata.
+ *
+ * @return The list of imports in this contribution
+ */
+ List<Import> getImports();
+
+ /**
+ * Returns the list of deployable composites in the contribution.
+ *
+ * @return The list of deployable composites
+ */
+ List<Composite> getDeployables();
+
+ /**
+ * Returns the list of artifacts in the contribution.
+ *
+ * @return The list of artifacts in the contribution
+ */
+ List<Artifact> getArtifacts();
+
+ /**
+ * Returns the model resolver for the models representing the artifacts
+ * visible in the scope of this contribution.
+ *
+ * @return The model resolver
+ */
+ ModelResolver getModelResolver();
+
+ /**
+ * Sets the model resolver for the models representing the artifacts
+ * visible in the scope of this contribution.
+ *
+ * @param modelResolver The model resolver
+ */
+ void setModelResolver(ModelResolver modelResolver);
+
+ /**
+ * Returns the ClassLoader used to load classes and resources from
+ * this contribution
+ *
+ * FIXME Remove this, the base contribution model should not depend
+ * on Java ClassLoaders.
+ *
+ * @return The contribution ClassLoader
+ */
+ ClassLoader getClassLoader();
+
+ /**
+ * Sets the ClassLoader used to load classes and resources from
+ * this contribution
+ *
+ * FIXME Remove this, the base contribution model should not depend
+ * on Java ClassLoaders.
+ *
+ * @param classLoader the contribution class loader
+ */
+ void setClassLoader(ClassLoader classLoader);
+
+}
\ No newline at end of file
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java Sat May 3 13:52:41 2008
@@ -0,0 +1,52 @@
+/*
+ * 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.contribution;
+
+
+/**
+ * A factory for the contribution model.
+ *
+ * @version $Rev: 629585 $ $Date: 2008-02-20 11:39:27 -0800 (Wed, 20 Feb 2008) $
+ */
+public interface ContributionFactory {
+
+ /**
+ * Create a contribution model object
+ *
+ * @return The new contribution model object
+ */
+ Contribution createContribution();
+
+ /**
+ * Create a deployedArtifact model object
+ *
+ * @return The new deployedArtifact model object
+ */
+ @Deprecated
+ DeployedArtifact createDeployedArtifact();
+
+ /**
+ * Create an artifact model object
+ *
+ * @return The new artifact model object
+ */
+ Artifact createArtifact();
+
+}
\ No newline at end of file
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java Sat May 3 13:52:41 2008
@@ -0,0 +1,32 @@
+/*
+ * 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.contribution;
+
+import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
+
+
+/**
+ * Default implementation of a contribution model factory.
+ *
+ * @version $Rev: 616114 $ $Date: 2008-01-28 16:05:37 -0800 (Mon, 28 Jan 2008) $
+ */
+public class DefaultContributionFactory extends ContributionFactoryImpl {
+
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java Sat May 3 13:52:41 2008
@@ -0,0 +1,132 @@
+/*
+ * 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.contribution;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+
+/**
+ * Default implementation of a model factory extension point.
+ *
+ * @version $Rev: 632642 $ $Date: 2008-03-01 10:16:44 -0800 (Sat, 01 Mar 2008) $
+ */
+public class DefaultModelFactoryExtensionPoint implements ModelFactoryExtensionPoint {
+
+ private HashMap<Class<?>, Object> factories = new HashMap<Class<?>, Object>();
+
+ /**
+ * Constructs a new DefaultModelFactoryExtensionPoint.
+ */
+ public DefaultModelFactoryExtensionPoint() {
+ }
+
+ /**
+ * Add a model factory extension.
+ *
+ * @param factory The factory to add
+ */
+ public void addFactory(Object factory) {
+ Class<?>[] interfaces = factory.getClass().getInterfaces();
+ if (interfaces.length == 0) {
+ Class<?> sc = factory.getClass().getSuperclass();
+ if (sc != Object.class) {
+ factories.put(sc, factory);
+ }
+ } else {
+ for (int i = 0; i<interfaces.length; i++) {
+ factories.put(interfaces[i], factory);
+ }
+ }
+ }
+
+ /**
+ * Remove a model factory.
+ *
+ * @param factory The factory to remove
+ */
+ public void removeFactory(Object factory) {
+ Class<?>[] interfaces = factory.getClass().getInterfaces();
+ if (interfaces.length == 0) {
+ Class<?> sc = factory.getClass().getSuperclass();
+ if (sc != Object.class) {
+ factories.remove(sc);
+ }
+ } else {
+ for (int i = 0; i<interfaces.length; i++) {
+ factories.remove(interfaces[i]);
+ }
+ }
+ }
+
+ /**
+ * Get a factory implementing the given interface.
+ * @param factoryInterface The lookup key (factory interface)
+ * @return The factory
+ */
+ public <T> T getFactory(Class<T> factoryInterface) {
+ Object factory = factories.get(factoryInterface);
+ if (factory == null) {
+
+ if (factoryInterface.isInterface()) {
+
+ // Dynamically load a factory class declared under META-INF/services
+ try {
+ Class<?> factoryClass = ServiceDiscovery.getInstance().loadFirstServiceClass(factoryInterface);
+ if (factoryClass != null) {
+
+ try {
+ // Default empty constructor
+ Constructor<?> constructor = factoryClass.getConstructor();
+ factory = constructor.newInstance();
+ } catch (NoSuchMethodException e) {
+
+ // Constructor taking the model factory extension point
+ Constructor<?> constructor = factoryClass.getConstructor(ModelFactoryExtensionPoint.class);
+ factory = constructor.newInstance(this);
+ }
+
+ // Cache the loaded factory
+ addFactory(factory);
+ }
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ } else {
+
+ // Call the newInstance static method on the factory abstract class
+ try {
+ Method newInstanceMethod = factoryInterface.getMethod("newInstance");
+ factory = newInstanceMethod.invoke(null);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+
+ // Cache the factory
+ addFactory(factory);
+ }
+ }
+ return factoryInterface.cast(factory);
+ }
+
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java Sat May 3 13:52:41 2008
@@ -0,0 +1,29 @@
+/*
+ * 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.contribution;
+
+/**
+ * Representation of a deployed artifact
+ *
+ * @version $Rev: 615632 $ $Date: 2008-01-27 11:14:25 -0800 (Sun, 27 Jan 2008) $
+ */
+@Deprecated
+public interface DeployedArtifact extends Artifact {
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java Sat May 3 13:52:41 2008
@@ -0,0 +1,47 @@
+/*
+ * 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.contribution;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an export.
+ *
+ * @version $Rev: 615632 $ $Date: 2008-01-27 11:14:25 -0800 (Sun, 27 Jan 2008) $
+ */
+public interface Export {
+
+ /**
+ * Returns the model resolver for the models representing artifacts
+ * made available by this export.
+ *
+ * @return The model resolver
+ */
+ ModelResolver getModelResolver();
+
+ /**
+ * Sets the model resolver for the models representing artifacts
+ * made available by this export.
+ *
+ * @param modelResolver
+ */
+ void setModelResolver(ModelResolver modelResolver);
+
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java Sat May 3 13:52:41 2008
@@ -0,0 +1,56 @@
+/*
+ * 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.contribution;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * The representation of an import.
+ *
+ * @version $Rev: 631778 $ $Date: 2008-02-27 15:54:38 -0800 (Wed, 27 Feb 2008) $
+ */
+public interface Import {
+
+ /**
+ * Returns the model resolver for the models representing artifacts
+ * made available by this import.
+ *
+ * @return The model resolver
+ */
+ ModelResolver getModelResolver();
+
+ /**
+ * Sets the model resolver for the models representing artifacts
+ * made available by this import.
+ *
+ * @param modelResolver The model resolver
+ */
+ void setModelResolver(ModelResolver modelResolver);
+
+ /**
+ * Verify that a specific export actually exports what is being imported.
+ *
+ * @param export The Exported being verified
+ * @return true/false
+ */
+ boolean match(Export export);
+
+}
\ No newline at end of file
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java Sat May 3 13:52:41 2008
@@ -0,0 +1,54 @@
+/*
+ * 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.contribution;
+
+/**
+ * An extension point for model factories. Model factories are provided to
+ * abstract the classes that represent artifacts in the assembly model away
+ * from their creation mechanism. When the runtime needs to extend the model
+ * as it reads in contributed artifacts it looks up the factory for the
+ * artifact required in this registry
+ *
+ * @version $Rev: 562796 $ $Date: 2007-08-04 18:20:28 -0700 (Sat, 04 Aug 2007) $
+ */
+public interface ModelFactoryExtensionPoint {
+
+ /**
+ * Add a model factory extension.
+ *
+ * @param factory The factory to add
+ */
+ void addFactory(Object factory);
+
+ /**
+ * Remove a model factory extension.
+ *
+ * @param factory The factory to remove
+ */
+ void removeFactory(Object factory);
+
+ /**
+ * Get a factory implementing the given interface.
+ * @param factoryInterface the lookup key (factory interface)
+ * @return The factory
+ */
+ <T> T getFactory(Class<T> factoryInterface);
+
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java Sat May 3 13:52:41 2008
@@ -0,0 +1,42 @@
+/*
+ * 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.contribution;
+
+/**
+ * Constants for the main supported contribution package types.
+ *
+ * @version $Rev: 637139 $ $Date: 2008-03-14 09:02:49 -0700 (Fri, 14 Mar 2008) $
+ */
+public interface PackageType {
+
+ /**
+ * Java compressed contribution package
+ */
+ String JAR = "application/x-compressed";
+
+ /**
+ * Filesystem folder contribution package
+ */
+ String FOLDER = "application/vnd.tuscany.folder";
+
+
+ String BUNDLE = "application/osgi.bundle";
+
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java Sat May 3 13:52:41 2008
@@ -0,0 +1,103 @@
+/*
+ * 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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+
+
+/**
+ * The model representing an artifact in a contribution.
+ *
+ * @version $Rev: 632520 $ $Date: 2008-02-29 16:58:53 -0800 (Fri, 29 Feb 2008) $
+ */
+class ArtifactImpl implements Artifact {
+ private String uri;
+ private String location;
+ private Object model;
+ private boolean unresolved;
+ private byte[] contents;
+
+ ArtifactImpl() {
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ public void setModel(Object model) {
+ this.model = model;
+ }
+
+ public byte[] getContents() {
+ return contents;
+ }
+
+ public void setContents(byte[] contents) {
+ this.contents = contents;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ @Override
+ public int hashCode() {
+ return uri.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof Artifact) {
+ return uri.equals(((Artifact)obj).getURI());
+ } else {
+ return false;
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Artifact:" + uri + "\n" +
+ "at: " + location;
+ }
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java Sat May 3 13:52:41 2008
@@ -0,0 +1,52 @@
+/*
+ * 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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+
+
+/**
+ * Default implementation of a contribution model factory.
+ *
+ * @version $Rev: 629585 $ $Date: 2008-02-20 11:39:27 -0800 (Wed, 20 Feb 2008) $
+ */
+public class ContributionFactoryImpl implements ContributionFactory {
+
+ public ContributionFactoryImpl() {
+ }
+
+ public Contribution createContribution() {
+ return new ContributionImpl();
+ }
+
+ public Artifact createArtifact() {
+ return new ArtifactImpl();
+ }
+
+ @Deprecated
+ public DeployedArtifact createDeployedArtifact() {
+ class DeployedArtifactImpl extends ArtifactImpl implements DeployedArtifact {
+ }
+ return new DeployedArtifactImpl();
+ }
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java Sat May 3 13:52:41 2008
@@ -0,0 +1,154 @@
+/*
+ * 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.contribution.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of a deployed contribution
+ *
+ * @version $Rev: 639257 $ $Date: 2008-03-20 05:12:00 -0700 (Thu, 20 Mar 2008) $
+ */
+class ContributionImpl implements Contribution {
+ private String uri;
+ private String location;
+ private Object model;
+ private byte[] contents;
+ private boolean unresolved;
+ private List<Export> exports = new ArrayList<Export>();
+ private List<Import> imports = new ArrayList<Import>();
+ private List<Composite> deployables = new ArrayList<Composite>();
+ private List<Artifact> artifacts = new ArrayList<Artifact>();
+ private ModelResolver modelResolver;
+
+ // FIXME remove this dependency on Java ClassLoaders
+ private ClassLoader classLoader;
+
+ ContributionImpl() {
+ }
+
+ public String getLocation() {
+ return this.location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ //FIXME Remove dependency on Java ClassLoaders
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ //FIXME Remove dependency on Java ClassLoaders
+ public void setClassLoader(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+
+ public String getURI() {
+ return this.uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ public void setModel(Object model) {
+ this.model = model;
+ }
+
+ public byte[] getContents() {
+ return contents;
+ }
+
+ public void setContents(byte[] contents) {
+ this.contents = contents;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+ public List<Export> getExports() {
+ return exports;
+ }
+
+ public List<Import> getImports() {
+ return imports;
+ }
+
+ public List<Composite> getDeployables() {
+ return deployables;
+ }
+
+ public List<Artifact> getArtifacts() {
+ return artifacts;
+ }
+
+ @Override
+ public int hashCode() {
+ return uri.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof Artifact) {
+ return uri.equals(((Artifact)obj).getURI());
+ } else {
+ return false;
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Contribution : " + uri + " \n" +
+ "from: " + location;
+ }
+
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java Sat May 3 13:52:41 2008
@@ -0,0 +1,48 @@
+/*
+ * 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.contribution.processor;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+
+/**
+ * Base interface for artifact processors.
+ *
+ * @version $Rev: 616114 $ $Date: 2008-01-28 16:05:37 -0800 (Mon, 28 Jan 2008) $
+ */
+public interface ArtifactProcessor<M> {
+
+ /**
+ * Resolve references from this model to other models. For example references
+ * from a composite to another one, or references from a composite to a WSDL
+ * model.
+ *
+ * @param model The model to resolve
+ * @param resolver The resolver to use to resolve referenced models
+ */
+ void resolve(M model, ModelResolver resolver) throws ContributionResolveException;
+
+ /**
+ * Returns the type of model handled by this artifact processor.
+ *
+ * @return The type of model handled by this artifact processor
+ */
+ Class<M> getModelType();
+
+}
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java Sat May 3 13:52:41 2008
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.contribution.processor;
+
+/**
+ * An extension point for artifact processors.
+ *
+ * @version $Rev: 616133 $ $Date: 2008-01-28 17:45:50 -0800 (Mon, 28 Jan 2008) $
+ */
+public interface ArtifactProcessorExtensionPoint<P extends ArtifactProcessor> {
+
+ /**
+ * Add an artifact processor.
+ *
+ * @param artifactProcessor The artifact processor to add
+ */
+ void addArtifactProcessor(P artifactProcessor);
+
+ /**
+ * Remove an artifact processor.
+ *
+ * @param artifactProcessor The artifact processor to remove
+ */
+ void removeArtifactProcessor(P artifactProcessor);
+
+ /**
+ * Returns the processor associated with the given artifact type.
+ *
+ * @param artifactType An artifact type
+ * @return The processor associated with the given artifact type
+ */
+ P getProcessor(Object artifactType);
+
+ /**
+ * Returns the processor associated with the given model type.
+ *
+ * @param modelType A model type
+ * @return The processor associated with the given model type
+ */
+ P getProcessor(Class<?> modelType);
+
+}