diff options
Diffstat (limited to 'sca-java-2.x/trunk/contrib/samples')
42 files changed, 0 insertions, 2544 deletions
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/pom.xml b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/pom.xml deleted file mode 100644 index c25184e295..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/pom.xml +++ /dev/null @@ -1,74 +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-sample-domain-distributed-calculator</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>sample-domain-distributed-calculator-contribution-add</artifactId>
- <name>Apache Tuscany SCA Sample Domain Distributed Calculator Contribution Add</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>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>2.0-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-rmi-runtime</artifactId>
- <version>2.0-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.tuscany.maven.plugins</groupId>
- <artifactId>maven-tuscany-plugin</artifactId>
- <version>2.0-SNAPSHOT</version>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddService.java b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddService.java deleted file mode 100644 index c7e6383559..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,31 +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 calculator;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-/**
- * The interface for the add service
- */
-@Remotable
-public interface AddService {
-
- double add(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddServiceImpl.java b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index e9c635e3c8..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,30 +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 calculator;
-
-/**
- * An implementation of the Add service
- */
-public class AddServiceImpl implements AddService {
-
- public double add(double n1, double n2) {
- return n1 + n2;
- }
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/main/resources/Add.composite b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/main/resources/Add.composite deleted file mode 100644 index a452c24141..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/main/resources/Add.composite +++ /dev/null @@ -1,30 +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"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="Add">
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl"/>
- </component>
-
-</composite>
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/main/resources/META-INF/sca-contribution.xml deleted file mode 100644 index 37e304ac4d..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/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:sample="http://sample">
- <deployable composite="sample:Add"/>
-</contribution>
\ No newline at end of file diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/test/java/calculator/AddTestCase.java b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/test/java/calculator/AddTestCase.java deleted file mode 100644 index b7baf9b64b..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-add/src/test/java/calculator/AddTestCase.java +++ /dev/null @@ -1,56 +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 calculator;
-
-import static org.junit.Assert.assertEquals;
-
-import java.rmi.Naming;
-
-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;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * This shows how to test the Calculator service component.
- */
-public class AddTestCase {
-
- private static Node node;
- private static AddService addService;
-
- @BeforeClass
- public static void setUp() throws Exception {
- addService = new AddServiceImpl();
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
-
- }
-
- @Test
- public void testCalculator() throws Exception {
- // Calculate
- assertEquals(addService.add(3, 2), 5.0, 0.0);
- }
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/pom.xml b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/pom.xml deleted file mode 100644 index 63c2220108..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/pom.xml +++ /dev/null @@ -1,74 +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-sample-domain-distributed-calculator</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>sample-domain-distributed-calculator-contribution-calculator</artifactId>
- <name>Apache Tuscany SCA Sample Domain Distributed Calculator Contribution Calculator</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>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>2.0-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-rmi-runtime</artifactId>
- <version>2.0-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.tuscany.maven.plugins</groupId>
- <artifactId>maven-tuscany-plugin</artifactId>
- <version>2.0-SNAPSHOT</version>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/AddService.java b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/AddService.java deleted file mode 100644 index c7e6383559..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,31 +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 calculator;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-/**
- * The interface for the add service
- */
-@Remotable
-public interface AddService {
-
- double add(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 0bac3da45c..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,39 +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 calculator;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-/**
- * The Calculator service interface.
- */
-@Remotable
-public interface CalculatorService extends Remote {
-
- double add(double n1, double n2) throws RemoteException;
-
- double subtract(double n1, double n2) throws RemoteException;
-
- double multiply(double n1, double n2) throws RemoteException;
-
- double divide(double n1, double n2) throws RemoteException;
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 389ecb5f82..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,68 +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 calculator;
-
-import org.oasisopen.sca.annotation.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);
- }
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/DivideService.java b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/DivideService.java deleted file mode 100644 index 835e4fda6d..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/DivideService.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 calculator;
-
-/**
- * The interface for the divide service
- */
-public interface DivideService {
-
- double divide(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/MultiplyService.java b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index db568cc762..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/MultiplyService.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 calculator;
-
-/**
- * The interface for the multiply service
- */
-public interface MultiplyService {
-
- double multiply(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/SubtractService.java b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/SubtractService.java deleted file mode 100644 index 30e4e6a56a..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/SubtractService.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 calculator;
-
-/**
- * The interface for the subtract service
- */
-public interface SubtractService {
-
- double subtract(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/resources/Calculator.composite b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/resources/Calculator.composite deleted file mode 100644 index 32b748d5ab..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/main/resources/Calculator.composite +++ /dev/null @@ -1,31 +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"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="Calculator">
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" target="AddServiceComponent/AddService"/>
- </component>
-
-</composite>
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/AddServiceImpl.java b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/AddServiceImpl.java deleted file mode 100644 index e9c635e3c8..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,30 +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 calculator;
-
-/**
- * An implementation of the Add service
- */
-public class AddServiceImpl implements AddService {
-
- public double add(double n1, double n2) {
- return n1 + n2;
- }
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/CalculatorTestCase.java b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/CalculatorTestCase.java deleted file mode 100644 index 6cccf83fbb..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/CalculatorTestCase.java +++ /dev/null @@ -1,59 +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 calculator;
-
-import static org.junit.Assert.assertEquals;
-
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-
-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;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * This shows how to test the Calculator service component.
- */
-public class CalculatorTestCase {
-
- private static Node node;
- private static CalculatorService calculatorService;
-
- @BeforeClass
- public static void setUp() throws Exception {
- calculatorService = new CalculatorServiceImpl();
- ((CalculatorServiceImpl)calculatorService).setAddService(new AddServiceImpl());
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
-
- }
-
- @Test
- public void testCalculator() throws Exception {
- // Calculate
- assertEquals(calculatorService.add(3, 2), 5.0, 0.0);
- }
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/pom.xml b/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/pom.xml deleted file mode 100644 index 3cb2db8c64..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/distributed-calculator/pom.xml +++ /dev/null @@ -1,44 +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-sample-domain</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-sample-domain-distributed-calculator</artifactId>
- <packaging>pom</packaging>
- <name>Apache Tuscany SCA Sample Domain Distributed Calculator</name>
-
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>contribution-calculator</module>
- <module>contribution-add</module>
- </modules>
- </profile>
- </profiles>
-</project>
diff --git a/sca-java-2.x/trunk/contrib/samples/domain/pom.xml b/sca-java-2.x/trunk/contrib/samples/domain/pom.xml deleted file mode 100644 index 1e50881ff2..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/domain/pom.xml +++ /dev/null @@ -1,42 +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>
- </parent>
- <artifactId>tuscany-sample-domain</artifactId>
- <packaging>pom</packaging>
- <name>Apache Tuscany SCA Sample Domain</name>
-
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>distributed-calculator</module>
- </modules>
- </profile>
- </profiles>
-</project>
diff --git a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/pom.xml b/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/pom.xml deleted file mode 100644 index 8254ce61a5..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/pom.xml +++ /dev/null @@ -1,53 +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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-sca</artifactId> - <version>2.0-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>sample-jsonp-webapp</artifactId> - <packaging>war</packaging> - <version>1.0</version> - <name>jsonp-webapp</name> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca.shades</groupId> - <artifactId>tuscany-base-nodep</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-binding-jsonp-runtime</artifactId> - <version>2.0-SNAPSHOT</version> - <type>jar</type> - </dependency> - </dependencies> - - <build> - <finalName>jsonp-webapp</finalName> - </build> -</project> - diff --git a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/Location.java b/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/Location.java deleted file mode 100644 index 1a47edf73c..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/Location.java +++ /dev/null @@ -1,33 +0,0 @@ -package sample; - -public class Location { - - private String city; - private String country; - private int altitude; - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - public int getAltitude() { - return altitude; - } - - public void setAltitude(int altitude) { - this.altitude = altitude; - } - -} diff --git a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareService.java b/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareService.java deleted file mode 100644 index 3c79c6c2e9..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareService.java +++ /dev/null @@ -1,14 +0,0 @@ -package sample; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface ShareService { - - String shareName(String firstName, String lastName); - - int shareAge(int age); - - Location shareLocation(Location location); - -} diff --git a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java b/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java deleted file mode 100644 index 13bae36eb9..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package sample; - -import org.oasisopen.sca.annotation.Service; - -@Service(ShareService.class) -public class ShareServiceImpl implements ShareService { - - @Override - public String shareName(String firstName, String lastName) { - return firstName + " " + lastName; - } - - @Override - public int shareAge(int age) { - return age; - } - - @Override - public Location shareLocation(Location location) { - return location; - } - -} diff --git a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF deleted file mode 100644 index 58630c02ef..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0
-
diff --git a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.composite b/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.composite deleted file mode 100644 index 515c2dba09..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.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" - xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" - targetNamespace="http://samples" - name="Stock"> - - <component name="c"> - <implementation.java class="sample.ShareServiceImpl"/> - <service name="ShareService"> - <interface.java interface="sample.ShareService"/> - <tuscany:binding.jsonp/> - </service> - </component> - -</composite>
\ No newline at end of file diff --git a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml b/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 0deec29fcc..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,34 +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. ---> -<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:j2ee="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_3.0.xsd" version="3.0"> - <display-name>Apache Tuscany JSONP Sample</display-name> - <filter> - <filter-name>tuscany</filter-name> - <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class> - <async-supported>true</async-supported> - </filter> - <filter-mapping> - <filter-name>tuscany</filter-name> - <url-pattern>/*</url-pattern> - </filter-mapping> - <welcome-file-list> - <welcome-file>index.html</welcome-file> - </welcome-file-list> -</web-app>
\ No newline at end of file diff --git a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/index.html b/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/index.html deleted file mode 100644 index 2a754e494e..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/src/main/webapp/index.html +++ /dev/null @@ -1,104 +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. ---> -<html> - <head> - <title>Apache Tuscany Comet Sample</title> - <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> - <script type="text/javascript" src="http://jquery-json.googlecode.com/svn/trunk/jquery.json.min.js"></script> - <script type="text/javascript"> - $(document).ready(function() { - document.getElementById("shareLocationButton").onclick = function(event) { - var location = { - city: document.getElementById("city").value, - country: document.getElementById("country").value, - altitude: document.getElementById("altitude").value - }; - $.getJSON("c/ShareService/shareLocation", "location=" + $.toJSON(location), shareLocationCallback); - } - }); - - function shareNameCallback(response) { - alert("Your name, " + response + ", has been shared."); - } - - function shareAge() { - document.getElementById("shareAgeForm").submit(); - } - - function shareAgeCallback(response) { - alert("Your age, " + response + ", has been shared."); - } - - function shareLocationCallback(response) { - alert("Your location, " + response.city + " - " + response.country + " - " + response.altitude + ", has been shared."); - } - </script> - </head> - <body> - <h2>Apache Tuscany JSONP Sample</h2> - <h3>Share Personal Information Webapp</h3> - - <form method="GET" action="c/ShareService/shareName"> - <b><label>Share Full Name</label></b> - <table> - <tr> - <td>First Name</td> - <td><input type="text" name="firstName" value="John"/> - </tr> - <tr> - <td>Last Name</td> - <td><input type="text" name="lastName" value="Locke"/> - </tr> - </table> - <input type="hidden" name="callback" value="shareNameCallback"/> - <input type="submit" value="Share"/> - </form> - - <form method="GET" id="shareAgeForm" action="c/ShareService/shareAge"> - <b><label>Share Age</label></b> - <table> - <tr> - <td>Age</td> - <td><input type="text" name="age" value="54"/> - </tr> - </table> - <input type="hidden" name="callback" value="shareAgeCallback"/> - <input type="submit" value="Share" onclick="shareAge()"/> - </form> - - <form method="GET" > - <b><label>Share Location</label></b> - <table> - <tr> - <td>City</td> - <td><input type="text" name="city" id="city" value="Los Angeles" /> - </tr> - <tr> - <td>Country</td> - <td><input type="text" name="country" id="country" value="USA" /> - </tr> - <tr> - <td>Altitude</td> - <td><input type="text" name="altitude" id="altitude" value="560" /> - </tr> - </table> - <input type="button" id="shareLocationButton" value="Share"/> - </form> - </body> -</html> diff --git a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/README b/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/README deleted file mode 100644 index 7108333efa..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/README +++ /dev/null @@ -1,20 +0,0 @@ -JSE Sample Launcher
-===================
-
-This directory contains a sample java launcher for the
-tuscany sample contributions.
-
-The README file in the <distribution-unpack-dir>/samples directory provides
-general instructions about building and running sample contributions using the
-tuscany sample launchers ( where distribution-unpack-dir is the directory in which you
-unpacked the tuscany binary distribution archive)
-
-To use this sample JSE launcher with ant excute the command
-
-ant run-<contributionname>
-
-where run-<contributionname> is one of the targets in the build.xml file
-
-To use this sample launcher to run all of the contributions as junit test cases,
-execute the command "mvn" in the launcher directory.
-
diff --git a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/build.xml b/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/build.xml deleted file mode 100644 index 64bad00b76..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/build.xml +++ /dev/null @@ -1,118 +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.
--->
-<project name="launcher-embedded-jse" default="run">
- <property name="tuscany.home" value="../.."/>
- <property name="jar.name" value="sample-launcher-embedded-jse.jar" />
- <property name="main.class" value="launcher.SampleJSELauncher" />
- <property name="wait.before.stopping" value="dontWaitBeforeStopping" />
-
- <echo>${tuscany.home}</echo>
-
- <target name="init">
- <delete quiet="true" includeemptydirs="true">
- <fileset dir="target"/>
- </delete>
- <mkdir dir="target/classes"/>
- </target>
-
- <target name="compile" depends="init">
- <javac srcdir="src/main/java"
- destdir="target/classes"
- debug="on"
- source="1.5"
- target="1.5"
- failonerror="true">
- <classpath>
- <fileset dir="${tuscany.home}/lib">
- <include name="tuscany-base-*.jar" />
- </fileset>
- </classpath>
- </javac>
- <jar destfile="target/${jar.name}" basedir="target/classes">
- <manifest>
- <attribute name="Main-Class" value="${main.class}" />
- </manifest>
- </jar>
- </target>
-
- <target name="run" depends="compile">
- <echo>Please use 'ant run-name-of-sample-contribution-to-run' for example, try one of</echo>
- <echo> 'ant run-contribution-binding-sca-calculator' </echo>
- <echo> 'ant run-contribution-binding-ws-calculator' </echo>
- <echo> 'ant run-contribution-binding-rmi-calculator' </echo>
- <echo> 'ant run-contribution-implementation-java-calculator' </echo>
- </target>
-
- <target name="run-contribution-binding-sca-calculator" depends="compile">
- <java classname="${main.class}"
- fork="true"
- failonerror="true">
- <classpath>
- <pathelement location="target/${jar.name}"/>
- <fileset dir="${tuscany.home}/features">
- <include name="tuscany-sca-manifest.jar" />
- </fileset>
- </classpath>
- <arg value="contribution-binding-sca-calculator"/>
- <arg value="${wait.before.stopping}"/>
- </java>
- </target>
-
- <target name="run-contribution-binding-ws-calculator" depends="compile">
- <java classname="launcher.JSELauncherBindingWSCalculator"
- fork="true"
- failonerror="true">
- <classpath>
- <pathelement location="target/${jar.name}"/>
- <fileset dir="${tuscany.home}/features">
- <include name="tuscany-sca-manifest.jar" />
- </fileset>
- </classpath>
- </java>
- </target>
-
- <target name="run-contribution-binding-rmi-calculator" depends="compile">
- <java classname="${main.class}"
- fork="true"
- failonerror="true">
- <classpath>
- <pathelement location="target/${jar.name}"/>
- <fileset dir="${tuscany.home}/features">
- <include name="tuscany-sca-manifest.jar" />
- </fileset>
- </classpath>
- <arg value="contribution-binding-rmi-calculator"/>
- </java>
- </target>
-
- <target name="run-contribution-implementation-java-calculator" depends="compile">
- <java classname="${main.class}"
- fork="true"
- failonerror="true">
- <classpath>
- <pathelement location="target/${jar.name}"/>
- <fileset dir="${tuscany.home}/features">
- <include name="tuscany-sca-manifest.jar" />
- </fileset>
- </classpath>
- <arg value="contribution-implementaton-java-calculator"/>
- </java>
- </target>
-
-</project>
diff --git a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/pom.xml b/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/pom.xml deleted file mode 100644 index b1f8e5c15c..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/pom.xml +++ /dev/null @@ -1,83 +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-sca</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
- <artifactId>sample-launcher-embedded-jse-spec</artifactId>
- <name>Apache Tuscany SCA Sample Launcher Embedded JSE Spec</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-api</artifactId>
- <type>pom</type>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-core</artifactId>
- <type>pom</type>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-webservice</artifactId>
- <type>pom</type>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-ejava</artifactId>
- <type>pom</type>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-domain-node</artifactId>
- <type>pom</type>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
-
- <plugins>
-
- </plugins>
- </build>
-</project>
diff --git a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 12d80ffd1c..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,38 +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 calculator;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-
-/**
- * The Calculator service interface.
- */
-@Remotable
-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);
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/main/java/launcher/JSELauncherBindingWSCalculator.java b/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/main/java/launcher/JSELauncherBindingWSCalculator.java deleted file mode 100644 index 2f48e273bd..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/main/java/launcher/JSELauncherBindingWSCalculator.java +++ /dev/null @@ -1,75 +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 launcher;
-
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node2.Node;
-import org.apache.tuscany.sca.node2.NodeFactory;
-
-import calculator.CalculatorService;
-
-/**
- * This client program shows how to create an embedded SCA runtime, load a contribution,
- * start it and locate and invoke an SCA component
- */
-public class JSELauncherBindingWSCalculator {
-
- public static void main(String[] args) throws Exception {
- JSELauncherBindingWSCalculator launcher = new JSELauncherBindingWSCalculator();
- launcher.launchBindingWSCalculator();
- }
-
- /*
- * Using the Tuscany Node API to load a contribution.
- * Using the Tuscany Node API to get a local service proxy
- */
- public void launchBindingWSCalculator(){
- NodeFactory nodeFactory = NodeFactory.newInstance();
- Node node = nodeFactory.createNode("MyDomain");
-
- try {
- node.installContribution("../../../samples/contribution-binding-ws-calculator/target/sample-contribution-binding-ws-calculator.jar");
- } catch(Exception ex){
- System.out.println("Exception on installContribution");
- ex.printStackTrace();
- }
-
- //node.start();
-
- CalculatorService calculator = null;
-
- try {
- calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
- } catch(Exception ex){
- System.out.println("Exception on getService");
- ex.printStackTrace();
- }
-
- // TODO - could use JUnit assertions but don't want to have to handle JUnit dependency from Ant script
- double result = calculator.add(3, 2);
- System.out.println("3 + 2 = " + result);
- if (result != 5.0){
- throw new SampleLauncherException();
- }
-
- node.stop();
- }
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/main/java/launcher/SampleLauncherException.java b/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/main/java/launcher/SampleLauncherException.java deleted file mode 100644 index f2ed3d421d..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/main/java/launcher/SampleLauncherException.java +++ /dev/null @@ -1,42 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package launcher;
-
-/**
- * This exception signals problems in the management of SCA component execution.
- */
-public class SampleLauncherException extends RuntimeException {
- /**
- * Constructs a SampleLauncherException with no detail message.
- */
- public SampleLauncherException() {
- super();
- }
-
- /**
- * Constructs a SampleLauncherException with the specified detail
- * message.
- *
- * @param message the detail message
- */
- public SampleLauncherException(String message) {
- super(message);
- }
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/test/java/launcher/LauncherTestCase.java b/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/test/java/launcher/LauncherTestCase.java deleted file mode 100644 index 04521d326b..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/launcher-embedded-jse-spec/src/test/java/launcher/LauncherTestCase.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 launcher;
-
-import org.junit.Test;
-
-/**
- * Test sample contributions.
- */
-public class LauncherTestCase {
-
- @Test
- public void testContributionBindingWSCalculator() throws Exception {
- JSELauncherBindingWSCalculator.main(null);
- }
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/pom.xml b/sca-java-2.x/trunk/contrib/samples/pom.xml deleted file mode 100644 index 1459d66152..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/pom.xml +++ /dev/null @@ -1,90 +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-sca</artifactId> - <version>2.0-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - <artifactId>tuscany-contrib-samples</artifactId> - <packaging>pom</packaging> - <name>Apache Tuscany SCA Contributed Samples</name> - - <modules> - <module>comet-webapp</module> - </modules> - - <profiles> - <profile> - <id>eclipse</id> - <build> - <defaultGoal>org.apache.tuscany.maven.plugins:maven-bundle-plugin:eclipse</defaultGoal> - <!-- - <plugins> - <plugin> - <groupId>org.apache.tuscany.maven.plugins</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>1.0.6</version> - <extensions>true</extensions> - <executions> - <execution> - <id>generate-pde</id> - <phase>generate-resources</phase> - <goals> - <goal>eclipse</goal> - </goals> - <configuration> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - --> - </build> - </profile> - </profiles> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <pluginManagement> - <plugins> - <plugin> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifestFile>${basedir}/META-INF/MANIFEST.MF</manifestFile> - </archive> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - -</project> diff --git a/sca-java-2.x/trunk/contrib/samples/reporting/README b/sca-java-2.x/trunk/contrib/samples/reporting/README deleted file mode 100644 index b33446cde8..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/reporting/README +++ /dev/null @@ -1,6 +0,0 @@ -Reporting Sample
-================
-
-A simple sample to motivate the implementation of some mechanisms for
-retiriving information about an active domain and it's nodes.
-
diff --git a/sca-java-2.x/trunk/contrib/samples/reporting/pom.xml b/sca-java-2.x/trunk/contrib/samples/reporting/pom.xml deleted file mode 100644 index 103734b9f7..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/reporting/pom.xml +++ /dev/null @@ -1,94 +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-reporting</artifactId>
- <name>Apache Tuscany SCA Sample Reporting</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-api</artifactId>
- <type>pom</type>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-core</artifactId>
- <type>pom</type>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-webservice</artifactId>
- <type>pom</type>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-ejava</artifactId>
- <type>pom</type>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-script-runtime</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-json</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
-
- <plugins>
-
- </plugins>
- </build>
-</project>
diff --git a/sca-java-2.x/trunk/contrib/samples/reporting/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/trunk/contrib/samples/reporting/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 12d80ffd1c..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/reporting/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,38 +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 calculator;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-
-/**
- * The Calculator service interface.
- */
-@Remotable
-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);
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/reporting/src/main/java/reporting/JSELauncheCalculator.java b/sca-java-2.x/trunk/contrib/samples/reporting/src/main/java/reporting/JSELauncheCalculator.java deleted file mode 100644 index 25729ea1ea..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/reporting/src/main/java/reporting/JSELauncheCalculator.java +++ /dev/null @@ -1,333 +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 reporting;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.StringWriter;
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointReferenceImpl;
-import org.apache.tuscany.sca.definitions.Definitions;
-import org.apache.tuscany.sca.deployment.Deployer;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.apache.tuscany.sca.node.configuration.ContributionConfiguration;
-import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
-import org.apache.tuscany.sca.node.impl.NodeFactoryImpl;
-import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
-import org.apache.tuscany.sca.runtime.EndpointRegistry;
-import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.sun.jmx.remote.util.Service;
-import com.sun.xml.internal.txw2.output.IndentingXMLStreamWriter;
-
-import calculator.CalculatorService;
-
-/**
- * This client program shows how to extract useful(?) information from the Tuscany SCA runtime
- */
-public class JSELauncheCalculator {
-
- private static NodeFactory nodeFactory;
- private static Node node1;
- private static Node node2;
- private static CalculatorService calculator;
-
-
- public static void main(String[] args) throws Exception {
- JSELauncheCalculator launcher = new JSELauncheCalculator();
- launcher.setUp();
-
- launcher.callCalulator();
- launcher.listExtensions();
- launcher.listNodes();
- launcher.listNodeConfigurations();
- launcher.listContributions();
- launcher.listDomainComposite();
- launcher.listDomainDefinitions();
- launcher.listEndpoints();
- launcher.listWires();
-
- launcher.tearDown();
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- try {
-/* new
- org.apache.tuscany.sca.node2.NodeFactory nodeFactoryNew = org.apache.tuscany.sca.node2.NodeFactory.newInstance();
-
- org.apache.tuscany.sca.node2.Node node2New = nodeFactoryNew.createNode();
- node2New.installContribution("../domain/distributed-calculator/contribution-calculator/target/classes");
-
- calculator = node2New.getService(CalculatorService.class, "CalculatorServiceComponent");
-*/
-
-/* old */
- // TUSCANY-3675 - push hazelcast config into factory as adding it to URI doesn't work
- Properties properties = new Properties();
- properties.setProperty("bind", "192.168.0.2");
- nodeFactory = NodeFactory.newInstance(properties);
-
- // TUSCANY-3675 - push hazelcast config into factory as adding it to URI doesn't work
- //node2 = nodeFactory.createNode(new Contribution("c1", "../domain/distributed-calculator/contribution-calculator/target/classes"));
- //node2 = nodeFactory.createNode(URI.create("tuscany:default?listen=127.0.0.1:14820"), "../domain/distributed-calculator/contribution-calculator/target/classes");
- //node2 = nodeFactory.createNode(URI.create("tuscany:default"), "../domain/distributed-calculator/contribution-calculator/target/classes");
- node2 = nodeFactory.createNode(new File("./target/classes/node-calculator.xml").toURL());
-
- node2.start();
-
- calculator = node2.getService(CalculatorService.class, "CalculatorServiceComponent");
-
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
- node2.stop();
- }
-
- @Test
- public void callCalulator(){
- printTestName("callCalulator");
- double result = calculator.add(3, 2);
- System.out.println("3 + 2 = " + result);
- }
-
- @Test
- public void listExtensions(){
- printTestName("listExtensions");
- // TODO
- }
-
- @Test
- public void listNodes(){
- printTestName("listNodes");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Object nodeKey : nodes.keySet()){
- System.out.println(nodeKey);
- }
- }
-
- @Test
- public void listNodeConfigurations(){
- printTestName("listNodeConfigurations");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- printXML(((NodeImpl)node).getConfiguration());
- }
- }
-
- @Test
- public void listContributions(){
- printTestName("listContributions");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- NodeConfiguration nodeConfiguration = ((NodeImpl)node).getConfiguration();
- for (org.apache.tuscany.sca.contribution.Contribution contribution : ((NodeImpl)node).getContributions()){
- System.out.println("Contribution: " + contribution.getURI() + " location " + contribution.getLocation());
- for (Artifact artifact : contribution.getArtifacts()){
- System.out.println(" Artifact: " + artifact.getURI() + " location " + artifact.getLocation());
- }
- }
- }
- }
-
- @Test
- public void listDomainComposite(){
- printTestName("listDomainComposite");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- printXML(((NodeImpl)node).getDomainComposite());
- }
- }
-
- @Test
- public void listDomainDefinitions(){
- printTestName("listDomainDefinitions");
- Deployer deployer = ((NodeFactoryImpl)nodeFactory).getDeployer();
- Definitions systemDefinitions = deployer.getSystemDefinitions();
- printXML(systemDefinitions);
- }
-
- @Test
- public void listEndpoints(){
- printTestName("listEndpoints");
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- Node firstNode = nodes.values().iterator().next();
- NodeConfiguration firstNodeConfig = ((NodeImpl)firstNode).getConfiguration();
-
- DomainRegistryFactory domainRegistryFactory = ExtensibleDomainRegistryFactory.getInstance(registry);
- // TODO - I don't understand where the scheme gets set/used
- EndpointRegistry endpointRegistry = domainRegistryFactory.getEndpointRegistry("vm:" + firstNodeConfig.getDomainRegistryURI(), firstNodeConfig.getDomainURI());
-
- for (Endpoint endpoint : endpointRegistry.getEndpoints()){
- System.out.println(endpoint);
- printEndpointXML(endpoint);
- }
- }
-
- @Test
- public void listWires(){
- printTestName("listWires");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- listComponentWires(((NodeImpl)node).getDomainComposite());
- }
- }
-
- // utils
-
- private void listComponentWires(Composite composite){
- for(Component component : composite.getComponents()){
- if (component.getImplementation() instanceof Composite){
- listComponentWires((Composite)component.getImplementation());
- }
- System.out.println(" Component: " + component.getName());
-
- for(ComponentService service : component.getServices()){
- System.out.println(" Service: " + service.getName());
- for(Endpoint endpoint : service.getEndpoints()){
- System.out.println(" Endpoint: " + endpoint);
- System.out.println(" Binding: " + endpoint.getBinding().getType());
- printInvocationChains(((RuntimeEndpointImpl)endpoint).getInvocationChains());
- }
- }
- for(ComponentReference reference : component.getReferences()){
- System.out.println(" Reference: " + reference.getName());
- for(EndpointReference endpointReference : reference.getEndpointReferences()){
- System.out.println(" EndpointReference: " + endpointReference);
- Binding binding = endpointReference.getBinding();
- if (binding != null){
- System.out.println(" Binding: " + binding.getType());
- printInvocationChains(((RuntimeEndpointReferenceImpl)endpointReference).getInvocationChains());
- }
- }
- }
- }
- }
-
- private void printInvocationChains(List<InvocationChain> chains){
- for(InvocationChain chain : chains){
- System.out.println(" Operation: " + chain.getTargetOperation().getName());
- Invoker invoker = chain.getHeadInvoker();
- while(invoker != null){
- System.out.println(" Invoker: " + invoker.getClass().getName());
- if (invoker instanceof Interceptor){
- invoker = ((Interceptor)invoker).getNext();
- } else {
- invoker = null;
- }
- }
- }
- }
-
- private void printTestName(String name){
- System.out.println("=====================================================================");
- System.out.println(name);
- System.out.println("=====================================================================");
- }
-
- private void printXML(Object model){
- try {
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- StAXArtifactProcessorExtensionPoint xmlProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- StAXArtifactProcessor<Object> xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessors, inputFactory, null);
-
- ProcessorContext context = new ProcessorContext(registry);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLOutputFactory outputFactory = registry.getExtensionPoint(FactoryExtensionPoint.class).getFactory(XMLOutputFactory.class);
- XMLStreamWriter writer = new IndentingXMLStreamWriter(outputFactory.createXMLStreamWriter(bos));
-
- xmlProcessor.write(model, writer, context);
- writer.flush();
-
- System.out.println(bos.toString());
- } catch(Exception ex) {
- ex.printStackTrace();
- }
- }
-
- // TODO - we don't have a processor registered for RuntimeEndpointImpl?
- private void printEndpointXML(Endpoint model){
- try {
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- StAXArtifactProcessorExtensionPoint xmlProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- StAXArtifactProcessor<Endpoint> xmlProcessor = xmlProcessors.getProcessor(Endpoint.class);
-
- ProcessorContext context = new ProcessorContext(registry);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLOutputFactory outputFactory = registry.getExtensionPoint(FactoryExtensionPoint.class).getFactory(XMLOutputFactory.class);
- XMLStreamWriter writer = new IndentingXMLStreamWriter(outputFactory.createXMLStreamWriter(bos));
-
- xmlProcessor.write(model, writer, context);
- writer.flush();
-
- System.out.println(bos.toString());
- } catch(Exception ex) {
- ex.printStackTrace();
- }
- }
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/reporting/src/main/java/reporting/JSELauncherAdd.java b/sca-java-2.x/trunk/contrib/samples/reporting/src/main/java/reporting/JSELauncherAdd.java deleted file mode 100644 index 5351ed263b..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/reporting/src/main/java/reporting/JSELauncherAdd.java +++ /dev/null @@ -1,144 +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 reporting;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.StringWriter;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointReferenceImpl;
-import org.apache.tuscany.sca.definitions.Definitions;
-import org.apache.tuscany.sca.deployment.Deployer;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.apache.tuscany.sca.node.configuration.ContributionConfiguration;
-import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
-import org.apache.tuscany.sca.node.impl.NodeFactoryImpl;
-import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
-import org.apache.tuscany.sca.runtime.EndpointRegistry;
-import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory;
-import org.apache.tuscany.sca.runtime.RuntimeProperties;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.sun.jmx.remote.util.Service;
-import com.sun.xml.internal.txw2.output.IndentingXMLStreamWriter;
-
-import calculator.CalculatorService;
-
-/**
- * This client program shows how to extract useful(?) information from the Tuscany SCA runtime
- */
-public class JSELauncherAdd {
-
- private static NodeFactory nodeFactory;
- private static Node node1;
- private static Node node2;
- private static CalculatorService calculator;
-
-
- public static void main(String[] args) throws Exception {
- JSELauncherAdd launcher = new JSELauncherAdd ();
- launcher.setUp();
-
- launcher.waitForInput();
-
- launcher.tearDown();
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- try {
-/* new
- org.apache.tuscany.sca.node2.NodeFactory nodeFactoryNew = org.apache.tuscany.sca.node2.NodeFactory.newInstance();
- org.apache.tuscany.sca.node2.Node node1New = nodeFactoryNew.createNode();
- node1New.installContribution("../domain/distributed-calculator/contribution-add/target/classes");
-
-*/
-
-/* old */
- // TUSCANY-3675 - push hazelcast config into factory as adding it to URI doesn't work
- Properties properties = new Properties();
- properties.setProperty("bind", "192.168.0.2");
- nodeFactory = NodeFactory.newInstance(properties);
-
- // TUSCANY-3675 - push hazelcast config into factory as adding it to URI doesn't work
- //node1 = nodeFactory.createNode(new Contribution("c1", "../domain/distributed-calculator/contribution-add/target/classes"));
- //node1 = nodeFactory.createNode(URI.create("tuscany:default?listen=127.0.0.1:14820"), "../domain/distributed-calculator/contribution-add/target/classes");
- //node1 = nodeFactory.createNode(URI.create("tuscany:default"), "../domain/distributed-calculator/contribution-add/target/classes");
- node1 = nodeFactory.createNode(new File("./target/classes/node-add.xml").toURL());
-
- node1.start();
-
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
- node1.stop();
- }
-
- @Test
- @Ignore
- public void waitForInput(){
- System.out.println("Press key to end");
- try {
- System.in.read();
- } catch(Exception ex){
- // do nothing
- }
- }
-
-}
diff --git a/sca-java-2.x/trunk/contrib/samples/reporting/src/main/resources/node-add.xml b/sca-java-2.x/trunk/contrib/samples/reporting/src/main/resources/node-add.xml deleted file mode 100644 index 7a4a6d5695..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/reporting/src/main/resources/node-add.xml +++ /dev/null @@ -1,34 +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.
--->
-<node xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
- xmlns="http://tuscany.apache.org/xmlns/sca/1.1"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- uri="node-add"
- domain="default"
- domainRegistry="tuscany:default">
-
- <!-- Configure the base URIs for a given binding -->
- <binding name="sca:binding.sca" baseURIs="http://localhost:8081/sca"/>
- <binding name="sca:binding.ws" baseURIs="http://localhost:8082/ws"/>
-
- <!-- Configure a list of contributions -->
- <contribution uri="contribution-add" location="../../../domain/distributed-calculator/contribution-add/target/classes"/>
-
-</node>
\ No newline at end of file diff --git a/sca-java-2.x/trunk/contrib/samples/reporting/src/main/resources/node-calculator.xml b/sca-java-2.x/trunk/contrib/samples/reporting/src/main/resources/node-calculator.xml deleted file mode 100644 index 31098b129d..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/reporting/src/main/resources/node-calculator.xml +++ /dev/null @@ -1,34 +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.
--->
-<node xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
- xmlns="http://tuscany.apache.org/xmlns/sca/1.1"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- uri="node-calculator"
- domain="default"
- domainRegistry="tuscany:default">
-
- <!-- Configure the base URIs for a given binding -->
- <binding name="sca:binding.sca" baseURIs="http://localhost:8083/sca"/>
- <binding name="sca:binding.ws" baseURIs="http://localhost:8084/ws"/>
-
- <!-- Configure a list of contributions -->
- <contribution uri="contribution-calculator" location="../../../domain/distributed-calculator/contribution-calculator/target/classes"/>
-
-</node>
\ No newline at end of file diff --git a/sca-java-2.x/trunk/contrib/samples/reporting/src/test/java/reporting/JSELauncherReportingTestCase.java b/sca-java-2.x/trunk/contrib/samples/reporting/src/test/java/reporting/JSELauncherReportingTestCase.java deleted file mode 100644 index b4cc8fa3ee..0000000000 --- a/sca-java-2.x/trunk/contrib/samples/reporting/src/test/java/reporting/JSELauncherReportingTestCase.java +++ /dev/null @@ -1,320 +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 reporting;
-
-import java.io.ByteArrayOutputStream;
-import java.io.StringWriter;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointReferenceImpl;
-import org.apache.tuscany.sca.definitions.Definitions;
-import org.apache.tuscany.sca.deployment.Deployer;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.apache.tuscany.sca.node.configuration.ContributionConfiguration;
-import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
-import org.apache.tuscany.sca.node.impl.NodeFactoryImpl;
-import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
-import org.apache.tuscany.sca.runtime.EndpointRegistry;
-import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.sun.jmx.remote.util.Service;
-import com.sun.xml.internal.txw2.output.IndentingXMLStreamWriter;
-
-import calculator.CalculatorService;
-
-/**
- * This client program shows how to extract useful(?) information from the Tuscany SCA runtime
- */
-public class JSELauncherReportingTestCase {
-
- private static NodeFactory nodeFactory;
- private static Node node1;
- private static Node node2;
- private static CalculatorService calculator;
-
-
- public static void main(String[] args) throws Exception {
- JSELauncherReportingTestCase launcher = new JSELauncherReportingTestCase();
- launcher.setUp();
-
- launcher.callCalulator();
-/*
- launcher.listNodes();
- launcher.listNodeConfigurations();
- launcher.listContributions();
- launcher.listDomainDefinitions();
- launcher.listEndpoints();
-*/
- launcher.listWires();
- launcher.tearDown();
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- try {
-/* new
- org.apache.tuscany.sca.node2.NodeFactory nodeFactoryNew = org.apache.tuscany.sca.node2.NodeFactory.newInstance();
- org.apache.tuscany.sca.node2.Node node1New = nodeFactoryNew.createNode();
- node1New.installContribution("../domain/distributed-calculator/contribution-add/target/classes");
-
- org.apache.tuscany.sca.node2.Node node2New = nodeFactoryNew.createNode();
- node2New.installContribution("../domain/distributed-calculator/contribution-calculator/target/classes");
-
- calculator = node2New.getService(CalculatorService.class, "CalculatorServiceComponent");
-*/
-
-/* old */
- nodeFactory = NodeFactory.newInstance();
- node1 = nodeFactory.createNode(new Contribution("c1", "../domain/distributed-calculator/contribution-add/target/classes"));
- node1.start();
-
- node2 = nodeFactory.createNode(new Contribution("c1", "../domain/distributed-calculator/contribution-calculator/target/classes"));
- node2.start();
-
- calculator = node2.getService(CalculatorService.class, "CalculatorServiceComponent");
-
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
- node1.stop();
- node2.stop();
- }
-
- @Test
- public void callCalulator(){
- printTestName("callCalulator");
- double result = calculator.add(3, 2);
- System.out.println("3 + 2 = " + result);
- }
-
- @Test
- public void listNodes(){
- printTestName("listNodes");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Object nodeKey : nodes.keySet()){
- System.out.println(nodeKey);
- }
- }
-
- @Test
- public void listNodeConfigurations(){
- printTestName("listNodeConfigurations");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- printXML(((NodeImpl)node).getConfiguration());
- }
- }
-
- @Test
- public void listContributions(){
- printTestName("listContributions");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- NodeConfiguration nodeConfiguration = ((NodeImpl)node).getConfiguration();
- for (org.apache.tuscany.sca.contribution.Contribution contribution : ((NodeImpl)node).getContributions()){
- System.out.println("Contribution: " + contribution.getURI() + " location " + contribution.getLocation());
- for (Artifact artifact : contribution.getArtifacts()){
- System.out.println(" Artifact: " + artifact.getURI() + " location " + artifact.getLocation());
- }
- }
- }
- }
-
- @Test
- public void listDomainComposite(){
- printTestName("listDomainComposite");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- printXML(((NodeImpl)node).getDomainComposite());
- }
- }
-
- @Test
- public void listDomainDefinitions(){
- printTestName("listDomainDefinitions");
- Deployer deployer = ((NodeFactoryImpl)nodeFactory).getDeployer();
- Definitions systemDefinitions = deployer.getSystemDefinitions();
- printXML(systemDefinitions);
- }
-
- @Test
- public void listEndpoints(){
- printTestName("listEndpoints");
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- Node firstNode = nodes.values().iterator().next();
- NodeConfiguration firstNodeConfig = ((NodeImpl)firstNode).getConfiguration();
-
- DomainRegistryFactory domainRegistryFactory = ExtensibleDomainRegistryFactory.getInstance(registry);
- // TODO - I don't understand where the scheme gets set/used
- EndpointRegistry endpointRegistry = domainRegistryFactory.getEndpointRegistry("vm:" + firstNodeConfig.getDomainRegistryURI(), firstNodeConfig.getDomainURI());
-
- for (Endpoint endpoint : endpointRegistry.getEndpoints()){
- System.out.println(endpoint);
- printEndpointXML(endpoint);
- }
- }
-
- @Test
- public void listWires(){
- printTestName("listWires");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- listComponentWires(((NodeImpl)node).getDomainComposite());
- }
- }
-
- // utils
-
- private void listComponentWires(Composite composite){
- for(Component component : composite.getComponents()){
- if (component.getImplementation() instanceof Composite){
- listComponentWires((Composite)component.getImplementation());
- }
- System.out.println(" Component: " + component.getName());
-
- for(ComponentService service : component.getServices()){
- System.out.println(" Service: " + service.getName());
- for(Endpoint endpoint : service.getEndpoints()){
- System.out.println(" Endpoint: " + endpoint);
- System.out.println(" Binding: " + endpoint.getBinding().getType());
- printInvocationChains(((RuntimeEndpointImpl)endpoint).getInvocationChains());
- }
- }
- for(ComponentReference reference : component.getReferences()){
- System.out.println(" Reference: " + reference.getName());
- for(EndpointReference endpointReference : reference.getEndpointReferences()){
- System.out.println(" EndpointReference: " + endpointReference);
- Binding binding = endpointReference.getBinding();
- if (binding != null){
- System.out.println(" Binding: " + binding.getType());
- printInvocationChains(((RuntimeEndpointReferenceImpl)endpointReference).getInvocationChains());
- }
- }
- }
- }
- }
-
- private void printInvocationChains(List<InvocationChain> chains){
- for(InvocationChain chain : chains){
- System.out.println(" Operation: " + chain.getTargetOperation().getName());
- Invoker invoker = chain.getHeadInvoker();
- while(invoker != null){
- System.out.println(" Invoker: " + invoker.getClass().getName());
- if (invoker instanceof Interceptor){
- invoker = ((Interceptor)invoker).getNext();
- } else {
- invoker = null;
- }
- }
- }
- }
-
- private void printTestName(String name){
- System.out.println("=====================================================================");
- System.out.println(name);
- System.out.println("=====================================================================");
- }
-
- private void printXML(Object model){
- try {
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- StAXArtifactProcessorExtensionPoint xmlProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- StAXArtifactProcessor<Object> xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessors, inputFactory, null);
-
- ProcessorContext context = new ProcessorContext(registry);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLOutputFactory outputFactory = registry.getExtensionPoint(FactoryExtensionPoint.class).getFactory(XMLOutputFactory.class);
- XMLStreamWriter writer = new IndentingXMLStreamWriter(outputFactory.createXMLStreamWriter(bos));
-
- xmlProcessor.write(model, writer, context);
- writer.flush();
-
- System.out.println(bos.toString());
- } catch(Exception ex) {
- ex.printStackTrace();
- }
- }
-
- // TODO - we don't have a processor registered for RuntimeEndpointImpl?
- private void printEndpointXML(Endpoint model){
- try {
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- StAXArtifactProcessorExtensionPoint xmlProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- StAXArtifactProcessor<Endpoint> xmlProcessor = xmlProcessors.getProcessor(Endpoint.class);
-
- ProcessorContext context = new ProcessorContext(registry);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLOutputFactory outputFactory = registry.getExtensionPoint(FactoryExtensionPoint.class).getFactory(XMLOutputFactory.class);
- XMLStreamWriter writer = new IndentingXMLStreamWriter(outputFactory.createXMLStreamWriter(bos));
-
- xmlProcessor.write(model, writer, context);
- writer.flush();
-
- System.out.println(bos.toString());
- } catch(Exception ex) {
- ex.printStackTrace();
- }
- }
-
-}
|