From 3caf8614f25d6b1962e20331fdf423c863bc02f3 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:13:31 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835144 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/osoa/sca/CallableReference.java | 65 ++++++++++++ .../main/java/org/osoa/sca/ComponentContext.java | 109 +++++++++++++++++++++ .../main/java/org/osoa/sca/CompositeContext.java | 95 ++++++++++++++++++ .../src/main/java/org/osoa/sca/Constants.java | 34 +++++++ .../src/main/java/org/osoa/sca/Conversation.java | 41 ++++++++ .../org/osoa/sca/ConversationEndedException.java | 67 +++++++++++++ .../java/org/osoa/sca/CurrentCompositeContext.java | 52 ++++++++++ .../osoa/sca/NoRegisteredCallbackException.java | 68 +++++++++++++ .../src/main/java/org/osoa/sca/RequestContext.java | 66 +++++++++++++ .../main/java/org/osoa/sca/ServiceReference.java | 65 ++++++++++++ .../java/org/osoa/sca/ServiceRuntimeException.java | 69 +++++++++++++ .../org/osoa/sca/ServiceUnavailableException.java | 65 ++++++++++++ .../sca/annotations/AllowsPassByReference.java | 38 +++++++ .../org/osoa/sca/annotations/Authentication.java | 69 +++++++++++++ .../java/org/osoa/sca/annotations/Callback.java | 49 +++++++++ .../org/osoa/sca/annotations/ComponentName.java | 35 +++++++ .../org/osoa/sca/annotations/Confidentiality.java | 69 +++++++++++++ .../java/org/osoa/sca/annotations/Constructor.java | 35 +++++++ .../java/org/osoa/sca/annotations/Context.java | 38 +++++++ .../sca/annotations/ConversationAttributes.java | 56 +++++++++++ .../org/osoa/sca/annotations/ConversationID.java | 35 +++++++ .../org/osoa/sca/annotations/Conversational.java | 37 +++++++ .../java/org/osoa/sca/annotations/Destroy.java | 35 +++++++ .../java/org/osoa/sca/annotations/EagerInit.java | 35 +++++++ .../org/osoa/sca/annotations/EndsConversation.java | 34 +++++++ .../main/java/org/osoa/sca/annotations/Init.java | 36 +++++++ .../java/org/osoa/sca/annotations/Integrity.java | 69 +++++++++++++ .../main/java/org/osoa/sca/annotations/Intent.java | 58 +++++++++++ .../main/java/org/osoa/sca/annotations/OneWay.java | 35 +++++++ .../java/org/osoa/sca/annotations/PolicySets.java | 45 +++++++++ .../java/org/osoa/sca/annotations/Property.java | 56 +++++++++++ .../java/org/osoa/sca/annotations/Qualifier.java | 35 +++++++ .../java/org/osoa/sca/annotations/Reference.java | 50 ++++++++++ .../java/org/osoa/sca/annotations/Remotable.java | 36 +++++++ .../java/org/osoa/sca/annotations/Requires.java | 56 +++++++++++ .../main/java/org/osoa/sca/annotations/Scope.java | 48 +++++++++ .../java/org/osoa/sca/annotations/Service.java | 47 +++++++++ 37 files changed, 1932 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CompositeContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Constants.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Conversation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ConversationEndedException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CurrentCompositeContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceRuntimeException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceUnavailableException.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Authentication.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Callback.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ComponentName.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Confidentiality.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Constructor.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Context.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationID.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Conversational.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Destroy.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EagerInit.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EndsConversation.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Init.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Integrity.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Intent.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/OneWay.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/PolicySets.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Property.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Qualifier.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Reference.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Remotable.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Requires.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Scope.java create mode 100644 sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Service.java (limited to 'sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org') diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java new file mode 100644 index 0000000000..c32d229a76 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java @@ -0,0 +1,65 @@ +/* + * 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.osoa.sca; + +/** + * Common superclass for references that can be passed between components. + * + * @version $Rev$ $Date$ + * @param the Java interface associated with this reference + */ +public interface CallableReference { + /** + * Returns a type-safe reference to the target of this reference. + * The instance returned is guaranteed to implement the business interface for this reference + * but may not be a proxy as defined by java.lang.reflect.Proxy. + * + * @return a proxy to the target that implements the business interface associated with this reference + */ + B getService(); + + /** + * Returns the Java class for the business interface associated with this reference. + * + * @return the Class for the business interface associated with this reference + */ + Class getBusinessInterface(); + + /** + * Returns true if this reference is conversational. + * + * @return true if this reference is conversational + */ + boolean isConversational(); + + /** + * Returns the conversation associated with this reference. + * Returns null if no conversation is currently active. + * + * @return the conversation associated with this reference; may be null + */ + Conversation getConversation(); + + /** + * Returns the callback ID. + * + * @return the callback ID + */ + Object getCallbackID(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java new file mode 100644 index 0000000000..616d4c6338 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java @@ -0,0 +1,109 @@ +/* + * 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.osoa.sca; + +/** + * Interface providing programmatic access to a component's SCA context as an alternative to injection. + * It provides access to reference and property values for the component and provides a mechanism for + * obtaining a reference to a service that can be passed to other components. + *

+ * SCA components obtain an instance of this interface through injection. Non-SCA client code may also + * obtain an instance through runtime-specific mechanisms. + * + * @version $Rev$ $Date$ + */ +public interface ComponentContext { + /** + * Returns the absolute URI of the component within the SCA Domain. + * + * @return the absolute URI of the component + */ + String getURI(); + + /** + * Cast a type-safe reference to a CallableReference. + * Converts a type-safe reference to an equivalent CallableReference; if the target refers to a service + * then a ServiceReference will be returned, if the target refers to a callback then a CallableReference + * will be returned. + * + * @param target a reference proxy provided by the SCA runtime + * @param the Java type of the business interface for the reference + * @param the type of reference to be returned + * @return a CallableReference equivalent for the proxy + * @throws IllegalArgumentException if the supplied instance is not a reference supplied by the SCA runtime + */ + > R cast(B target) throws IllegalArgumentException; + + /** + * Returns a proxy for a reference defined by this component. + * + * @param businessInterface the interface that will be used to invoke the service + * @param referenceName the name of the reference + * @param the Java type of the business interface for the reference + * @return an object that implements the business interface + */ + B getService(Class businessInterface, String referenceName); + + /** + * Returns a ServiceReference for a reference defined by this component. + * + * @param businessInterface the interface that will be used to invoke the service + * @param referenceName the name of the reference + * @param the Java type of the business interface for the reference + * @return a ServiceReference for the designated reference + */ + ServiceReference getServiceReference(Class businessInterface, String referenceName); + + /** + * Returns the value of an SCA property defined by this component. + * + * @param type the Java type to be returned for the property + * @param propertyName the name of the property whose value should be returned + * @param the Java type of the property + * @return the property value + */ + B getProperty(Class type, String propertyName); + + /** + * Returns a ServiceReference that can be used to invoke this component over the default service. + * + * @param businessInterface the interface that will be used to invoke the service + * @param the Java type of the business interface for the reference + * @return a ServiceReference that will invoke this component + */ + ServiceReference createSelfReference(Class businessInterface); + + /** + * Returns a ServiceReference that can be used to invoke this component over the designated service. + * + * @param businessInterface the interface that will be used to invoke the service + * @param serviceName the name of the service to invoke + * @param the Java type of the business interface for the reference + * @return a ServiceReference that will invoke this component + */ + ServiceReference createSelfReference(Class businessInterface, String serviceName); + + /** + * Returns the context for the current SCA service request, or null if there is no current request + * or if the context is unavailable. + * + * @return the SCA request context; may be null + */ + RequestContext getRequestContext(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CompositeContext.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CompositeContext.java new file mode 100644 index 0000000000..fcca132e0e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CompositeContext.java @@ -0,0 +1,95 @@ +/* + * 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.osoa.sca; + + +/** + * @deprecated + * + * Interface used by SCA Components to access their context + * + * @version $Rev$ $Date$ + */ +public interface CompositeContext { + + /** + * Returns the name of the parent composite. + * + * @return the name of the module + */ + String getName(); + + /** + * Returns the absolute URI of the composite component. + * + * @return the absolute URI of the module component + */ + String getURI(); + + /** + * Returns the request context that corresponds to the last remotable service invocation. If this is + * invoked from outside an SCA component then null is returned. + * + * @return the current request context + */ + RequestContext getRequestContext(); + + /** + * Returns an object implementing the interface defined for the named service. + * + * @param serviceName the name of another service in the current module + * @return an object that implements the service's interface + */ + T locateService(Class serviceType, String serviceName); + + /** + * Create a reference to the supplied component. The component must define only one service. + * + * @param self the component to be referenced + * @return a reference to the component + */ + ServiceReference createServiceReferenceForSession(Object self); + + /** + * Create a reference to the named service implemented by the supplied component. + * + * @param self the component to be referenced + * @param serviceName the service to be referenced + * @return a reference to the service + */ + ServiceReference createServiceReferenceForSession(Object self, String serviceName); + + /** + * Create a new session for stateful interaction with the named service. + * + * @param serviceName the name of the service to interact with + * @return a reference to the service + */ + ServiceReference newSession(String serviceName); + + /** + * Create a new session for stateful interaction with the named service using an application-supplied + * session identifier. + * + * @param serviceName the name of the service to interact with + * @param sessionId a token that identifies this session + * @return a reference to the service + */ + ServiceReference newSession(String serviceName, Object sessionId); +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Constants.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Constants.java new file mode 100644 index 0000000000..b1b2af8048 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Constants.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 org.osoa.sca; + +/** + * @version $Rev$ $Date$ + */ +public interface Constants { + /** + * Namespace for intents. + */ + String SCA_NS = "http://www.osoa.org/xmlns/sca/1.0"; + + /** + * Prefix form of the namespace that can be prepended to intent declarations. + */ + String SCA_PREFIX = '{' + SCA_NS + '}'; +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Conversation.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Conversation.java new file mode 100644 index 0000000000..64423a4aa2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Conversation.java @@ -0,0 +1,41 @@ +/* + * 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.osoa.sca; + +/** + * Interface representing a Conversation providing access to the conversation id and and a mechanism + * to terminate the conversation. + * + * @version $Rev$ $Date$ + */ +public interface Conversation { + /** + * Returns the identifier for this conversation. + * If a user-defined identity had been supplied for this reference then its value will be returned; + * otherwise the identity generated by the system when the conversation was initiated will be returned. + * + * @return the identifier for this conversation + */ + Object getConversationID(); + + /** + * End this conversation. + */ + void end(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ConversationEndedException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ConversationEndedException.java new file mode 100644 index 0000000000..63e3907cff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ConversationEndedException.java @@ -0,0 +1,67 @@ +/* + * 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.osoa.sca; + +/** + * Exception thrown to indicate the conversation being used for a stateful interaction has been ended. + * + * @version $Rev$ $Date$ + */ +public class ConversationEndedException extends ServiceRuntimeException { + private static final long serialVersionUID = 3734864942222558406L; + + /** + * Override constructor from ServiceRuntimeException. + * + * @see ServiceRuntimeException + */ + public ConversationEndedException() { + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param message passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public ConversationEndedException(String message) { + super(message); + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param message passed to ServiceRuntimeException + * @param cause passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public ConversationEndedException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param cause passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public ConversationEndedException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CurrentCompositeContext.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CurrentCompositeContext.java new file mode 100644 index 0000000000..0ed4cf8b96 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CurrentCompositeContext.java @@ -0,0 +1,52 @@ +/* + * 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.osoa.sca; + +/** + * @deprecated + * + * Class providing access to the current CompositeComponent. + * + * @version $Rev$ $Date$ + */ +public final class CurrentCompositeContext { + private static final ThreadLocal CURRENT_COMPONENT = + new InheritableThreadLocal(); + + /** + * Returns the current composite context associated with this thread. + * + * @return the current composite context + */ + public static CompositeContext getContext() { + return CURRENT_COMPONENT.get(); + } + + /** + * Sets the composite context that is associated with this thread. + * + * @param context the context to associated with this thread; may be null + * @return the context previously associated with this thread; may be null + */ + public static CompositeContext setContext(CompositeContext context) { + CompositeContext current = CURRENT_COMPONENT.get(); + CURRENT_COMPONENT.set(context); + return current; + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java new file mode 100644 index 0000000000..7c067a3a43 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java @@ -0,0 +1,68 @@ +/* + * 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.osoa.sca; + +/** + * Exception thrown to indicate that no callback has been registered + * when interacting with a service. + * + * @version $Rev$ $Date$ + */ +public class NoRegisteredCallbackException extends ServiceRuntimeException { + private static final long serialVersionUID = 3734864942222558406L; + + /** + * Override constructor from ServiceRuntimeException. + * + * @see ServiceRuntimeException + */ + public NoRegisteredCallbackException() { + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param message passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public NoRegisteredCallbackException(String message) { + super(message); + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param message passed to ServiceRuntimeException + * @param cause passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public NoRegisteredCallbackException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param cause passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public NoRegisteredCallbackException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java new file mode 100644 index 0000000000..900d5eecc1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java @@ -0,0 +1,66 @@ +/* + * 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.osoa.sca; + +import javax.security.auth.Subject; + +/** + * Interface that provides information on the current request. + * + * @version $Rev$ $Date$ + */ +public interface RequestContext { + /** + * Returns the JAAS Subject of the current request. + * + * @return the Subject of the current request + */ + Subject getSecuritySubject(); + + /** + * Returns the name of the service that was invoked. + * + * @return the name of the service that was invoked + */ + String getServiceName(); + + /** + * Returns a CallableReference for the service that was invoked by the caller. + * + * @param the Java type of the business interface for the reference + * @return a CallableReference for the service that was invoked by the caller + */ + CallableReference getServiceReference(); + + /** + * Returns a type-safe reference to the callback provided by the caller. + * + * @param the Java type of the business interface for the callback + * @return a type-safe reference to the callback provided by the caller + */ + CB getCallback(); + + /** + * Returns a CallableReference to the callback provided by the caller. + * + * @param the Java type of the business interface for the callback + * @return a CallableReference to the callback provided by the caller + */ + CallableReference getCallbackReference(); +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java new file mode 100644 index 0000000000..8790aac4fb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java @@ -0,0 +1,65 @@ +/* + * 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.osoa.sca; + + +/** + * A ServiceReference represents a client's perspective of a reference to another service. + * + * @version $Rev$ $Date$ + * @param the Java interface associated with this reference + */ +public interface ServiceReference extends CallableReference { + /** + * Returns the id supplied by the user that will be associated with conversations initiated through this reference. + * + * @return the id to associated with any conversation initiated through this reference + */ + Object getConversationID(); + + /** + * Set the id to associate with any conversation started through this reference. + * If the value supplied is null then the id will be generated by the implementation. + * + * @param conversationId the user-defined id to associated with a conversation + * @throws IllegalStateException if a conversation is currently associated with this reference + */ + void setConversationID(Object conversationId) throws IllegalStateException; + + /** + * Sets the callback ID. + * + * @param callbackID the callback ID + */ + void setCallbackID(Object callbackID); + + /** + * Returns the callback object. + * + * @return the callback object + */ + Object getCallback(); + + /** + * Sets the callback object. + * + * @param callback the callback object + */ + void setCallback(Object callback); +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceRuntimeException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceRuntimeException.java new file mode 100644 index 0000000000..1c6b436afa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceRuntimeException.java @@ -0,0 +1,69 @@ +/* + * 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.osoa.sca; + + +/** + * Base for Exceptions that may be raised by an SCA runtime and which typical + * application code is not expected to be able to handle. + * + * @version $Rev$ $Date$ + */ +public class ServiceRuntimeException extends RuntimeException { + private static final long serialVersionUID = -3876058842262557092L; + + /** + * Override constructor from RuntimeException. + * + * @see RuntimeException + */ + public ServiceRuntimeException() { + } + + /** + * Override constructor from RuntimeException. + * + * @param message passed to RuntimeException + * @see RuntimeException + */ + public ServiceRuntimeException(String message) { + super(message); + } + + /** + * Override constructor from RuntimeException. + * + * @param message passed to RuntimeException + * @param cause passed to RuntimeException + * @see RuntimeException + */ + public ServiceRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Override constructor from RuntimeException. + * + * @param cause passed to RuntimeException + * @see RuntimeException + */ + public ServiceRuntimeException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceUnavailableException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceUnavailableException.java new file mode 100644 index 0000000000..d3543799ed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceUnavailableException.java @@ -0,0 +1,65 @@ +/* + * 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.osoa.sca; + +/** + * Exception used to indicate that a runtime exception occurred during the invocation of and external service. + * + * @version $Rev$ $Date$ + */ +public class ServiceUnavailableException extends ServiceRuntimeException { + + private static final long serialVersionUID = -5869397223249401047L; + + /** + * Constructs a new ServiceUnavailableException. + */ + public ServiceUnavailableException() { + super((Throwable) null); + } + + /** + * Constructs a new ServiceUnavailableException with the specified detail message. + * + * @param message The detail message (which is saved to later retrieval by the getMessage() method). + */ + public ServiceUnavailableException(String message) { + super(message); + } + + /** + * Constructs a new ServiceUnavailableException with the specified cause. + * + * @param cause The cause (which is saved to later retrieval by the getCause() method). + */ + public ServiceUnavailableException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new ServiceUnavailableException with the specified detail message and cause. + * + * @param message The message (which is saved to later retrieval by the getMessage() method). + * @param cause The cause (which is saved to later retrieval by the getCause() method). + */ + public ServiceUnavailableException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java new file mode 100644 index 0000000000..dcf16126da --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java @@ -0,0 +1,38 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation on a method that indicates that its parameters may safely + * be passed by reference. The annotation may also be placed on an interface + * or class to indicate that all declared methods support this optimization. + * + * @version $Rev$ $Date$ + */ +@Target({TYPE, METHOD}) +@Retention(RUNTIME) +public @interface AllowsPassByReference { +} + diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Authentication.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Authentication.java new file mode 100644 index 0000000000..290ec05b7f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Authentication.java @@ -0,0 +1,69 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +import static org.osoa.sca.Constants.SCA_PREFIX; + +/** + * Annotation denoting the intent that service operations require authentication. + *

+ * Applied to the injection site (field, method or constructor parameter) for a reference, + * it indicates that all invocations through that reference require authentication. + *

+ * Applied to a interface method on a service contract, it indicates that all invocations + * of that service operation require authentication; applied to the type of a service contract, + * it indicates that all service operations on that interface require authentication. + *

+ * Applied to a method on an implementation class, it indicates that all invocations that + * are dispatched to that implementation method (through any service) require authentication. + * Applied to a interface implemented by an implementation class, it indicates that all + * invocations that are dispatched to the implementation method for that interface operation + * require authentication. + *

+ * Applied to an implementation class, it indicates that all invocations of that implementation + * and that all invocations made by that implementation require authentication. + * + * @version $Rev$ $Date$ + */ +@Inherited +@Target({TYPE, FIELD, METHOD, PARAMETER}) +@Retention(RUNTIME) +@Intent(Authentication.AUTHENTICATION) +public @interface Authentication { + String AUTHENTICATION = SCA_PREFIX + "authentication"; + String AUTHENTICATION_MESSAGE = AUTHENTICATION + "message"; + String AUTHENTICATION_TRANSPORT = AUTHENTICATION + "transport"; + + /** + * List of authentication qualifiers (such as "message" or "transport"). + * + * @return authentication qualifiers + */ + @Qualifier + String[] value() default ""; +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Callback.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Callback.java new file mode 100644 index 0000000000..6b3e51211a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Callback.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 org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * When placed on a service interface, this annotation specifies the interface + * to be used for callbacks. + *

+ * When placed on a method or field, this annotation denotes the injection + * site to be used for a callback reference. + *

+ * There is a error in the 1.00 draft spec in the declaration of this interface. + * The form defined here is a proposed correction for that error. + * + * @version $Rev$ $Date$ + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Callback { + /** + * The Class of the associated callback interface. + * + * @return the associated callback interface + */ + Class value() default Void.class; +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ComponentName.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ComponentName.java new file mode 100644 index 0000000000..0ad13831c2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ComponentName.java @@ -0,0 +1,35 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a field or method that is used to inject the component's name. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface ComponentName { +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Confidentiality.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Confidentiality.java new file mode 100644 index 0000000000..e8b0721ce5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Confidentiality.java @@ -0,0 +1,69 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +import static org.osoa.sca.Constants.SCA_PREFIX; + +/** + * Annotation denoting the intent that service operations require confidentiality. + *

+ * Applied to the injection site (field, method or constructor parameter) for a reference, + * it indicates that all invocations through that reference require confidentiality. + *

+ * Applied to a interface method on a service contract, it indicates that all invocations + * of that service operation require confidentiality; applied to the type of a service contract, + * it indicates that all service operations on that interface require confidentiality. + *

+ * Applied to a method on an implementation class, it indicates that all invocations that + * are dispatched to that implementation method (through any service) require confidentiality. + * Applied to a interface implemented by an implementation class, it indicates that all + * invocations that are dispatched to the implementation method for that interface operation + * require confidentiality. + *

+ * Applied to an implementation class, it indicates that all invocations of that implementation + * and that all invocations made by that implementation require confidentiality. + * + * @version $Rev$ $Date$ + */ +@Inherited +@Target({TYPE, FIELD, METHOD, PARAMETER}) +@Retention(RUNTIME) +@Intent(Confidentiality.CONFIDENTIALITY) +public @interface Confidentiality { + String CONFIDENTIALITY = SCA_PREFIX + "confidentiality"; + String CONFIDENTIALITY_MESSAGE = CONFIDENTIALITY + ".message"; + String CONFIDENTIALITY_TRANSPORT = CONFIDENTIALITY + ".transport"; + + /** + * List of confidentiality qualifiers (such as "message" or "transport"). + * + * @return confidentiality qualifiers + */ + @Qualifier + String[] value() default ""; +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Constructor.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Constructor.java new file mode 100644 index 0000000000..8480b38926 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Constructor.java @@ -0,0 +1,35 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.CONSTRUCTOR; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Used to indicate the constructor the runtime is to use when instantiating a component implementation instance + * + * @version $Rev$ $Date$ + */ +@Target(CONSTRUCTOR) +@Retention(RUNTIME) +public @interface Constructor { + String[] value() default ""; +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Context.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Context.java new file mode 100644 index 0000000000..c02e220d3c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Context.java @@ -0,0 +1,38 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a field or setter method that is used to inject an SCA context. + * The type of context injected is determined by the type of the field or the parameter + * to the setter method and is typically a ComponentContext or RequestContext. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Context { +} + diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java new file mode 100644 index 0000000000..edd2307de8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java @@ -0,0 +1,56 @@ +/* + * 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.osoa.sca.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate the characteristics of a conversation. + * + * @version $Rev$ $Date$ + */ +@Target(ElementType.TYPE) +@Retention(RUNTIME) +public @interface ConversationAttributes { + /** + * The maximum time that can pass between operations in a single conversation. If this time is exceeded the + * container may end the conversation. + * + * @return the maximum time that can pass between operations in a single conversation + */ + public String maxIdleTime() default ""; + + /** + * The maximum time that a conversation may remain active. If this time is exceeded the container may end the + * conversation. + * + * @return the maximum time that a conversation may remain active + */ + public String maxAge() default ""; + + /** + * If true, indicates that only the user that initiated the conversation has the authority to continue it. + * + * @return true if only the user that initiated the conversation has the authority to continue it + */ + public boolean singlePrincipal() default false; +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationID.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationID.java new file mode 100644 index 0000000000..e521b91797 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationID.java @@ -0,0 +1,35 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a field or method that is used to inject the conversation ID. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface ConversationID { +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Conversational.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Conversational.java new file mode 100644 index 0000000000..c2e6e7fe0f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Conversational.java @@ -0,0 +1,37 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Used on a Java interface to denote a conversational service contract. + *

+ * The draft spec erroneously defines the targets for this as {TYPE, METHOD, FIELD} + * but this annotation is only applicable to interfaces. + * + * @version $Rev$ $Date$ + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface Conversational { +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Destroy.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Destroy.java new file mode 100644 index 0000000000..0a81dbe14c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Destroy.java @@ -0,0 +1,35 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a method that will be called by the container when the + * scope defined for the local service ends. + * + * @version $Rev$ $Date$ + */ +@Target(METHOD) +@Retention(RUNTIME) +public @interface Destroy { +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EagerInit.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EagerInit.java new file mode 100644 index 0000000000..5a2fdd7518 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EagerInit.java @@ -0,0 +1,35 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate an instance should be eagerly initialized. + * + * @version $Rev$ $Date$ + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface EagerInit { + +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EndsConversation.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EndsConversation.java new file mode 100644 index 0000000000..021900752c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EndsConversation.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 org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a method ends a conversation. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface EndsConversation { +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Init.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Init.java new file mode 100644 index 0000000000..957bec262c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Init.java @@ -0,0 +1,36 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a method that will be called by the container when the scope defined for the local + * service begins. + * + * @version $Rev$ $Date$ + */ +@Target(METHOD) +@Retention(RUNTIME) +public @interface Init { + +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Integrity.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Integrity.java new file mode 100644 index 0000000000..11f266ac5e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Integrity.java @@ -0,0 +1,69 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +import static org.osoa.sca.Constants.SCA_PREFIX; + +/** + * Annotation denoting the intent that service operations require integrity. + *

+ * Applied to the injection site (field, method or constructor parameter) for a reference, + * it indicates that all invocations through that reference require integrity. + *

+ * Applied to a interface method on a service contract, it indicates that all invocations + * of that service operation require integrity; applied to the type of a service contract, + * it indicates that all service operations on that interface require integrity. + *

+ * Applied to a method on an implementation class, it indicates that all invocations that + * are dispatched to that implementation method (through any service) require integrity. + * Applied to a interface implemented by an implementation class, it indicates that all + * invocations that are dispatched to the implementation method for that interface operation + * require integrity. + *

+ * Applied to an implementation class, it indicates that all invocations of that implementation + * and that all invocations made by that implementation require integrity. + * + * @version $Rev$ $Date$ + */ +@Inherited +@Target({TYPE, FIELD, METHOD, PARAMETER}) +@Retention(RUNTIME) +@Intent(Integrity.INTEGRITY) +public @interface Integrity { + String INTEGRITY = SCA_PREFIX + "integrity"; + String INTEGRITY_MESSAGE = INTEGRITY + "message"; + String INTEGRITY_TRANSPORT = INTEGRITY + "transport"; + + /** + * List of integrity qualifiers (such as "message" or "transport"). + * + * @return integrity qualifiers + */ + @Qualifier + String[] value() default ""; +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Intent.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Intent.java new file mode 100644 index 0000000000..c655495e74 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Intent.java @@ -0,0 +1,58 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation that can be applied to annotations that describe SCA intents. + * Adding this annotation allows SCA runtimes to automatically detect user-defined intents. + *

+ * Applications must specify a value, a pairing of targetNamespace and localPort, or both. + * If both value and pairing are supplied they must define the name qualified name. + * + * @version $Rev$ $Date$ + */ +@Target({ANNOTATION_TYPE}) +@Retention(RUNTIME) +public @interface Intent { + /** + * The qualified name of the intent, in the form defined by {@link javax.xml.namespace.QName#toString}. + * + * @return the qualified name of the intent + */ + String value() default ""; + + /** + * The XML namespace for the intent. + * + * @return the XML namespace for the intent + */ + String targetNamespace() default ""; + + /** + * The name of the intent within its namespace. + * + * @return name of the intent within its namespace + */ + String localPart() default ""; +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/OneWay.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/OneWay.java new file mode 100644 index 0000000000..37fbaf96cd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/OneWay.java @@ -0,0 +1,35 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation on a method that indicates that the method is non-blocking and communication + * with the service provider may use buffer the requests and send them at some later time. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface OneWay { +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/PolicySets.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/PolicySets.java new file mode 100644 index 0000000000..5bf43b0539 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/PolicySets.java @@ -0,0 +1,45 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation that allows application of SCA Policy Sets. + *

+ * Each policy set is specified using its XML QName in the form defined by {@link javax.xml.namespace.QName#toString()}. + * + * @version $Rev$ $Date$ + */ +@Target({TYPE, FIELD, METHOD, PARAMETER}) +@Retention(RUNTIME) +public @interface PolicySets { + /** + * Returns the policy sets to be applied. + * + * @return the policy sets to be applied + */ + String[] value() default ""; +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Property.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Property.java new file mode 100644 index 0000000000..e0248c01f9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Property.java @@ -0,0 +1,56 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a constructor parameter, field or method that is + * used to inject a configuration property value. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, FIELD, PARAMETER}) +@Retention(RUNTIME) +public @interface Property { + /** + * The name of the property. If not specified then the name will be derived + * from the annotated field or method. + * + * @return the name of the property + */ + String name() default ""; + + /** + * Indicates whether a value for the property must be provided. + * + * @return true if a value must be provided + */ + boolean required() default false; + + /** + * The XML Type in a QName format + */ + String xmlType() default ""; + } diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Qualifier.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Qualifier.java new file mode 100644 index 0000000000..9875891460 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Qualifier.java @@ -0,0 +1,35 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation that can be applied to an attribute of an @Intent annotation to indicate the + * attribute provides qualifiers for the intent. + * + * @version $Rev$ $Date$ + */ +@Target(METHOD) +@Retention(RUNTIME) +public @interface Qualifier { +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Reference.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Reference.java new file mode 100644 index 0000000000..f6f6797ccc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Reference.java @@ -0,0 +1,50 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a constructor parameter, field or method that is used to inject a reference. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, FIELD, PARAMETER}) +@Retention(RUNTIME) +public @interface Reference { + /** + * The name of the reference. If not specified then the name will be derived from the annotated field or method. + * + * @return the name of the reference + */ + public String name() default ""; + + /** + * Indicates if a reference must be specified. + * + * @return true if a reference must be specified + */ + public boolean required() default false; +} + diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Remotable.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Remotable.java new file mode 100644 index 0000000000..f447a4126d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Remotable.java @@ -0,0 +1,36 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a Java interface as remotable. + * Remotable interfaces use pass-by-value semantics, can be published as entry points + * and used for external services. + * + * @version $Rev$ $Date$ + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface Remotable { +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Requires.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Requires.java new file mode 100644 index 0000000000..2f14ab59f6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Requires.java @@ -0,0 +1,56 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation that allows the attachment of any intent to a Java Class or interface or to members of that + * class such as methods, fields or constructor parameters. + *

+ * Intents are specified as XML QNames in the representation defined by + * {@link javax.xml.namespace.QName#toString()}. Intents may be qualified with one or more + * suffixes separated by a "." such as: + *

    + *
  • {http://www.osoa.org/xmlns/sca/1.0}confidentiality
  • + *
  • {http://www.osoa.org/xmlns/sca/1.0}confidentiality.message
  • + *
+ * This annotation supports general purpose intents specified as strings. Users may also define + * specific intents using the {@link @org.osoa.sca.annotations.Intent} annotation. + * + * @version $Rev$ $Date$ + */ +@Inherited +@Retention(RUNTIME) +@Target({TYPE, METHOD, FIELD, PARAMETER}) +public @interface Requires { + /** + * Returns the attached intents. + * + * @return the attached intents + */ + String[] value() default ""; +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Scope.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Scope.java new file mode 100644 index 0000000000..9f82fbc283 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Scope.java @@ -0,0 +1,48 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a scoped service. + *

+ * The spec refers to but does not describe an eager() attribute; this is an error in the draft. + * + * @version $Rev$ $Date$ + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface Scope { + /** + * The name of the scope. Values currently defined by the specification are: + *

    + *
  • STATELESS (default)
  • + *
  • REQUEST
  • + *
  • CONVERSATION
  • + *
  • COMPOSITE
  • + *
+ * + * @return the name of the scope + */ + String value() default "STATELESS"; +} diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Service.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Service.java new file mode 100644 index 0000000000..99d3dbfebe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Service.java @@ -0,0 +1,47 @@ +/* + * 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.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate the service interfaces exposed by a Java class. + * + * @version $Rev$ $Date$ + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface Service { + /** + * Array of interfaces that should be exposed as services. + * + * @return a list of interfaces that should be exposed as services + */ + Class[] interfaces() default {}; + + /** + * Shortcut allowing a single interface to be exposed. + * + * @return a single service interfaces to be exposed + */ + Class value() default Void.class; +} -- cgit v1.2.3