diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2012-03-07 08:40:04 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2012-03-07 08:40:04 +0000 |
commit | 61d713f05fa632b03c3ec38ca224e28de5f0ffd8 (patch) | |
tree | 4334322a90bda845473345e997c099f29477fd68 /sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld | |
parent | f742a208acdf8fdfa7352d16e083403b76998d06 (diff) |
Tag for beta4 Rc1
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1297882 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld')
5 files changed, 190 insertions, 0 deletions
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorld.java b/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorld.java new file mode 100644 index 0000000000..1f5b8b365d --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorld.java @@ -0,0 +1,31 @@ +/*
+ * 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 helloworld;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface HelloWorld {
+
+ String getGreetings(String s);
+
+ String getGreetingsException(String s) throws HelloWorldException;
+
+}
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorldClient.java b/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..7a94a90b19 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,49 @@ +/*
+ * 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 helloworld;
+
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Requires;
+
+@Requires("{http://tuscany.apache.org/xmlns/sca/1.1}testIntent")
+public class HelloWorldClient implements HelloWorld {
+
+ @Reference
+ public HelloWorld helloWorldWS;
+
+ public String getGreetings(String s) {
+ StatusImpl.appendStatus("At client.getGreetings() pre-invoke", s);
+ String response = helloWorldWS.getGreetings(s);
+ StatusImpl.appendStatus("At client.getGreetings() post-invoke", response);
+ return response;
+ }
+
+ public String getGreetingsException(String s) throws HelloWorldException {
+ StatusImpl.appendStatus("At client.getGreetingsException() pre-invoke", s);
+ try {
+ String response = helloWorldWS.getGreetingsException(s);
+ StatusImpl.appendStatus("At client.getGreetingsException() post-invoke", response);
+ return response;
+ } catch (HelloWorldException ex){
+ StatusImpl.appendStatus("At client.getGreetingsException() post-exception", ex.getMessage());
+ throw ex;
+ }
+ }
+}
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorldException.java b/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorldException.java new file mode 100644 index 0000000000..b4a9fec640 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorldException.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 helloworld;
+
+
+public class HelloWorldException extends Exception {
+
+ private static final long serialVersionUID = 4608283774062947117L;
+
+ public HelloWorldException(){
+ }
+
+ public HelloWorldException(String message){
+ super(message);
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorldService.java b/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..40c0c7618a --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,44 @@ +/*
+ * 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 helloworld;
+
+import javax.security.auth.Subject;
+
+import org.oasisopen.sca.RequestContext;
+import org.oasisopen.sca.annotation.Context;
+
+public class HelloWorldService implements HelloWorld {
+
+ @Context
+ protected RequestContext requestContext;
+
+ public String getGreetings(String s) {
+ //Subject subject = requestContext.getSecuritySubject();
+ String response = "Hello " + s;
+ StatusImpl.appendStatus("At service.getGreetings()", response);
+ return response;
+ }
+
+ public String getGreetingsException(String s) throws HelloWorldException {
+ String response = "Hello " + s;
+ StatusImpl.appendStatus("At service.getGreetingsException()", response);
+ throw new HelloWorldException(response);
+ }
+}
diff --git a/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/StatusImpl.java b/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/StatusImpl.java new file mode 100644 index 0000000000..644853d6c2 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta4-RC1/testing/itest/policy/interceptors/src/main/java/helloworld/StatusImpl.java @@ -0,0 +1,32 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+public class StatusImpl {
+
+ public static String statusString = "";
+
+ public static void appendStatus(String event, String location){
+ // remove any addresses from the strings
+ location = location.replaceAll("\\(@.*Endpoint", "Endpoint");
+ statusString += event + " - " + location + "\n";
+ }
+
+}
|