From f8c39e92337e604a17d016621d2201968d01e26a Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:23:20 +0000 Subject: Moving 2.x tags git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835155 13f79535-47bb-0310-9956-ffa450edef68 --- .../tags/2.0-M4-RC3/modules/sca-api/LICENSE | 204 +++++++++++++++++ .../modules/sca-api/META-INF/MANIFEST.MF | 18 ++ .../tags/2.0-M4-RC3/modules/sca-api/NOTICE | 9 + .../tags/2.0-M4-RC3/modules/sca-api/pom.xml | 35 +++ .../java/org/oasisopen/sca/ComponentContext.java | 119 ++++++++++ .../src/main/java/org/oasisopen/sca/Constants.java | 34 +++ .../org/oasisopen/sca/InvalidServiceException.java | 60 +++++ .../org/oasisopen/sca/NoSuchDomainException.java | 40 ++++ .../org/oasisopen/sca/NoSuchServiceException.java | 41 ++++ .../java/org/oasisopen/sca/RequestContext.java | 52 +++++ .../org/oasisopen/sca/SCARuntimeException.java | 41 ++++ .../java/org/oasisopen/sca/ServiceReference.java | 19 ++ .../org/oasisopen/sca/ServiceRuntimeException.java | 55 +++++ .../oasisopen/sca/ServiceUnavailableException.java | 51 +++++ .../sca/annotation/AllowsPassByReference.java | 32 +++ .../oasisopen/sca/annotation/Authentication.java | 55 +++++ .../oasisopen/sca/annotation/Authorization.java | 30 +++ .../org/oasisopen/sca/annotation/Callback.java | 36 +++ .../oasisopen/sca/annotation/ComponentName.java | 22 ++ .../oasisopen/sca/annotation/Confidentiality.java | 55 +++++ .../org/oasisopen/sca/annotation/Constructor.java | 22 ++ .../java/org/oasisopen/sca/annotation/Context.java | 25 +++ .../java/org/oasisopen/sca/annotation/Destroy.java | 22 ++ .../org/oasisopen/sca/annotation/EagerInit.java | 22 ++ .../java/org/oasisopen/sca/annotation/Init.java | 23 ++ .../org/oasisopen/sca/annotation/Integrity.java | 55 +++++ .../java/org/oasisopen/sca/annotation/Intent.java | 45 ++++ .../sca/annotation/ManagedSharedTransaction.java | 29 +++ .../sca/annotation/ManagedTransaction.java | 40 ++++ .../sca/annotation/MutualAuthentication.java | 30 +++ .../sca/annotation/NoManagedTransaction.java | 29 +++ .../java/org/oasisopen/sca/annotation/OneWay.java | 22 ++ .../org/oasisopen/sca/annotation/PolicySets.java | 32 +++ .../org/oasisopen/sca/annotation/Property.java | 38 ++++ .../org/oasisopen/sca/annotation/Qualifier.java | 22 ++ .../org/oasisopen/sca/annotation/Reference.java | 37 ++++ .../org/oasisopen/sca/annotation/Remotable.java | 23 ++ .../org/oasisopen/sca/annotation/Requires.java | 43 ++++ .../java/org/oasisopen/sca/annotation/Scope.java | 33 +++ .../java/org/oasisopen/sca/annotation/Service.java | 45 ++++ .../java/org/oasisopen/sca/client/SCAClient.java | 53 +++++ .../org/oasisopen/sca/client/SCAClientFactory.java | 126 +++++++++++ .../sca/client/impl/SCAClientFactoryFinder.java | 241 +++++++++++++++++++++ 43 files changed, 2065 insertions(+) create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/LICENSE create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/META-INF/MANIFEST.MF create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/NOTICE create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/pom.xml create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ComponentContext.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/Constants.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/InvalidServiceException.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/NoSuchDomainException.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/NoSuchServiceException.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/RequestContext.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/SCARuntimeException.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceReference.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceRuntimeException.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceUnavailableException.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/AllowsPassByReference.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Authentication.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Authorization.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Callback.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ComponentName.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Confidentiality.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Constructor.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Context.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Destroy.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/EagerInit.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Init.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Integrity.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Intent.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ManagedSharedTransaction.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ManagedTransaction.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/MutualAuthentication.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/NoManagedTransaction.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/OneWay.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/PolicySets.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Property.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Qualifier.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Reference.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Remotable.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Requires.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Scope.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Service.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClient.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java create mode 100644 sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/impl/SCAClientFactoryFinder.java (limited to 'sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api') diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/LICENSE b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/LICENSE new file mode 100644 index 0000000000..de4b130f35 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/LICENSE @@ -0,0 +1,204 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + + diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/META-INF/MANIFEST.MF b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..2120e72d06 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Export-Package: org.oasisopen.sca;version="2.0.0";uses:="javax.security.auth", + org.oasisopen.sca.annotation;version="2.0.0", + org.oasisopen.sca.client;version="2.0.0" +Tool: Bnd-0.0.255 +Bundle-Name: Apache Tuscany SCA API +Created-By: 1.6.0_07 (Sun Microsystems Inc.) +Bundle-Vendor: The Apache Software Foundation +Bundle-Version: 2.0.0 +Bnd-LastModified: 1225397105046 +Bundle-ManifestVersion: 2 +Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt +Bundle-Description: API classes for the Service Component Architecture +Import-Package: javax.security.auth,org.oasisopen.sca;version="2.0.0",org.oas + isopen.sca.annotation;version="2.0.0",org.oasisopen.sca.client;version="2.0.0" +Bundle-SymbolicName: org.apache.tuscany.sca.api +Bundle-DocURL: http://www.apache.org/ +Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/NOTICE b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/NOTICE new file mode 100644 index 0000000000..6f390de5e6 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/NOTICE @@ -0,0 +1,9 @@ +${pom.name} +Copyright (c) 2005 - 2009 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + +This product includes software developed at +the OSGi Alliance (http://www.osgi.org/). + diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/pom.xml b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/pom.xml new file mode 100644 index 0000000000..49cfd31274 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/pom.xml @@ -0,0 +1,35 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-modules + 2.0-M4 + ../pom.xml + + org.apache.tuscany.sca + tuscany-sca-api + Apache Tuscany SCA API + + API classes for the Service Component Architecture + jar + + diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ComponentContext.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ComponentContext.java new file mode 100644 index 0000000000..740003fc12 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ComponentContext.java @@ -0,0 +1,119 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca; + +import java.util.Collection; + +/** + * 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(); + + + /* ******************** Contribution for issue TUSCANY-2281 ******************** */ + + /** + * Returns a Collection of typed service proxies for a business interface type and a reference name. + * @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 Collection of objects that implements the business interface + */ + Collection getServices(Class businessInterface, String referenceName); + + + /** + * Returns a Collection of typed service reference for a business interface type and a reference name. + * @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 Collection of objects that implements the business interface + */ + Collection> getServiceReferences(Class businessInterface, String referenceName); +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/Constants.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/Constants.java new file mode 100644 index 0000000000..261b9baaf1 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/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.oasisopen.sca; + +/** + * @version $Rev$ $Date$ + */ +public interface Constants { + /** + * Namespace for intents. + */ + String SCA_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200903"; + + /** + * Prefix form of the namespace that can be prepended to intent declarations. + */ + String SCA_PREFIX = '{' + SCA_NS + '}'; +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/InvalidServiceException.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/InvalidServiceException.java new file mode 100644 index 0000000000..0076ad34c0 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/InvalidServiceException.java @@ -0,0 +1,60 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca; + +/** + * This exception signals that the ServiceReference is no longer valid. + * This can happen when the target of the reference is undeployed. + * + * This exception is not transient and therefore is unlikely to be + * resolved by retrying the operation and will most likely require + * human intervention. + */ +public class InvalidServiceException extends ServiceRuntimeException { + /** + * Constructs a InvalidServiceException with no detail message. + */ + public InvalidServiceException() { + super(); + } + + /** + * Constructs a InvalidServiceException with the specified detail + * message. + * + * @param message the detail message + */ + public InvalidServiceException(String message) { + super(message); + } + + /** + * Constructs a InvalidServiceException with the specified detail + * message and cause. + * + * The detail message associated with cause is not + * automatically incorporated in this exception's detail message. + * + * @param message the detail message + * @param cause the cause, or null if the cause is nonexistent + * or unknown + */ + public InvalidServiceException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a InvalidServiceException with the specified cause and + * a detail message of (cause==null ? null : cause.toString()). + * + * @param cause the cause, or null if the cause is nonexistent + * or unknown + */ + public InvalidServiceException(Throwable cause) { + super(cause); + } + + private static final long serialVersionUID = 7520492728695222145L; +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/NoSuchDomainException.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/NoSuchDomainException.java new file mode 100644 index 0000000000..51a4dbe3ad --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/NoSuchDomainException.java @@ -0,0 +1,40 @@ +/* + * 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.oasisopen.sca; + +public class NoSuchDomainException extends Exception { + private static final long serialVersionUID = -3990087696861167748L; + + public NoSuchDomainException() { + super((Throwable)null); + } + + public NoSuchDomainException(String message) { + super(message); + } + + public NoSuchDomainException(Throwable cause) { + super(cause); + } + + public NoSuchDomainException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/NoSuchServiceException.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/NoSuchServiceException.java new file mode 100644 index 0000000000..62d1b07f23 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/NoSuchServiceException.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.oasisopen.sca; + +public class NoSuchServiceException extends Exception { + private static final long serialVersionUID = -3542376318558454581L; + + public NoSuchServiceException() { + super((Throwable)null); + } + + public NoSuchServiceException(String message) { + super(message); + } + + public NoSuchServiceException(Throwable cause) { + super(cause); + } + + public NoSuchServiceException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/RequestContext.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/RequestContext.java new file mode 100644 index 0000000000..d12648a795 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/RequestContext.java @@ -0,0 +1,52 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.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 + */ + ServiceReference 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 + */ + ServiceReference getCallbackReference(); +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/SCARuntimeException.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/SCARuntimeException.java new file mode 100644 index 0000000000..ed957cff6d --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/SCARuntimeException.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.oasisopen.sca; + +public class SCARuntimeException extends RuntimeException { + private static final long serialVersionUID = -3867882539949395157L; + + public SCARuntimeException() { + super((Throwable)null); + } + + public SCARuntimeException(String message) { + super(message); + } + + public SCARuntimeException(Throwable cause) { + super(cause); + } + + public SCARuntimeException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceReference.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceReference.java new file mode 100644 index 0000000000..d89ed54d10 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceReference.java @@ -0,0 +1,19 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca; + +import java.io.Serializable; + + +/** + * 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 Serializable { + B getService(); + Class getBusinessInterface(); +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceRuntimeException.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceRuntimeException.java new file mode 100644 index 0000000000..70c429dcc2 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceRuntimeException.java @@ -0,0 +1,55 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceUnavailableException.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceUnavailableException.java new file mode 100644 index 0000000000..39cd6b1cac --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/ServiceUnavailableException.java @@ -0,0 +1,51 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/AllowsPassByReference.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/AllowsPassByReference.java new file mode 100644 index 0000000000..d394a64f91 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/AllowsPassByReference.java @@ -0,0 +1,32 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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 static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Annotation on a service implementation class, on an individual method of a remotable service implementation, + * or on an individual reference which uses a remotable interface, where the reference is a field, a setter method, + * or a constructor parameter method. + * The annotation indicates that that the parameters and return value may safely + * be passed by reference. When the annotation is placed on a service implementation class or on a reference + * it indicates that all declared methods support this optimization. + * + * @version $Rev$ $Date$ + */ +@Target({TYPE, METHOD, FIELD, PARAMETER}) +@Retention(RUNTIME) +public @interface AllowsPassByReference { + + boolean value() default true; +} + diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Authentication.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Authentication.java new file mode 100644 index 0000000000..483fe2f293 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Authentication.java @@ -0,0 +1,55 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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 static java.lang.annotation.RetentionPolicy.RUNTIME; +import static org.oasisopen.sca.Constants.SCA_PREFIX; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * 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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Authorization.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Authorization.java new file mode 100644 index 0000000000..76fcd866ae --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Authorization.java @@ -0,0 +1,30 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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 static java.lang.annotation.RetentionPolicy.RUNTIME; +import static org.oasisopen.sca.Constants.SCA_PREFIX; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * The @Authorization annotation is used to indicate that + * an authorization policy is required - for a method, for an implementation class, for a reference + * (either injected as a method parameter or injected into a field) + */ +@Inherited +@Target({TYPE, FIELD, METHOD, PARAMETER}) +@Retention(RUNTIME) +@Intent(Authorization.AUTHORIZATION) +public @interface Authorization { + String AUTHORIZATION = SCA_PREFIX + "authorization"; +} + diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Callback.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Callback.java new file mode 100644 index 0000000000..03598e10d0 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Callback.java @@ -0,0 +1,36 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ComponentName.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ComponentName.java new file mode 100644 index 0000000000..7debe2ba89 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ComponentName.java @@ -0,0 +1,22 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Confidentiality.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Confidentiality.java new file mode 100644 index 0000000000..5481a988b6 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Confidentiality.java @@ -0,0 +1,55 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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 static java.lang.annotation.RetentionPolicy.RUNTIME; +import static org.oasisopen.sca.Constants.SCA_PREFIX; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * 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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Constructor.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Constructor.java new file mode 100644 index 0000000000..c1c99de683 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Constructor.java @@ -0,0 +1,22 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.CONSTRUCTOR; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Context.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Context.java new file mode 100644 index 0000000000..fce0334792 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Context.java @@ -0,0 +1,25 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Destroy.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Destroy.java new file mode 100644 index 0000000000..f9c6505648 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Destroy.java @@ -0,0 +1,22 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/EagerInit.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/EagerInit.java new file mode 100644 index 0000000000..a8e415a00b --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/EagerInit.java @@ -0,0 +1,22 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Init.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Init.java new file mode 100644 index 0000000000..b8b38a1088 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Init.java @@ -0,0 +1,23 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Integrity.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Integrity.java new file mode 100644 index 0000000000..14cd5ec005 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Integrity.java @@ -0,0 +1,55 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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 static java.lang.annotation.RetentionPolicy.RUNTIME; +import static org.oasisopen.sca.Constants.SCA_PREFIX; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * 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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Intent.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Intent.java new file mode 100644 index 0000000000..54a1935859 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Intent.java @@ -0,0 +1,45 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ManagedSharedTransaction.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ManagedSharedTransaction.java new file mode 100644 index 0000000000..b12050a3e3 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ManagedSharedTransaction.java @@ -0,0 +1,29 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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 static java.lang.annotation.RetentionPolicy.RUNTIME; +import static org.oasisopen.sca.Constants.SCA_PREFIX; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * The @ManagedSharedTransaction annotation is used to indicate that + * a distributed ACID transaction is required. + */ +@Inherited +@Target({TYPE, FIELD, METHOD, PARAMETER}) +@Retention(RUNTIME) +@Intent(ManagedSharedTransaction.MANAGEDSHAREDTRANSACTION) +public @interface ManagedSharedTransaction { + String MANAGEDSHAREDTRANSACTION = SCA_PREFIX + "managedSharedTransaction"; +} + diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ManagedTransaction.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ManagedTransaction.java new file mode 100644 index 0000000000..7115e8a5e9 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/ManagedTransaction.java @@ -0,0 +1,40 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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 static java.lang.annotation.RetentionPolicy.RUNTIME; +import static org.oasisopen.sca.Constants.SCA_PREFIX; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * The @ManagedTransaction annotation is used to indicate the + * need for an ACID transaction environment. + */ +@Inherited +@Target({TYPE, FIELD, METHOD, PARAMETER}) +@Retention(RUNTIME) +@Intent(ManagedTransaction.MANAGEDTRANSACTION) +public @interface ManagedTransaction { + String MANAGEDTRANSACTION = SCA_PREFIX + "managedTransaction"; + String MANAGEDTRANSACTION_MESSAGE = MANAGEDTRANSACTION + ".local"; + String MANAGEDTRANSACTION_TRANSPORT = MANAGEDTRANSACTION + ".global"; + + /** + * List of managedTransaction qualifiers (such as "global" or "local"). + * + * @return managedTransaction qualifiers + */ + @Qualifier + String[] value() default ""; +} + + diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/MutualAuthentication.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/MutualAuthentication.java new file mode 100644 index 0000000000..d0825cd8e3 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/MutualAuthentication.java @@ -0,0 +1,30 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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 static java.lang.annotation.RetentionPolicy.RUNTIME; +import static org.oasisopen.sca.Constants.SCA_PREFIX; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * The @MutualAuthentication annotation is used to indicate that + * a mutual authentication policy is needed. + */ +@Inherited +@Target({TYPE, FIELD, METHOD, PARAMETER}) +@Retention(RUNTIME) +@Intent(MutualAuthentication.MUTUALAUTHENTICATION) +public @interface MutualAuthentication { + String MUTUALAUTHENTICATION = SCA_PREFIX + "mutualAuthentication"; +} + + diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/NoManagedTransaction.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/NoManagedTransaction.java new file mode 100644 index 0000000000..b5ff494ca2 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/NoManagedTransaction.java @@ -0,0 +1,29 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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 static java.lang.annotation.RetentionPolicy.RUNTIME; +import static org.oasisopen.sca.Constants.SCA_PREFIX; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * The @NoManagedTransaction annotation is used to indicate that + * a non-transactional environment is needed. + */ +@Inherited +@Target({TYPE, FIELD, METHOD, PARAMETER}) +@Retention(RUNTIME) +@Intent(NoManagedTransaction.NOMANAGEDTRANSACTION) +public @interface NoManagedTransaction { + String NOMANAGEDTRANSACTION = SCA_PREFIX + "noManagedTransaction"; +} + diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/OneWay.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/OneWay.java new file mode 100644 index 0000000000..700e71990c --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/OneWay.java @@ -0,0 +1,22 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/PolicySets.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/PolicySets.java new file mode 100644 index 0000000000..69f5828045 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/PolicySets.java @@ -0,0 +1,32 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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 static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Property.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Property.java new file mode 100644 index 0000000000..5905946627 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Property.java @@ -0,0 +1,38 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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 true; +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Qualifier.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Qualifier.java new file mode 100644 index 0000000000..97204fdf32 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Qualifier.java @@ -0,0 +1,22 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Reference.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Reference.java new file mode 100644 index 0000000000..8f7d6b2043 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Reference.java @@ -0,0 +1,37 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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 + */ + String name() default ""; + + /** + * Indicates if a reference must be specified. + * + * @return true if a reference must be specified + */ + boolean required() default true; +} + diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Remotable.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Remotable.java new file mode 100644 index 0000000000..3f7ac2623a --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Remotable.java @@ -0,0 +1,23 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Requires.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Requires.java new file mode 100644 index 0000000000..08eb0a8935 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Requires.java @@ -0,0 +1,43 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +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 static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +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: + *

+ * This annotation supports general purpose intents specified as strings. Users may also define + * specific intents using the {@link @org.oasisopen.sca.annotation.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-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Scope.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Scope.java new file mode 100644 index 0000000000..8f9a13430e --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Scope.java @@ -0,0 +1,33 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +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)
  • + *
  • COMPOSITE
  • + *
+ * + * @return the name of the scope + */ + String value() default "STATELESS"; +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Service.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Service.java new file mode 100644 index 0000000000..a60754762e --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/annotation/Service.java @@ -0,0 +1,45 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.annotation; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * The @Service annotation is used on a component implementation + * class to specify the SCA services offered by the implementation. + * + * The class need not be declared as implementing all of the + * interfaces implied by the services, but all methods of the service + * interfaces must be present. + * + * A class used as the implementation of a service is not required + * to have a @Service annotation. If a class has no @Service annotation, + * then the rules determining which services are offered and what + * interfaces those services have are determined by the specific + * implementation type. + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface Service { + + /** + * The value is an array of interface or class objects that should be + * exposed as services by this component. + * + * @return the services of this component + */ + Class[] value(); + + /** + * The value is an array of strings which are used as the service names + * for each of the interfaces declared in the value array. + * + * @return the service names + */ + String[] names() default {}; +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClient.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClient.java new file mode 100644 index 0000000000..907330e93b --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClient.java @@ -0,0 +1,53 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. 2299 + * OASIS trademark, IPR and other policies apply. 2300 + */ +package org.oasisopen.sca.client; + +import java.net.URI; +import org.oasisopen.sca.NoSuchDomainException; +import org.oasisopen.sca.NoSuchServiceException; + +/** + * Client side helper that can be used to lookup SCA Services within a SCA Domain. + * + * @see SCAClientFactory + */ +public class SCAClient { + + /** + * Returns a reference proxy that implements the business interface of a + * service in a domain + * + * @param uri the URI of the target service. Takes the form domainURI/componentName/serviceName. + * The domainURI can be left off and defaults to the implementation specific default domain + * The service can also take the extended form + * domainURI/componentName/serviceName (or /componentName/serviceName). + * Can also take the extended form domainURI/componentName/serviceName/bindingName + * (or /componentName/serviceName/bindingName) to use a specific binding of the target service + * @param interfaze The business interface class of the service in the + * domain + * @param The business interface class of the service in the domain + * @return a proxy to the target service, in the specified SCA Domain that + * implements the business interface . + * @throws NoSuchServiceException Service requested was not found + * @throws NoSuchDomainException Domain requested was not found + */ + public static T getService(Class interfaze, String uri) throws NoSuchServiceException, NoSuchDomainException { + URI domainURI = null; + String serviceURI; + int i = uri.indexOf('/'); + if (i == -1) { + domainURI = null; + serviceURI = uri; + } else { + serviceURI = uri.substring(i+1); + if (i > 0) { + domainURI = URI.create(uri.substring(0, i)); + } else { + domainURI = null; + } + } + return SCAClientFactory.newInstance(domainURI).getService(interfaze, serviceURI); + } +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java new file mode 100644 index 0000000000..e96969c99d --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/SCAClientFactory.java @@ -0,0 +1,126 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.client; + +import java.net.URI; +import java.util.Properties; + +import org.oasisopen.sca.NoSuchDomainException; +import org.oasisopen.sca.NoSuchServiceException; +import org.oasisopen.sca.client.impl.SCAClientFactoryFinder; + +/** + * The SCAClientFactory can be used by non-SCA managed code to lookup services + * that exist in a SCADomain. + * + * @see SCAClientFactoryFinder + * @see SCAClient + * @author OASIS Open + */ +public abstract class SCAClientFactory { + + private URI domainURI; + + private SCAClientFactory() { + } + + /** + * Constructor used by concrete subclasses + * @param domainURI - The Domain URI of the Domain accessed via this SCAClientFactory + */ + protected SCAClientFactory(URI domainURI) { + this.domainURI = domainURI; + } + + /** + * Gets the Domain URI of the Domain accessed via this SCAClientFactory + * @return - the URI for the Domain + */ + protected URI getDomainURI() { + return domainURI; + } + + /** + * The default implementation of the SCAClientFactory. A Vendor may use + * reflection to inject a default SCAClientFactory instance that will be + * used in the newInstance() methods rather than using the + * SCAClientFactoryFinder. + */ + protected static SCAClientFactory defaultFactory; + + /** + * Creates a new instance of the SCAClient that can be used to lookup SCA + * Services. + * + * @return A new SCAClient + */ + public static SCAClientFactory newInstance(URI domainURI) throws NoSuchDomainException { + return newInstance(null, null, domainURI); + } + + /** + * Creates a new instance of the SCAClient that can be used to lookup SCA + * Services. + * + * @param properties Properties that may be used when creating a new + * instance of the SCAClient + * @return A new SCAClient instance + */ + public static SCAClientFactory newInstance(Properties properties, URI domainURI) { + return newInstance(properties, null, domainURI); + } + + /** + * Creates a new instance of the SCAClient that can be used to lookup SCA + * Services. + * + * @param classLoader ClassLoader that may be used when creating a new + * instance of the SCAClient + * @return A new SCAClient instance + */ + public static SCAClientFactory newInstance(ClassLoader classLoader, URI domainURI) { + return newInstance(null, classLoader, domainURI); + } + + /** + * Creates a new instance of the SCAClient that can be used to lookup SCA + * Services. + * + * @param properties Properties that may be used when creating a new + * instance of the SCAClient + * @param classLoader ClassLoader that may be used when creating a new + * instance of the SCAClient + * @return A new SCAClient instance + */ + public static SCAClientFactory newInstance(Properties properties, ClassLoader classLoader, URI domainURI) { + final SCAClientFactory factory; + if (defaultFactory == null) { + factory = SCAClientFactoryFinder.find(properties, classLoader, domainURI); + } else { + factory = defaultFactory; + } + return factory; + } + + /** + * Returns a reference proxy that implements the business interface + * of a service in the SCA Domain handled by this SCAClientFactory + * + * @param serviceURI the relative URI of the target service. Takes the + * form componentName/serviceName. + * Can also take the extended form componentName/serviceName/bindingName + * to use a specific binding of the target service + * + * @param interfaze The business interface class of the service in the + * domain + * @param The business interface class of the service in the domain + * + * @return a proxy to the target service, in the specified SCA Domain + * that implements the business interface . + * @throws NoSuchServiceException Service requested was not found + * @throws NoSuchDomainException Domain requested was not found + */ + public abstract T getService(Class interfaze, String serviceURI) throws NoSuchServiceException, NoSuchDomainException; +} diff --git a/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/impl/SCAClientFactoryFinder.java b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/impl/SCAClientFactoryFinder.java new file mode 100644 index 0000000000..5137f8a658 --- /dev/null +++ b/sca-java-2.x/tags/2.0-M4-RC3/modules/sca-api/src/main/java/org/oasisopen/sca/client/impl/SCAClientFactoryFinder.java @@ -0,0 +1,241 @@ +/* + * Copyright(C) OASIS(R) 2005,2009. All Rights Reserved. + * OASIS trademark, IPR and other policies apply. + */ +package org.oasisopen.sca.client.impl; + +import java.io.BufferedReader; +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URI; +import java.net.URL; +import java.util.Properties; + +import org.oasisopen.sca.SCARuntimeException; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This is a default class that returns an SCAClientFactory implementation - + * this class can be replaced by a vendor implementation. + * + * @see SCAClientFactory + * @author OASIS Open + */ +public class SCAClientFactoryFinder { + + /** + * The name of the System Property used to determine the SPI implementation + * to use for the SCAClientFactory. + */ + private static final String SCA_CLIENT_FACTORY_PROVIDER_KEY = SCAClientFactory.class.getName(); + + /** + * The name of the file loaded from the ClassPath to determine 2488 the SPI + * implementation to use for the SCAClientFactory. 2489 + */ + private static final String SCA_CLIENT_FACTORY_PROVIDER_META_INF_SERVICE = "META-INF/services/" + SCA_CLIENT_FACTORY_PROVIDER_KEY; + + /** + * Private Constructor. + */ + private SCAClientFactoryFinder() { + } + + /** + * Creates an instance of the SCAClientFactory implementation. This + * discovers the SCAClientFactory implementation and instantiates the + * provider's implementation. + * + * @param properties Properties that may be used when creating a new + * instance of the SCAClient + * @param classLoader ClassLoader that may be used when creating a new + * instance of the SCAClient + * @return new instance of the SCAClientFactory + * @throws SCARuntimeException Failed to create SCAClientFactory + * implementation. + */ + public static SCAClientFactory find(Properties properties, ClassLoader classLoader, URI domainURI) { + if (classLoader == null) { + classLoader = getThreadContextClassLoader(); + if (classLoader == null) { + classLoader = SCAClientFactoryFinder.class.getClassLoader(); + } + } + final String factoryImplClassName = discoverProviderFactoryImplClass(properties, classLoader); + final Class factoryImplClass = loadProviderFactoryClass(factoryImplClassName, classLoader); + final SCAClientFactory factory = instantiateSCAClientFactoryClass(factoryImplClass, domainURI); + return factory; + } + + /** + * Gets the Context ClassLoader for the current Thread. + * + * @return The Context ClassLoader for the current Thread. + */ + private static ClassLoader getThreadContextClassLoader() { + final ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader(); + return threadClassLoader; + } + + /** + * Attempts to discover the class name for the SCAClientFactory + * implementation from the specified Properties, the System Properties or + * the specified ClassLoader. + * + * @return The class name of the SCAClientFactory implementation + * @throw SCARuntimeException Failed to find implementation for + * SCAClientFactory. + */ + private static String discoverProviderFactoryImplClass(Properties properties, ClassLoader classLoader) throws SCARuntimeException { + String providerClassName = checkPropertiesForSPIClassName(properties); + if (providerClassName != null) { + return providerClassName; + } + + providerClassName = checkPropertiesForSPIClassName(System.getProperties()); + if (providerClassName != null) { + return providerClassName; + } + + return checkMETAINFServicesForClassName(classLoader); + } + + /** + * Attempts to find the class name for the SCAClientFactory implementation + * from the specified Properties. + * + * @return The class name for the SCAClientFactory implementation or + * null if not found. + */ + private static String checkPropertiesForSPIClassName(Properties properties) { + if (properties == null) { + return null; + } + + final String providerClassName = properties.getProperty(SCA_CLIENT_FACTORY_PROVIDER_KEY); + if (providerClassName != null && providerClassName.length() > 0) { + return providerClassName; + } + + return null; + } + + /** + * Attempts to find the class name for the SCAClientFactory implementation + * from the META-INF/services directory + * + * @return The class name for the SCAClientFactory implementation or + * null if not found. + */ + private static String checkMETAINFServicesForClassName(ClassLoader cl) { + final URL url = cl.getResource(SCA_CLIENT_FACTORY_PROVIDER_META_INF_SERVICE); + if (url == null) { + return null; + } + + InputStream in = null; + try { + in = url.openStream(); + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); + + String line; + while ((line = readNextLine(reader)) != null) { + if (!line.startsWith("#") && line.length() > 0) { + return line; + } + } + return null; + } finally { + closeStream(reader); + } + } catch (IOException ex) { + throw new SCARuntimeException("Failed to discover SCAClientFactory provider", ex); + } finally { + closeStream(in); + } + } + + /** + * Reads the next line from the reader and returns the trimmed version of + * that line + * + * @param reader The reader from which to read the next line + * @return The trimmed next line or null if the end of the + * stream has been reached + * @throws IOException I/O error occurred while reading from Reader + */ + private static String readNextLine(BufferedReader reader) throws IOException { + + String line = reader.readLine(); + if (line != null) { + line = line.trim(); + } + return line; + } + + /** + * Loads the specified SCAClientFactory implementation class. + * + * @param factoryImplClassName The name of the SCAClientFactory + * Implementation class to load + * @return The specified SCAClientFactory Implementation class + * @throws SCARuntimeException Failed to load the SCAClientFactory + * implementation class + */ + private static Class loadProviderFactoryClass(String factoryImplClassName, ClassLoader classLoader) + throws SCARuntimeException { + + try { + final Class providerClass = classLoader.loadClass(factoryImplClassName); + final Class providerFactoryClass = providerClass.asSubclass(SCAClientFactory.class); + return providerFactoryClass; + } catch (ClassNotFoundException ex) { + throw new SCARuntimeException("Failed to load SCAClientFactory implementation class " + factoryImplClassName, ex); + } catch (ClassCastException ex) { + throw new SCARuntimeException("Loaded SCAClientFactory implementation class " + factoryImplClassName + + " is not a subclass of " + + SCAClientFactory.class.getName(), ex); + } + } + + /** + * Instantiate an instance of the specified SCAClientFactory implementation + * class. + * + * @param factoryImplClass The SCAClientFactory implementation class to + * instantiate. + * @param domainURI + * @return An instance of the SCAClientFactory implementation class + * @throws SCARuntimeException Failed to instantiate the specified specified + * SCAClientFactory implementation class + */ + private static SCAClientFactory instantiateSCAClientFactoryClass(Class factoryImplClass, URI domainURI) throws SCARuntimeException { + + try { + final SCAClientFactory provider = factoryImplClass.getConstructor(URI.class).newInstance(domainURI); + return provider; + } catch (Throwable ex) { + ex.printStackTrace(); + throw new SCARuntimeException("Failed to instantiate SCAClientFactory implementation class " + factoryImplClass, ex); + } + } + + /** + * Utility method for closing Closeable Object. + * + * @param closeable The Object to close. + */ + private static void closeStream(Closeable closeable) { + if (closeable != null) { + try { + closeable.close(); + } catch (IOException ex) { + throw new SCARuntimeException("Failed to close stream", ex); + } + } + } +} -- cgit v1.2.3