summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/samples/getting-started/callback-api
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/samples/getting-started/callback-api')
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/callback-api/pom.xml51
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/CallBack.java33
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Client.java28
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/ClientImpl.java108
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Launcher.java60
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Service.java36
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/ServiceImpl.java96
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/resources/CallBackApi.composite33
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/resources/META-INF/sca-contribution.xml23
9 files changed, 0 insertions, 468 deletions
diff --git a/sca-java-2.x/trunk/samples/getting-started/callback-api/pom.xml b/sca-java-2.x/trunk/samples/getting-started/callback-api/pom.xml
deleted file mode 100644
index a87560b9f2..0000000000
--- a/sca-java-2.x/trunk/samples/getting-started/callback-api/pom.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-samples</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
- <artifactId>sample-callback-api-contribution</artifactId>
- <name>Apache Tuscany SCA Sample Callback API Contribution</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-api</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/CallBack.java b/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/CallBack.java
deleted file mode 100644
index 16e4297e9d..0000000000
--- a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/CallBack.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package sample;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-/**
- * The callback interface.
- */
-@Remotable
-public interface CallBack {
-
- void callBackMessage(String aString);
-
- void callBackIncrement();
-
-}
diff --git a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Client.java b/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Client.java
deleted file mode 100644
index 7e0709e660..0000000000
--- a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Client.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package sample;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-@Remotable
-public interface Client {
-
- void run();
-
-}
diff --git a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/ClientImpl.java b/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/ClientImpl.java
deleted file mode 100644
index 01219aa608..0000000000
--- a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/ClientImpl.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package sample;
-
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Service;
-
-@Service(Client.class)
-public class ClientImpl implements Client, CallBack {
-
- public static final String DELIMITER = "\n----------------------------";
-
- @Reference
- protected sample.Service service;
-
- private static int callBackCount = 0;
-
- /**
- * This function prints the message received from the service
- * implementation.
- *
- * @param String the message received from the service
- */
- public void callBackMessage(String aString) {
- System.out.println("ClientImpl - Received callback message: " + aString);
- }
-
- /**
- * This function increments the callBackCount variable when called from the
- * service implementation.
- */
- public void callBackIncrement() {
- System.out.println("ClientImpl - Received increment callback");
- callBackCount++;
- System.out.println("ClientImpl - Callback counter incremented to : " + getCallBackCount());
- }
-
- /**
- * This method runs different kinds of service calls implying callbacks.
- */
- public void run() {
- simpleCallBack();
- simpleCallBackByRef();
- noCallBack();
- multipleCallBack();
- }
-
- /**
- * The basic callback where the target calls back prior to returning to the
- * client.
- */
- private void simpleCallBack() {
- System.out.println(DELIMITER + "\nSimple callback" + DELIMITER);
- service.knockKnock("Knock Knock");
- }
-
- /**
- * The basic callback where the target calls back prior to returning to the
- * client.
- */
- private void simpleCallBackByRef() {
- System.out.println(DELIMITER + "\nSimple callback by reference" + DELIMITER);
- service.knockKnockByRef("Knock Knock by reference");
- }
-
- /**
- * The basic callback where the target does not call back to the client.
- */
- private void noCallBack() {
- System.out.println(DELIMITER + "\nNo callback" + DELIMITER);
- service.noCallBack("No Reply Desired");
- }
-
- /**
- * The basic callback where the target calls back multiple times to the
- * client.
- */
- private void multipleCallBack() {
- System.out.println(DELIMITER + "\nMultiple callbacks" + DELIMITER);
- service.multiCallBack("Call me back 3 times");
- }
-
- /**
- * This function returns the callBackCount variable.
- *
- * @return Integer the callBackCount variable
- */
- public int getCallBackCount() {
- return callBackCount;
- }
-
-}
diff --git a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Launcher.java b/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Launcher.java
deleted file mode 100644
index fa1a59d726..0000000000
--- a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Launcher.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package sample;
-
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.ContributionLocationHelper;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-
-/**
- * This class starts the Tuscany Runtime and runs the client calls to the
- * service.
- */
-public class Launcher {
-
- public static void main(String[] args) {
- Node node = startRuntime();
- Client client = node.getService(Client.class, "Client");
- client.run();
- stopRuntime(node);
- }
-
- /**
- * Starts a Tuscany node with the predefined contribution.
- *
- * @return the running node
- */
- private static Node startRuntime() {
- String location = ContributionLocationHelper.getContributionLocation("CallBackApi.composite");
- Node node = NodeFactory.newInstance().createNode("CallBackApi.composite", new Contribution("c1", location));
- node.start();
- return node;
- }
-
- /**
- * Stops a Tuscany node.
- *
- * @param node the node to stop
- */
- private static void stopRuntime(Node node) {
- node.stop();
- }
-}
diff --git a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Service.java b/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Service.java
deleted file mode 100644
index 6723af2adf..0000000000
--- a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/Service.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package sample;
-
-import org.oasisopen.sca.annotation.Callback;
-import org.oasisopen.sca.annotation.Remotable;
-
-@Remotable
-@Callback(CallBack.class)
-public interface Service {
-
- void knockKnock(String aString);
-
- void knockKnockByRef(String aString);
-
- void noCallBack(String aString);
-
- void multiCallBack(String aString);
-
-}
diff --git a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/ServiceImpl.java b/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/ServiceImpl.java
deleted file mode 100644
index 4850f434ff..0000000000
--- a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/java/sample/ServiceImpl.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package sample;
-
-import org.oasisopen.sca.ComponentContext;
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Callback;
-import org.oasisopen.sca.annotation.Context;
-import org.oasisopen.sca.annotation.Service;
-
-@Service(sample.Service.class)
-public class ServiceImpl implements sample.Service {
-
- public static final String MESSAGE_RECEIVED = "ServiceImpl - Received message: ";
-
- @Context
- protected ComponentContext componentContext;
-
- @Callback
- protected ServiceReference<CallBack> callbackRef;
-
- /**
- * This function gets an object of ServiceImpl by calling
- * getCallBackInterface function and calls the callBackMessage function.
- *
- * @param aString String passed by a function call
- */
- public void knockKnock(String aString) {
- System.out.println(MESSAGE_RECEIVED + aString);
- CallBack callback = this.getCallBackFromComponentContext();
- callback.callBackMessage("Who's There");
- }
-
- /**
- * This function calls the callBackMessage function. The reference to this
- * function is received from the callback reference to the Service class.
- *
- * @param aString String passed by a function call
- */
- public void knockKnockByRef(String aString) {
- System.out.println(MESSAGE_RECEIVED + aString);
- callbackRef.getService().callBackMessage("Who's There");
- }
-
- /**
- * This function gets an object of ServiceImpl by calling
- * getCallBackInterface function. This function then places multiple
- * callbacks using the callbackIncrement function defined in the callback
- * implementation.
- *
- * @param aString String passed by a function call
- */
- public void multiCallBack(String aString) {
- CallBack callback = this.getCallBackFromComponentContext();
- System.out.println(MESSAGE_RECEIVED + aString);
- callback.callBackIncrement();
- callback.callBackIncrement();
- callback.callBackIncrement();
- }
-
- /**
- * This function does not callBack any function.
- *
- * @param aString String passed by a function call
- */
- public void noCallBack(String aString) {
- System.out.println(MESSAGE_RECEIVED + aString);
- }
-
- /**
- * This function gets an object of ServiceImpl from the present
- * componentContext.
- *
- * @return the callback
- */
- private CallBack getCallBackFromComponentContext() {
- return componentContext.getRequestContext().getCallback();
- }
-
-}
diff --git a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/resources/CallBackApi.composite b/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/resources/CallBackApi.composite
deleted file mode 100644
index ca3a6e5f9d..0000000000
--- a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/resources/CallBackApi.composite
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
- targetNamespace="http://callback"
- name="CallBackApi">
-
- <component name="Client">
- <implementation.java class="sample.ClientImpl"/>
- <reference name="service" target="Service"/>
- </component>
-
- <component name="Service">
- <implementation.java class="sample.ServiceImpl"/>
- </component>
-
-</composite>
diff --git a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/resources/META-INF/sca-contribution.xml
deleted file mode 100644
index f17791205a..0000000000
--- a/sca-java-2.x/trunk/samples/getting-started/callback-api/src/main/resources/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
- xmlns:t="http://callback">
- <deployable composite="t:CallBackApi" />
-</contribution> \ No newline at end of file