summaryrefslogtreecommitdiffstats
path: root/sandbox/slaws/bundle/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/slaws/bundle/src/main')
-rw-r--r--sandbox/slaws/bundle/src/main/java/sample/Helloworld.java28
-rw-r--r--sandbox/slaws/bundle/src/main/java/sample/impl/HelloworldImpl.java43
-rw-r--r--sandbox/slaws/bundle/src/main/java/sample/impl/SampleActivator.java45
-rw-r--r--sandbox/slaws/bundle/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor20
-rw-r--r--sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions17
-rw-r--r--sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory18
-rw-r--r--sandbox/slaws/bundle/src/main/resources/definitions.xml60
-rw-r--r--sandbox/slaws/bundle/src/main/resources/helloworld.composite50
9 files changed, 306 insertions, 0 deletions
diff --git a/sandbox/slaws/bundle/src/main/java/sample/Helloworld.java b/sandbox/slaws/bundle/src/main/java/sample/Helloworld.java
new file mode 100644
index 0000000000..f4e8c50448
--- /dev/null
+++ b/sandbox/slaws/bundle/src/main/java/sample/Helloworld.java
@@ -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 sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Helloworld {
+
+ String sayHello(String name);
+
+}
diff --git a/sandbox/slaws/bundle/src/main/java/sample/impl/HelloworldImpl.java b/sandbox/slaws/bundle/src/main/java/sample/impl/HelloworldImpl.java
new file mode 100644
index 0000000000..0e6d3cb1c7
--- /dev/null
+++ b/sandbox/slaws/bundle/src/main/java/sample/impl/HelloworldImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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 sample.impl;
+
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+
+import sample.Helloworld;
+
+public class HelloworldImpl implements Helloworld {
+
+ @Reference(required=false)
+ protected Helloworld hwRef;
+
+ @Property
+ protected String componentName;
+
+ public String sayHello(String name) {
+ String returnString = "Hello " + name + "->" + componentName;
+ if (hwRef != null){
+ return hwRef.sayHello(returnString);
+ } else {
+ return returnString;
+ }
+ }
+
+}
diff --git a/sandbox/slaws/bundle/src/main/java/sample/impl/SampleActivator.java b/sandbox/slaws/bundle/src/main/java/sample/impl/SampleActivator.java
new file mode 100644
index 0000000000..4838b534db
--- /dev/null
+++ b/sandbox/slaws/bundle/src/main/java/sample/impl/SampleActivator.java
@@ -0,0 +1,45 @@
+/*
+ * 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 sample.impl;
+
+import java.util.logging.Logger;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+import sample.Helloworld;
+
+public class SampleActivator implements BundleActivator {
+ private Logger logger = Logger.getLogger(SampleActivator.class.getName());
+
+
+ public void start(BundleContext context) throws Exception {
+ logger.info("Starting " + context.getBundle());
+
+ Helloworld hw = new HelloworldImpl();
+ logger.info(hw.sayHello("Fred Bloggs"));
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ logger.info("Stopping " + context.getBundle());
+ // Registered services will be automatically unregistered
+ }
+
+}
diff --git a/sandbox/slaws/bundle/src/main/resources/META-INF/sca-contribution.xml b/sandbox/slaws/bundle/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..95c32fb5bf
--- /dev/null
+++ b/sandbox/slaws/bundle/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:sample="http://sample">
+
+ <deployable composite="sample:helloworld-contribution" />
+
+</contribution>
diff --git a/sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..e3f31ae8d7
--- /dev/null
+++ b/sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,20 @@
+# 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.
+
+sample.ImplementationGenericPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#implementationGenericPolicy,model=sample.ImplementationGenericPolicy
+sample.InteractionGenericPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#interactionGenericPolicy,model=sample.InteractionGenericPolicy
+sample.InteractionBindingWSPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#interactionBindingWSPolicy,model=sample.InteractionBindingWSPolicy \ No newline at end of file
diff --git a/sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions b/sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
new file mode 100644
index 0000000000..f362b64a1f
--- /dev/null
+++ b/sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
@@ -0,0 +1,17 @@
+# 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.
+definitions.xml
diff --git a/sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
new file mode 100644
index 0000000000..cbfb70c346
--- /dev/null
+++ b/sandbox/slaws/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
@@ -0,0 +1,18 @@
+# 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.
+
+sample.InteractionBindingWSPolicyProviderFactory;model=sample.InteractionBindingWSPolicy \ No newline at end of file
diff --git a/sandbox/slaws/bundle/src/main/resources/definitions.xml b/sandbox/slaws/bundle/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..f37fde76ab
--- /dev/null
+++ b/sandbox/slaws/bundle/src/main/resources/definitions.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1">
+
+ <intent name="implementation.generic" constrains="implementation">
+ <description>
+ An intent that targets policy interceptors at the implementation
+ </description>
+ </intent>
+
+ <intent name="interaction.generic" constrains="binding">
+ <description>
+ An intent that targets policy interceptors at the binding generically
+ </description>
+ </intent>
+
+ <intent name="interaction.bindingws" constrains="binding.ws">
+ <description>
+ An intent that targets policy interceptors at binding.ws
+ </description>
+ </intent>
+
+ <policySet name="ImplementationGeneric"
+ provides="tuscany:implementation.generic"
+ appliesTo="//implementation">
+ <tuscany:implementationGenericPolicy name="ImplementationGeneric"/>
+ </policySet>
+
+ <policySet name="InteractionGeneric"
+ provides="tuscany:interaction.generic"
+ appliesTo="//binding">
+ <tuscany:interactionGenericPolicy name="InteractionGeneric"/>
+ </policySet>
+
+ <policySet name="InteractionBindingWS"
+ provides="tuscany:interaction.bindingws"
+ appliesTo="//binding.ws">
+ <tuscany:interactionBindingWSPolicy name="InteractionBindingWS"/>
+ </policySet>
+
+</definitions> \ No newline at end of file
diff --git a/sandbox/slaws/bundle/src/main/resources/helloworld.composite b/sandbox/slaws/bundle/src/main/resources/helloworld.composite
new file mode 100644
index 0000000000..47488f8bbd
--- /dev/null
+++ b/sandbox/slaws/bundle/src/main/resources/helloworld.composite
@@ -0,0 +1,50 @@
+<?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.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://sample"
+ name="helloworld-contribution">
+
+ <component name="HelloworldComponent1">
+ <implementation.java class="sample.HelloworldImpl"/>
+ <reference name="hwRef"
+ target="HelloworldComponent2"
+ requires="tuscany:interaction.bindingws"
+ policySets="tuscany:InteractionBindingWS"/>
+ <property name="componentName" value="HelloworldComponent1"/>
+ </component>
+
+ <component name="HelloworldComponent2">
+ <implementation.java class="sample.HelloworldImpl"/>
+ <service name="Helloworld"
+ requires="tuscany:interaction.bindingws"
+ policySets="tuscany:InteractionBindingWS">
+ <binding.ws/>
+ </service>
+ <reference name="hwRef" target="HelloworldComponent3"/>
+ <property name="componentName" value="HelloworldComponent2"/>
+ </component>
+
+ <component name="HelloworldComponent3">
+ <implementation.java class="sample.HelloworldImpl"/>
+ <property name="componentName" value="HelloworldComponent3"/>
+ </component>
+
+</composite>