diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-23 17:26:43 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-23 17:26:43 +0000 |
commit | 86749af86a750f4e6280bf5a96cea21d8792bf1b (patch) | |
tree | e29a618fe12b357a092c49409619b0f0fa590a90 /sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main | |
parent | 32d79029d9f21c0f8cb3db3010b41b0133a3a7b4 (diff) |
Add a test sample that uses Spring with both binding.http and binding.rest
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1073839 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
5 files changed, 157 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/java/sample/Helloworld.java b/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/java/sample/Helloworld.java new file mode 100644 index 0000000000..2faf096c33 --- /dev/null +++ b/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/java/sample/Helloworld.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package sample; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Helloworld { + + @GET + @Path("sayHello") + String sayHello(@QueryParam("name")String name); + +} diff --git a/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/java/sample/HelloworldImpl.java b/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/java/sample/HelloworldImpl.java new file mode 100644 index 0000000000..d8bdadbfe5 --- /dev/null +++ b/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/java/sample/HelloworldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package sample; + + +//@Scope("COMPOSITE") @EagerInit +public class HelloworldImpl implements Helloworld { + + public String sayHello(String name) { + return "Hello " + name; + } + +// @Init + public void init() { + System.out.println(sayHello("world")); + } +} diff --git a/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/resources/META-INF/helloworld-context.xml b/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/resources/META-INF/helloworld-context.xml new file mode 100644 index 0000000000..2e3e34cc18 --- /dev/null +++ b/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/resources/META-INF/helloworld-context.xml @@ -0,0 +1,32 @@ +<?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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:sca="http://www.springframework.org/schema/sca" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd"> + + <sca:service name="Helloworld" target="HelloworldBean" /> + + <bean id="HelloworldBean" class="sample.HelloworldImpl"> + </bean> + +</beans>
\ No newline at end of file diff --git a/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/resources/META-INF/helloworld.composite b/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/resources/META-INF/helloworld.composite new file mode 100644 index 0000000000..6d89d1ad71 --- /dev/null +++ b/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/resources/META-INF/helloworld.composite @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://sample"
+ name="helloworld-spring">
+
+ <component name="HelloworldComponent">
+ <implementation.spring location="helloworld-context.xml"/>
+ <service name="Helloworld">
+ <tuscany:binding.http />
+ <tuscany:binding.rest name="foo" />
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..2476201c93 --- /dev/null +++ b/sca-java-2.x/trunk/unreleased/samples/helloworld-spring-web-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:sample="http://sample"> + + <deployable composite="sample:helloworld-spring" /> + +</contribution> |