summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl')
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java108
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AlphaImpl.java69
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java72
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BetaImpl.java50
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java84
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java75
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java48
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java75
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java325
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java318
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java322
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java42
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java122
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java114
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java115
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java122
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java93
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java68
-rw-r--r--tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/GammaImpl.java66
19 files changed, 0 insertions, 2288 deletions
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java
deleted file mode 100644
index 86a96aaa75..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.AService;
-import org.apache.tuscany.sca.itest.conversational.BService;
-import org.apache.tuscany.sca.itest.conversational.Constants;
-import org.oasisopen.sca.annotation.ConversationID;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * Simple conversational Service that uses another Conversational Service
- */
-@Service(AService.class)
-@Scope("CONVERSATION")
-public class AServiceImpl implements AService {
-
- /**
- * The state
- */
- private String state = Constants.A_INITIAL_VALUE;
-
- /**
- * The reference to the other service
- */
- private BService b;
-
- /**
- * Constructor
- *
- */
- public AServiceImpl() {
- System.out.println("---> AServiceImpl constructor for " + this);
- }
-
- /**
- * Inject the reference to the other service
- * @param aB The other service.
- */
- @Reference(name = "b")
- public void setB(BService aB) {
- System.out.println("---> Setting reference to B on " + this + " to " + aB);
- this.b = aB;
- }
-
- /**
- * Returns the state for this service.
- *
- * @return The state for this service
- */
- public String getState() {
- return state;
- }
-
- /**
- * Returns the state for the other service that this service is using
- *
- * @return The state for the other service that this service is using
- */
- public String getStateOnB() {
- return b.getState();
- }
-
- /**
- * Sets the state for this service.
- *
- * @param aState The state for this service
- */
- public void setState(String aState) {
- this.state = aState;
- }
-
- /**
- * Sets the state for the other service that this service is using
- *
- * @param aState The state for the other service that this service is using
- */
- public void setStateOnB(String aState) {
- b.setState(aState);
- }
-
- /**
- * Sets the conversation ID for this service
- * @param id The Conversation ID
- */
- @ConversationID
- public void setConversationID(String id) {
- System.out.println("Conversation ID for " + this + " is set to " + id);
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AlphaImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AlphaImpl.java
deleted file mode 100644
index b56186ea88..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AlphaImpl.java
+++ /dev/null
@@ -1,69 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.Record;
-import org.apache.tuscany.sca.itest.TestResult;
-import org.apache.tuscany.sca.itest.conversational.Alpha;
-import org.apache.tuscany.sca.itest.conversational.Beta;
-import org.apache.tuscany.sca.itest.conversational.Gamma;
-import org.oasisopen.sca.CallableReference;
-import org.oasisopen.sca.ComponentContext;
-import org.oasisopen.sca.annotation.Context;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@Service(Alpha.class)
-@Scope("COMPOSITE")
-public class AlphaImpl implements Alpha {
- @Reference
- public Beta beta;
-
- @Context
- protected ComponentContext componentContext;
-
- public void run(int param) {
- CallableReference<Gamma> gammaRef = null;
- boolean testPassed = true;
- try {
- gammaRef = beta.getRef(param);
- while (gammaRef.getService().hasNext()) {
- Record record = gammaRef.getService().next();
- if (!record.conversationId.equals(gammaRef.getConversation().getConversationID())) {
- // Record returned is not from this conversation.
- testPassed = false;
- }
- }
- } catch (Exception ex) {
- testPassed = false;
- ex.printStackTrace();
- } finally {
- TestResult.updateCompleted();
- if (gammaRef != null) {
- TestResult.results.put(gammaRef.getConversation().getConversationID(), testPassed);
- gammaRef.getService().stop();
- }
- }
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java
deleted file mode 100644
index f394770ffc..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java
+++ /dev/null
@@ -1,72 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.BService;
-import org.apache.tuscany.sca.itest.conversational.Constants;
-import org.oasisopen.sca.annotation.ConversationID;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * Simple conversational Service
- */
-@Service(BService.class)
-@Scope("CONVERSATION")
-public class BServiceImpl implements BService {
-
- /**
- * The state for this service
- */
- private String state = Constants.B_INITIAL_VALUE;
-
- /**
- * Constructor
- */
- public BServiceImpl() {
- System.out.println("---> BServiceImpl constructor for " + this);
- }
-
- /**
- * Returns the state for this service.
- *
- * @return The state for this service
- */
- public String getState() {
- return state;
- }
-
- /**
- * Sets the state for this service.
- *
- * @param aState The state for this service
- */
- public void setState(String aState) {
- this.state = aState;
- }
-
- /**
- * Sets the conversation ID for this service
- * @param id The Conversation ID
- */
- @ConversationID
- public void setConversationID(String id) {
- System.out.println("Conversation ID for " + this + " is set to " + id);
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BetaImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BetaImpl.java
deleted file mode 100644
index b94e8a6452..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BetaImpl.java
+++ /dev/null
@@ -1,50 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.Beta;
-import org.apache.tuscany.sca.itest.conversational.Gamma;
-import org.oasisopen.sca.CallableReference;
-import org.oasisopen.sca.ComponentContext;
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Context;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@Service(Beta.class)
-@Scope("COMPOSITE")
-public class BetaImpl implements Beta {
- @Context
- protected ComponentContext componentContext;
-
- @Reference
- public Gamma gamma;
-
- public CallableReference<Gamma> getRef(int param) {
- ServiceReference<Gamma> gammaRef = componentContext.getServiceReference(Gamma.class, "gamma");
- Gamma g = gammaRef.getService();
- g.start(param);
- return gammaRef;
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java
deleted file mode 100644
index 737c2940dd..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java
+++ /dev/null
@@ -1,84 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.CService;
-import org.apache.tuscany.sca.itest.conversational.DService;
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * Simple conversational Service that uses another Conversational Service
- */
-@Service(CService.class)
-@Scope("CONVERSATION")
-public class CServiceImpl implements CService {
-
- private ServiceReference<DService> dServiceRef;
-
- @Reference(name = "d")
- public void setD(ServiceReference<DService> servRef) {
- this.dServiceRef = servRef;
- }
-
- public String getState() {
- return dServiceRef.getService().getState();
- }
-
- public void setState(String aState) {
- dServiceRef.getService().setState(aState);
- }
-
- /*
- * When the coversationId is set manually the client may access the
- * conversation id that will be used by the reference using
- * ServiceReference.getConversationId()
- */
- public Object getConversationID() {
- return dServiceRef.getConversationID();
- }
-
- /*
- * Whether the conversation ID is chosen by the client or is generated by
- * the system, the client may access the conversation ID by calling
- * Conversation.getConversationID().
- */
- public Object getConversationObjectConversationId() {
- // TODO Auto-generated method stub
- if (dServiceRef.getConversation() != null) {
- return dServiceRef.getConversation().getConversationID();
- } else {
- return null;
- }
- }
-
- public void endConversation() {
- dServiceRef.getConversation().end();
- }
-
- public void endConversationViaAnnotatedMethod() {
- dServiceRef.getService().endConversationViaAnnotatedMethod();
- }
-
- public void setConversationID(String theID) {
- dServiceRef.setConversationID(theID);
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java
deleted file mode 100644
index 8f2736ad2d..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationalService;
-import org.oasisopen.sca.annotation.ConversationAttributes;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-@Service(ConversationalService.class)
-@Scope("CONVERSATION")
-@ConversationAttributes(maxAge = "1 seconds")
-public class ConversationAgeComponentImpl implements ConversationalService {
-
- private int count;
-
- public void businessException() throws Exception {
- }
-
- public void businessExceptionCallback() throws Exception {
- }
-
- public void destroy() {
- }
-
- public String endConversation() {
- return null;
- }
-
- public String endConversationCallback() {
- return null;
- }
-
- public void incrementCount() {
- }
-
- public void incrementCountCallback() {
- }
-
- public void init() {
- }
-
- public void initializeCount(int count) {
- this.count = count;
- }
-
- public void initializeCountCallback(int count) {
- }
-
- public int retrieveCount() {
- return count;
- }
-
- public int retrieveCountCallback() {
- return 0;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
deleted file mode 100644
index 8b3a8663d8..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
+++ /dev/null
@@ -1,48 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationIdService;
-import org.oasisopen.sca.annotation.ConversationID;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-@Service(ConversationIdService.class)
-@Scope("CONVERSATION")
-public class ConversationIdComponentImpl implements ConversationIdService {
-
- @ConversationID
- public String cid;
-
- private String setterCid;
-
- public String getCIDField() {
- return cid;
- }
-
- public String getCIDSetter() {
- return setterCid;
- }
-
- @ConversationID
- public void setCID(String cid) {
- this.setterCid = cid;
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java
deleted file mode 100644
index ae8bee8040..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationalService;
-import org.oasisopen.sca.annotation.ConversationAttributes;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-@Service(ConversationalService.class)
-@Scope("CONVERSATION")
-@ConversationAttributes(maxIdleTime = "1 seconds")
-public class ConversationMaxIdleComponentImpl implements ConversationalService {
-
- private int count;
-
- public void businessException() throws Exception {
- }
-
- public void businessExceptionCallback() throws Exception {
- }
-
- public void destroy() {
- }
-
- public String endConversation() {
- return null;
- }
-
- public String endConversationCallback() {
- return null;
- }
-
- public void incrementCount() {
- }
-
- public void incrementCountCallback() {
- }
-
- public void init() {
- }
-
- public void initializeCount(int count) {
- this.count = count;
- }
-
- public void initializeCountCallback(int count) {
- }
-
- public int retrieveCount() {
- return count;
- }
-
- public int retrieveCountCallback() {
- return 0;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
deleted file mode 100644
index 3784dfd53e..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
+++ /dev/null
@@ -1,325 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
-import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
-import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
-import org.apache.tuscany.sca.itest.conversational.ConversationalService;
-import org.oasisopen.sca.ComponentContext;
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Context;
-import org.oasisopen.sca.annotation.ConversationAttributes;
-import org.oasisopen.sca.annotation.Destroy;
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * The client for the conversational itest which presents a stateful
- * callback interface
- *
- * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
- */
-
-@Service(interfaces = {ConversationalClient.class})
-@Scope("CONVERSATION")
-@ConversationAttributes(maxAge = "10 minutes", maxIdleTime = "5 minutes", singlePrincipal = false)
-public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
-
- @Context
- protected ComponentContext componentContext;
-
- @Reference
- protected ConversationalService conversationalService;
-
- @Reference
- protected ConversationalService conversationalService2;
-
- @Reference
- protected ConversationalReferenceClient conversationalReferenceClient;
-
- private int clientCount = 0;
- private int callbackCount = 0;
-
- // a static member variable that records the number of times this service is called
- public static StringBuffer calls = new StringBuffer();
-
- // From ConversationalClient
- public int runConversationFromInjectedReference() {
- calls.append("runConversationFromInjectedReference,");
- conversationalService.initializeCount(1);
- conversationalService.incrementCount();
- clientCount = conversationalService.retrieveCount();
- conversationalService.endConversation();
-
- return clientCount;
- }
-
- public int runConversationFromInjectedReference2() {
- calls.append("runConversationFromInjectedReference2,");
-
- conversationalService2.initializeCount(1);
- conversationalService2.incrementCount();
-
- // stick in a call to the first reference to
- // make sure the two references don't clash
- conversationalService.initializeCount(1);
-
- clientCount = conversationalService2.retrieveCount();
- conversationalService2.endConversation();
-
- // end the conversation through the first reference
- conversationalService.endConversation();
-
- return clientCount;
- }
-
- public int runConversationFromServiceReference() {
- calls.append("runConversationFromServiceReference,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- // serviceReference.getConversation().end();
-
- return clientCount;
- }
-
- public int runConversationWithUserDefinedConversationId() {
- calls.append("runConversationWithUserDefinedConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation1");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- // serviceReference.getConversation().end();
-
- return clientCount;
- }
-
- public String runConversationCheckUserDefinedConversationId() {
- calls.append("runConversationCheckUserDefinedConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation2");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
-
- String clientConversationId = serviceReference.getConversationID().toString();
- String serverConversationId = callableReference.endConversation();
-
- if (clientConversationId.equals("MyConversation2") && serverConversationId.equals("MyConversation2")) {
- return clientConversationId;
- } else {
- return "client = " + clientConversationId + "server = " + serverConversationId;
- }
-
- }
-
- public int runConversationCheckingScope() {
- calls.append("runConversationCheckingScope,");
- // run a conversation
- return runConversationFromInjectedReference();
-
- // test will then use a static method to find out how many times
- // init/destroy were called
- }
-
- public int runConversationWithCallback() {
- calls.append("runConversationWithCallback,");
- callbackCount = 2;
- conversationalService.initializeCountCallback(1);
- conversationalService.incrementCountCallback();
- clientCount = conversationalService.retrieveCountCallback();
- conversationalService.endConversationCallback();
-
- return clientCount;
- }
-
- public int runConversationHavingPassedReference() {
- calls.append("runConversationHavingPassedReference,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- conversationalReferenceClient.incrementCount(serviceReference);
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- serviceReference.getConversation().end();
-
- return clientCount;
- }
-
- public String runConversationBusinessException() {
- calls.append("runConversationbusinessException,");
- try {
- conversationalService.initializeCount(1);
- conversationalService.businessException();
- clientCount = conversationalService.retrieveCount();
- conversationalService.endConversation();
- } catch (Exception ex) {
- return ex.getMessage();
- }
-
- return "No Exception Returned";
- }
-
- public String runConversationBusinessExceptionCallback() {
- calls.append("runConversationbusinessExceptionCallback,");
- try {
- conversationalService.initializeCountCallback(1);
- conversationalService.businessExceptionCallback();
- clientCount = conversationalService.retrieveCountCallback();
- conversationalService.endConversationCallback();
- } catch (Exception ex) {
- return ex.getMessage();
- }
-
- return "No Exception Returned";
- }
-
- public int runConversationCallingEndedConversation() {
- calls.append("runConversationCallingEndedConversation,");
- conversationalService.initializeCount(1);
- conversationalService.endConversation();
- return conversationalService.retrieveCount();
- }
-
- public int runConversationCallingEndedConversationCallback() {
- calls.append("runConversationCallingEndedConversationCallback,");
- conversationalService.initializeCountCallback(1);
- conversationalService.endConversationCallback();
- return conversationalService.retrieveCountCallback();
- }
-
- public String runConversationCallingEndedConversationCheckConversationId() {
- calls.append("runConversationCallingEndedConversationCheckConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation3");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- if (serviceReference.getConversation() == null) {
- return null;
- } else {
- return serviceReference.getConversation().getConversationID().toString();
- }
- }
-
- public String runConversationCallingEndedConversationCallbackCheckConversationId() {
- calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation3");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversationCallback();
-
- if (serviceReference.getConversation() == null) {
- return null;
- } else {
- return serviceReference.getConversation().getConversationID().toString();
- }
- }
-
- public int runConversationAgeTimeout() {
- calls.append("runConversationAgeTimeout,");
- // done in other testing
- return clientCount;
- }
-
- public int runConversationIdleTimeout() {
- calls.append("runConversationIdleTimeout,");
- // done in other testing
- return clientCount;
- }
-
- public int runConversationPrincipleError() {
- calls.append("runConversationPrincipleError,");
- // TODO - when policy framework is done
- return clientCount;
- }
-
- // From ConversationalCallback
- @Init
- public void init() {
- calls.append("init,");
- }
-
- @Destroy
- public void destroy() {
- calls.append("destroy,");
- }
-
- public void initializeCount(int count) {
- calls.append("initializeCount,");
- callbackCount += count;
- }
-
- public void incrementCount() {
- calls.append("incrementCount,");
- callbackCount++;
- }
-
- public int retrieveCount() {
- calls.append("retrieveCount,");
- return callbackCount;
- }
-
- public void businessException() throws Exception {
- throw new Exception("Business Exception");
- }
-
- public String endConversation() {
- calls.append("endConversation,");
- callbackCount = 0;
- return null;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java
deleted file mode 100644
index 5823b7d050..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java
+++ /dev/null
@@ -1,318 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
-import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
-import org.apache.tuscany.sca.itest.conversational.ConversationalService;
-import org.apache.tuscany.sca.itest.conversational.ConversationalServiceNonConversationalCallback;
-import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
-import org.oasisopen.sca.ComponentContext;
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Context;
-import org.oasisopen.sca.annotation.ConversationAttributes;
-import org.oasisopen.sca.annotation.Destroy;
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * The client for the conversational itest which presents a stateful
- * callback interface
- *
- * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
- */
-
-@Service(interfaces = {ConversationalClient.class})
-@Scope("CONVERSATION")
-@ConversationAttributes(maxAge = "10 minutes", maxIdleTime = "5 minutes", singlePrincipal = false)
-public class ConversationalClientStatefulNonConversationalCallbackImpl implements ConversationalClient,
- NonConversationalCallback {
-
- @Context
- protected ComponentContext componentContext;
-
- @Reference
- protected ConversationalServiceNonConversationalCallback conversationalService;
-
- @Reference
- protected ConversationalServiceNonConversationalCallback conversationalService2;
-
- @Reference
- protected ConversationalReferenceClient conversationalReferenceClient;
-
- private int clientCount = 0;
- private int callbackCount = 0;
-
- // a static member variable that records the number of times this service is called
- public static StringBuffer calls = new StringBuffer();
-
- // From ConversationalClient
- public int runConversationFromInjectedReference() {
- calls.append("runConversationFromInjectedReference,");
- conversationalService.initializeCount(1);
- conversationalService.incrementCount();
- clientCount = conversationalService.retrieveCount();
- conversationalService.endConversation();
-
- return clientCount;
- }
-
- public int runConversationFromInjectedReference2() {
- calls.append("runConversationFromInjectedReference2,");
-
- conversationalService2.initializeCount(1);
- conversationalService2.incrementCount();
-
- // stick in a call to the first reference to
- // make sure the two references don't clash
- conversationalService.initializeCount(1);
-
- clientCount = conversationalService2.retrieveCount();
- conversationalService2.endConversation();
-
- // end the conversation through the first reference
- conversationalService.endConversation();
-
- return clientCount;
- }
-
- public int runConversationFromServiceReference() {
- calls.append("runConversationFromServiceReference,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- // serviceReference.getConversation().end();
-
- return clientCount;
- }
-
- public int runConversationWithUserDefinedConversationId() {
- calls.append("runConversationWithUserDefinedConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation1");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- // serviceReference.getConversation().end();
-
- return clientCount;
- }
-
- public String runConversationCheckUserDefinedConversationId() {
- calls.append("runConversationCheckUserDefinedConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation2");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- return callableReference.endConversation();
-
- }
-
- public int runConversationCheckingScope() {
- calls.append("runConversationCheckingScope,");
- // run a conversation
- return runConversationFromInjectedReference();
-
- // test will then use a static method to find out how many times
- // init/destroy were called
- }
-
- public int runConversationWithCallback() {
- calls.append("runConversationWithCallback,");
- callbackCount = 2;
- conversationalService.initializeCountCallback(1);
- conversationalService.incrementCountCallback();
- clientCount = conversationalService.retrieveCountCallback();
- conversationalService.endConversationCallback();
-
- return clientCount;
- }
-
- public int runConversationHavingPassedReference() {
- calls.append("runConversationHavingPassedReference,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- conversationalReferenceClient.incrementCount(serviceReference);
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- // serviceReference.getConversation().end();
-
- return clientCount;
- }
-
- public String runConversationBusinessException() {
- calls.append("runConversationbusinessException,");
- try {
- conversationalService.initializeCount(1);
- conversationalService.businessException();
- clientCount = conversationalService.retrieveCount();
- conversationalService.endConversation();
- } catch (Exception ex) {
- return ex.getMessage();
- }
-
- return "No Exception Returned";
- }
-
- public String runConversationBusinessExceptionCallback() {
- calls.append("runConversationbusinessExceptionCallback,");
- try {
- conversationalService.initializeCountCallback(1);
- conversationalService.businessExceptionCallback();
- clientCount = conversationalService.retrieveCountCallback();
- conversationalService.endConversationCallback();
- } catch (Exception ex) {
- return ex.getMessage();
- }
-
- return "No Exception Returned";
- }
-
- public String runConversationCallingEndedConversationCheckConversationId() {
- calls.append("runConversationCallingEndedConversationCheckConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation3");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- if (serviceReference.getConversation() == null) {
- return null;
- } else {
- return serviceReference.getConversation().getConversationID().toString();
- }
- }
-
- public String runConversationCallingEndedConversationCallbackCheckConversationId() {
- calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation3");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversationCallback();
-
- if (serviceReference.getConversation() == null) {
- return null;
- } else {
- return serviceReference.getConversation().getConversationID().toString();
- }
- }
-
- public int runConversationCallingEndedConversation() {
- calls.append("runConversationCallingEndedConversation,");
- conversationalService.initializeCount(1);
- conversationalService.endConversation();
- return conversationalService.retrieveCount();
- }
-
- public int runConversationCallingEndedConversationCallback() {
- calls.append("runConversationCallingEndedConversationCallback,");
- conversationalService.initializeCountCallback(1);
- conversationalService.endConversationCallback();
- return conversationalService.retrieveCountCallback();
- }
-
- public int runConversationAgeTimeout() {
- calls.append("runConversationAgeTimeout,");
- // done in other testing
- return clientCount;
- }
-
- public int runConversationIdleTimeout() {
- calls.append("runConversationIdleTimeout,");
- // done in other testing
- return clientCount;
- }
-
- public int runConversationPrincipleError() {
- calls.append("runConversationPrincipleError,");
- // TODO - when policy framework is done
- return clientCount;
- }
-
- // From ConversationalCallback
- @Init
- public void init() {
- calls.append("init,");
- }
-
- @Destroy
- public void destroy() {
- calls.append("destroy,");
- }
-
- public void initializeCount(int count) {
- calls.append("initializeCount,");
- callbackCount += count;
- }
-
- public void incrementCount() {
- calls.append("incrementCount,");
- callbackCount++;
- }
-
- public int retrieveCount() {
- calls.append("retrieveCount,");
- return callbackCount;
- }
-
- public void businessException() throws Exception {
- throw new Exception("Business Exception");
- }
-
- public String endConversation() {
- calls.append("endConversation,");
- return null;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
deleted file mode 100644
index c9c5138515..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
+++ /dev/null
@@ -1,322 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
-import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
-import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
-import org.apache.tuscany.sca.itest.conversational.ConversationalService;
-import org.oasisopen.sca.ComponentContext;
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Context;
-import org.oasisopen.sca.annotation.Destroy;
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * The client for the conversational itest which presents a stateful
- * callback interface
- *
- * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
- */
-
-@Service(interfaces = {ConversationalClient.class})
-public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
-
- @Context
- protected ComponentContext componentContext;
-
- @Reference
- protected ConversationalService conversationalService;
-
- @Reference
- protected ConversationalService conversationalService2;
-
- @Reference
- protected ConversationalReferenceClient conversationalReferenceClient;
-
- private int clientCount = 0;
- private int callbackCount = 0;
-
- // a static member variable that records the number of times this service is called
- public static StringBuffer calls = new StringBuffer();
-
- // From ConversationalClient
- public int runConversationFromInjectedReference() {
- calls.append("runConversationFromInjectedReference,");
- conversationalService.initializeCount(1);
- conversationalService.incrementCount();
- clientCount = conversationalService.retrieveCount();
- conversationalService.endConversation();
-
- return clientCount;
- }
-
- public int runConversationFromInjectedReference2() {
- calls.append("runConversationFromInjectedReference2,");
-
- // now test the second reference
- conversationalService2.initializeCount(1);
- conversationalService2.incrementCount();
-
- // stick in a call to the first reference to
- // make sure the two references don't clash
- conversationalService.initializeCount(1);
-
- clientCount = conversationalService2.retrieveCount();
- conversationalService2.endConversation();
-
- // end the conversation through the first reference
- conversationalService.endConversation();
-
- return clientCount;
- }
-
- public int runConversationFromServiceReference() {
- calls.append("runConversationFromServiceReference,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- // serviceReference.getConversation().end();
-
- return clientCount;
- }
-
- public int runConversationWithUserDefinedConversationId() {
- calls.append("runConversationWithUserDefinedConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation1");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- // serviceReference.getConversation().end();
-
- return clientCount;
- }
-
- public String runConversationCheckUserDefinedConversationId() {
- calls.append("runConversationCheckUserDefinedConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation2");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
-
- String clientConversationId = serviceReference.getConversationID().toString();
- String serverConfersationId = callableReference.endConversation();
-
- if (clientConversationId.equals("MyConversation2") && serverConfersationId.equals("MyConversation2")) {
- return clientConversationId;
- } else {
- return "client = " + clientConversationId + "server = " + serverConfersationId;
- }
- }
-
- public int runConversationCheckingScope() {
- calls.append("runConversationCheckingScope,");
- // run a conversation
- return runConversationFromInjectedReference();
-
- // test will then use a static method to find out how many times
- // init/destroy were called
- }
-
- public int runConversationWithCallback() {
- calls.append("runConversationWithCallback,");
- conversationalService.initializeCountCallback(1);
- conversationalService.incrementCountCallback();
- clientCount = conversationalService.retrieveCountCallback();
- conversationalService.endConversationCallback();
-
- return clientCount;
- }
-
- public int runConversationHavingPassedReference() {
- calls.append("runConversationHavingPassedReference,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- conversationalReferenceClient.incrementCount(serviceReference);
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- serviceReference.getConversation().end();
-
- return clientCount;
- }
-
- public String runConversationBusinessException() {
- calls.append("runConversationbusinessException,");
- try {
- conversationalService.initializeCount(1);
- conversationalService.businessException();
- clientCount = conversationalService.retrieveCount();
- conversationalService.endConversation();
- } catch (Exception ex) {
- return ex.getMessage();
- }
-
- return "No Exception Returned";
- }
-
- public String runConversationBusinessExceptionCallback() {
- calls.append("runConversationbusinessExceptionCallback,");
- try {
- conversationalService.initializeCountCallback(1);
- conversationalService.businessExceptionCallback();
- clientCount = conversationalService.retrieveCountCallback();
- conversationalService.endConversationCallback();
- } catch (Exception ex) {
- return ex.getMessage();
- }
-
- return "No Exception Returned";
- }
-
- public int runConversationCallingEndedConversation() {
- calls.append("runConversationCallingEndedConversation,");
- conversationalService.initializeCount(1);
- conversationalService.endConversation();
- return conversationalService.retrieveCount();
- }
-
- public int runConversationCallingEndedConversationCallback() {
- calls.append("runConversationCallingEndedConversationCallback,");
- conversationalService.initializeCountCallback(1);
- conversationalService.endConversationCallback();
- return conversationalService.retrieveCountCallback();
- }
-
- public String runConversationCallingEndedConversationCheckConversationId() {
- calls.append("runConversationCallingEndedConversationCheckConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation3");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversation();
-
- if (serviceReference.getConversation() == null) {
- return null;
- } else {
- return serviceReference.getConversation().getConversationID().toString();
- }
- }
-
- public String runConversationCallingEndedConversationCallbackCheckConversationId() {
- calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
- ServiceReference<ConversationalService> serviceReference =
- componentContext.getServiceReference(ConversationalService.class, "conversationalService");
- serviceReference.setConversationID("MyConversation3");
-
- ConversationalService callableReference = serviceReference.getService();
-
- callableReference.initializeCount(1);
- callableReference.incrementCount();
- clientCount = callableReference.retrieveCount();
- callableReference.endConversationCallback();
-
- if (serviceReference.getConversation() == null) {
- return null;
- } else {
- return serviceReference.getConversation().getConversationID().toString();
- }
- }
-
- public int runConversationAgeTimeout() {
- calls.append("runConversationAgeTimeout,");
- // done in other testing
- return clientCount;
- }
-
- public int runConversationIdleTimeout() {
- calls.append("runConversationIdleTimeout,");
- // done in other testing
- return clientCount;
- }
-
- public int runConversationPrincipleError() {
- calls.append("runConversationPrincipleError,");
- // TODO - when policy framework is done
- return clientCount;
- }
-
- // From ConversationalCallback
- @Init
- public void init() {
- calls.append("init,");
-
- }
-
- @Destroy
- public void destroy() {
- calls.append("destroy,");
-
- }
-
- public void initializeCount(int count) {
- calls.append("initializeCount,");
- callbackCount = 0;
- }
-
- public void incrementCount() {
- calls.append("incrementCount,");
- callbackCount++;
- }
-
- public int retrieveCount() {
- calls.append("retrieveCount,");
- return callbackCount;
- }
-
- public void businessException() throws Exception {
- throw new Exception("Business Exception");
- }
-
- public String endConversation() {
- calls.append("endConversation,");
- callbackCount = 0;
- return null;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java
deleted file mode 100644
index 134ffda75d..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
-import org.apache.tuscany.sca.itest.conversational.ConversationalService;
-import org.oasisopen.sca.CallableReference;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * A client component that accepts a reference to an ongoing conversation
- * and takes part in that conversation
- *
- * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
- */
-
-@Service(interfaces = {ConversationalReferenceClient.class})
-public class ConversationalReferenceClientImpl implements ConversationalReferenceClient {
-
- public void incrementCount(CallableReference<ConversationalService> conversationalService) {
- ConversationalService callableReference = conversationalService.getService();
-
- callableReference.incrementCount();
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java
deleted file mode 100644
index 73a6d7d27e..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java
+++ /dev/null
@@ -1,122 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import java.util.HashMap;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
-import org.apache.tuscany.sca.itest.conversational.ConversationalService;
-import org.oasisopen.sca.annotation.Callback;
-import org.oasisopen.sca.annotation.ConversationID;
-import org.oasisopen.sca.annotation.Destroy;
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * The service used when testing stateful conversations
- *
- * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
- */
-@Service(ConversationalService.class)
-@Scope("REQUEST")
-public class ConversationalServiceRequestImpl implements ConversationalService {
-
- @ConversationID
- protected String conversationId;
-
- @Callback
- protected ConversationalCallback conversationalCallback;
-
- // static area in which to hold conversational data
- private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
-
- // a static member variable that records the number of times this service is called
- public static StringBuffer calls = new StringBuffer();
-
- @Init
- public void init() {
- calls.append("init,");
- }
-
- @Destroy
- public void destroy() {
- calls.append("destroy,");
- }
-
- public void initializeCount(int count) {
- calls.append("initializeCount,");
- Integer conversationalCount = Integer.valueOf(count);
- conversationalState.put(conversationId, conversationalCount);
- }
-
- public void incrementCount() {
- calls.append("incrementCount,");
- Integer conversationalCount = conversationalState.get(conversationId);
- conversationalCount++;
- conversationalState.put(conversationId, conversationalCount);
- }
-
- public int retrieveCount() {
- calls.append("retrieveCount,");
- Integer count = conversationalState.get(conversationId);
- if (count != null) {
- return count.intValue();
- } else {
- return -999;
- }
- }
-
- public void businessException() throws Exception {
- throw new Exception("Business Exception");
- }
-
- public void initializeCountCallback(int count) {
- calls.append("initializeCountCallback,");
- initializeCount(count);
- conversationalCallback.initializeCount(count);
- }
-
- public void incrementCountCallback() {
- calls.append("incrementCountCallback,");
- incrementCount();
- conversationalCallback.incrementCount();
- }
-
- public int retrieveCountCallback() {
- calls.append("retrieveCountCallback,");
- return conversationalCallback.retrieveCount();
- }
-
- public void businessExceptionCallback() throws Exception {
- calls.append("businessExceptionCallback,");
- conversationalCallback.businessException();
- }
-
- public String endConversation() {
- calls.append("endConversation,");
- conversationalState.remove(conversationId);
- return conversationId;
- }
-
- public String endConversationCallback() {
- calls.append("endConversationCallback,");
- return conversationalCallback.endConversation();
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java
deleted file mode 100644
index 5bafa5e075..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java
+++ /dev/null
@@ -1,114 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
-import org.apache.tuscany.sca.itest.conversational.ConversationalService;
-import org.oasisopen.sca.annotation.Callback;
-import org.oasisopen.sca.annotation.ConversationAttributes;
-import org.oasisopen.sca.annotation.ConversationID;
-import org.oasisopen.sca.annotation.Destroy;
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * The service used when testing stateful conversations
- *
- * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
- */
-@Service(ConversationalService.class)
-@Scope("CONVERSATION")
-@ConversationAttributes(maxAge = "10 minutes", maxIdleTime = "5 minutes", singlePrincipal = false)
-public class ConversationalServiceStatefulImpl implements ConversationalService {
-
- @ConversationID
- protected String conversationId;
-
- @Callback
- protected ConversationalCallback conversationalCallback;
-
- // local count - accumulates during the conversation
- private int count = 0;
-
- // a static member variable that records the number of times this service is called
- public static StringBuffer calls = new StringBuffer();
-
- @Init
- public void init() {
- calls.append("init,");
- }
-
- @Destroy
- public void destroy() {
- calls.append("destroy,");
- }
-
- public void initializeCount(int count) {
- calls.append("initializeCount,");
- this.count = count;
- }
-
- public void incrementCount() {
- calls.append("incrementCount,");
- count++;
- }
-
- public int retrieveCount() {
- calls.append("retrieveCount,");
- return count;
- }
-
- public void businessException() throws Exception {
- throw new Exception("Business Exception");
- }
-
- public void initializeCountCallback(int count) {
- calls.append("initializeCountCallback,");
- this.count = count;
- conversationalCallback.initializeCount(count);
- }
-
- public void incrementCountCallback() {
- calls.append("incrementCountCallback,");
- count++;
- conversationalCallback.incrementCount();
- }
-
- public int retrieveCountCallback() {
- calls.append("retrieveCountCallback,");
- return conversationalCallback.retrieveCount();
- }
-
- public void businessExceptionCallback() throws Exception {
- calls.append("businessExceptionCallback,");
- conversationalCallback.businessException();
- }
-
- public String endConversation() {
- calls.append("endConversation,");
- count = 0;
- return conversationId;
- }
-
- public String endConversationCallback() {
- calls.append("endConversationCallback,");
- return conversationalCallback.endConversation();
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java
deleted file mode 100644
index 8d63ebbbef..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java
+++ /dev/null
@@ -1,115 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationalServiceNonConversationalCallback;
-import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
-import org.oasisopen.sca.annotation.Callback;
-import org.oasisopen.sca.annotation.ConversationAttributes;
-import org.oasisopen.sca.annotation.ConversationID;
-import org.oasisopen.sca.annotation.Destroy;
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * The service used when testing stateful conversations
- *
- * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
- */
-@Service(ConversationalServiceNonConversationalCallback.class)
-@Scope("CONVERSATION")
-@ConversationAttributes(maxAge = "10 minutes", maxIdleTime = "5 minutes", singlePrincipal = false)
-public class ConversationalServiceStatefulNonConversationalCallbackImpl implements
- ConversationalServiceNonConversationalCallback {
-
- @ConversationID
- protected String conversationId;
-
- @Callback
- protected NonConversationalCallback nonConversationalCallback;
-
- // local count - accumulates during the conversation
- private int count = 0;
-
- // a static member variable that records the number of times this service is called
- public static StringBuffer calls = new StringBuffer();
-
- @Init
- public void init() {
- calls.append("init,");
- }
-
- @Destroy
- public void destroy() {
- calls.append("destroy,");
- }
-
- public void initializeCount(int count) {
- calls.append("initializeCount,");
- this.count = count;
- }
-
- public void incrementCount() {
- calls.append("incrementCount,");
- count++;
- }
-
- public int retrieveCount() {
- calls.append("retrieveCount,");
- return count;
- }
-
- public void businessException() throws Exception {
- throw new Exception("Business Exception");
- }
-
- public void initializeCountCallback(int count) {
- calls.append("initializeCountCallback,");
- this.count = count;
- nonConversationalCallback.initializeCount(count);
- }
-
- public void incrementCountCallback() {
- calls.append("incrementCountCallback,");
- count++;
- nonConversationalCallback.incrementCount();
- }
-
- public int retrieveCountCallback() {
- calls.append("retrieveCountCallback,");
- return nonConversationalCallback.retrieveCount();
- }
-
- public void businessExceptionCallback() throws Exception {
- calls.append("businessExceptionCallback,");
- nonConversationalCallback.businessException();
- }
-
- public String endConversation() {
- calls.append("endConversation,");
- count = 0;
- return conversationId;
- }
-
- public String endConversationCallback() {
- calls.append("endConversationCallback,");
- return nonConversationalCallback.endConversation();
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java
deleted file mode 100644
index ecf108c656..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java
+++ /dev/null
@@ -1,122 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import java.util.HashMap;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
-import org.apache.tuscany.sca.itest.conversational.ConversationalService;
-import org.oasisopen.sca.annotation.Callback;
-import org.oasisopen.sca.annotation.ConversationID;
-import org.oasisopen.sca.annotation.Destroy;
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * The service used when testing stateful conversations
- *
- * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
- */
-@Service(ConversationalService.class)
-@Scope("STATELESS")
-public class ConversationalServiceStatelessImpl implements ConversationalService {
-
- @ConversationID
- protected String conversationId;
-
- @Callback
- protected ConversationalCallback conversationalCallback;
-
- // static area in which to hold conversational data
- private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
-
- // a static member variable that records the number of times this service is called
- public static StringBuffer calls = new StringBuffer();
-
- @Init
- public void init() {
- calls.append("init,");
- }
-
- @Destroy
- public void destroy() {
- calls.append("destroy,");
- }
-
- public void initializeCount(int count) {
- calls.append("initializeCount,");
- Integer conversationalCount = Integer.valueOf(count);
- conversationalState.put(conversationId, conversationalCount);
- }
-
- public void incrementCount() {
- calls.append("incrementCount,");
- Integer conversationalCount = conversationalState.get(conversationId);
- conversationalCount++;
- conversationalState.put(conversationId, conversationalCount);
- }
-
- public int retrieveCount() {
- calls.append("retrieveCount,");
- Integer count = conversationalState.get(conversationId);
- if (count != null) {
- return count.intValue();
- } else {
- return -999;
- }
- }
-
- public void businessException() throws Exception {
- throw new Exception("Business Exception");
- }
-
- public void initializeCountCallback(int count) {
- calls.append("initializeCountCallback,");
- initializeCount(count);
- conversationalCallback.initializeCount(count);
- }
-
- public void incrementCountCallback() {
- calls.append("incrementCountCallback,");
- incrementCount();
- conversationalCallback.incrementCount();
- }
-
- public int retrieveCountCallback() {
- calls.append("retrieveCountCallback,");
- return conversationalCallback.retrieveCount();
- }
-
- public void businessExceptionCallback() throws Exception {
- calls.append("businessExceptionCallback,");
- conversationalCallback.businessException();
- }
-
- public String endConversation() {
- calls.append("endConversation,");
- conversationalState.remove(conversationId);
- return conversationId;
- }
-
- public String endConversationCallback() {
- calls.append("endConversationCallback,");
- return conversationalCallback.endConversation();
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java
deleted file mode 100644
index ee09e99f1b..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java
+++ /dev/null
@@ -1,93 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.itest.conversational.ConversationalService;
-import org.oasisopen.sca.annotation.ConversationID;
-import org.oasisopen.sca.annotation.Service;
-
-@Service(ConversationalService.class)
-public class ConversationalServiceStatelessScopeImpl implements ConversationalService {
-
- @ConversationID
- protected String cid;
-
- static Map<String, Integer> state = new HashMap<String, Integer>();
-
- public void destroy() {
- // TODO Auto-generated method stub
-
- }
-
- public String endConversation() {
- state.remove(cid);
- return cid;
- }
-
- public String endConversationCallback() {
- // TODO Auto-generated method stub
- return null;
-
- }
-
- public void incrementCount() {
- state.put(cid, Integer.valueOf(state.get(cid) + 1));
- }
-
- public void businessException() throws Exception {
- throw new Exception("Business Exception");
- }
-
- public void incrementCountCallback() {
- // TODO Auto-generated method stub
-
- }
-
- public void init() {
- // TODO Auto-generated method stub
-
- }
-
- public void initializeCount(int count) {
- state.put(cid, Integer.valueOf(count));
- }
-
- public void initializeCountCallback(int count) {
- // TODO Auto-generated method stub
-
- }
-
- public void businessExceptionCallback() throws Exception {
- throw new Exception("Business Exception");
- }
-
- public int retrieveCount() {
- return state.get(cid);
- }
-
- public int retrieveCountCallback() {
- // TODO Auto-generated method stub
- return 0;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java
deleted file mode 100644
index ad0c1fb7da..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import org.apache.tuscany.sca.itest.conversational.DService;
-import org.oasisopen.sca.annotation.ConversationID;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * Simple conversational Service
- */
-@Service(DService.class)
-@Scope("CONVERSATION")
-public class DServiceImpl implements DService {
-
- /**
- * The state for this service
- */
- private String state = "Initial state value";
-
- /**
- * Returns the state for this service.
- *
- * @return The state for this service
- */
- public String getState() {
- return state;
- }
-
- /**
- * Sets the state for this service.
- *
- * @param aState The state for this service
- */
- public void setState(String aState) {
- this.state = aState;
- }
-
- /**
- * Sets the conversation ID for this service
- * @param id The Conversation ID
- */
- @ConversationID
- public void setConversationID(String id) {
- System.out.println("Setting conversation ID at service = " + id);
- }
-
- public void endConversationViaAnnotatedMethod() {
- System.out.println("Annotated Ends Conversation");
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/GammaImpl.java b/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/GammaImpl.java
deleted file mode 100644
index 55390189cf..0000000000
--- a/tags/java/sca/2.0-M3-RC4/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/GammaImpl.java
+++ /dev/null
@@ -1,66 +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 org.apache.tuscany.sca.itest.conversational.impl;
-
-import java.util.ArrayList;
-
-import org.apache.tuscany.sca.itest.Record;
-import org.apache.tuscany.sca.itest.conversational.Gamma;
-import org.oasisopen.sca.annotation.ConversationID;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.Service;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@Service(Gamma.class)
-@Scope("CONVERSATION")
-public class GammaImpl implements Gamma {
- @ConversationID
- public String conversationId;
-
- private ArrayList<Record> list;
-
- public void start(int param) {
- list = new ArrayList<Record>();
- fillList(param, conversationId);
- }
-
- public boolean hasNext() {
- return !list.isEmpty();
- }
-
- public Record next() {
- return list.remove(0);
- }
-
- public void stop() {
- list = null;
- }
-
- private void fillList(int param, String cid) {
- for (int i = 0; i < param; i++) {
- Record record = new Record();
- record.id = "id_" + i;
- record.conversationId = cid;
- list.add(record);
- }
- }
-}