diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-26 23:44:59 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-26 23:44:59 +0000 |
commit | 71a7cba384b8ae7f4578fb9ab1f725d5ce616074 (patch) | |
tree | 98bbc7c066d037a8d9ea1fea7a3ccfa64419ab11 /branches/sca-java-1.x/modules | |
parent | 01a38d872dc2692d2a31f07f9c8f8098aa078853 (diff) |
Merge all changes from 1.5.2 branch into trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@830026 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
83 files changed, 2024 insertions, 1640 deletions
diff --git a/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties b/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties index f0d5b0a201..6fd524716c 100644 --- a/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties +++ b/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties @@ -25,7 +25,6 @@ UnexpectedImplementationElement = Unexpected <implementation> element found. It PolicyImplValidationException = PolicyValidation exception when processing implementation of component {0} due to {1}. PolicyServiceValidationException = PolicyValidation exceptions when processing service/reference {0} in {1}. Error is {2} ContributionReadException = ContributionReadException occured due to : {0} -ContributionResolveException = ContributionResolveException occured due to : {0} ContributionWriteException = ContributionWriteException occured due to : {0} XMLStreamException = XMLStreamException occured due to : {0} HttpServerError = HTTP Server Error : {0} diff --git a/branches/sca-java-1.x/modules/assembly-xsd/src/main/resources/sca-implementation-jee.xsd b/branches/sca-java-1.x/modules/assembly-xsd/src/main/resources/sca-implementation-jee.xsd index 83e6bb75bf..a5a6220d83 100644 --- a/branches/sca-java-1.x/modules/assembly-xsd/src/main/resources/sca-implementation-jee.xsd +++ b/branches/sca-java-1.x/modules/assembly-xsd/src/main/resources/sca-implementation-jee.xsd @@ -1,23 +1,23 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.jee" type="sca:JEEImplementation" substitutionGroup="sca:implementation" />
- <complexType name="JEEImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded" />
- </sequence>
- <attribute name="archive" type="string" use="required" />
- <anyAttribute namespace="##any" processContents="lax" />
- </extension>
- </complexContent>
- </complexType>
+<?xml version="1.0" encoding="UTF-8"?> +<!-- (c) Copyright SCA Collaboration 2006 --> +<schema xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.osoa.org/xmlns/sca/1.0" + xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" + elementFormDefault="qualified"> + + <include schemaLocation="sca-core.xsd"/> + + <element name="implementation.jee" type="sca:JEEImplementation" substitutionGroup="sca:implementation" /> + <complexType name="JEEImplementation"> + <complexContent> + <extension base="sca:Implementation"> + <sequence> + <any namespace="##other" processContents="lax" minOccurs="0" + maxOccurs="unbounded" /> + </sequence> + <attribute name="archive" type="string" use="required" /> + <anyAttribute namespace="##any" processContents="lax" /> + </extension> + </complexContent> + </complexType> </schema>
\ No newline at end of file diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java index 1cf94ff527..70e873ecf0 100644 --- a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java +++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java @@ -62,7 +62,6 @@ public interface ConfiguredOperation extends Base, Cloneable, PolicySetAttachPoi * @param contractName the name of the contract to which this operation belongs
*/
void setContractName(String contractName);
-
/**
* Sets a list of policy sets.
diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java index 1158356012..5e984c3126 100644 --- a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java +++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java @@ -792,6 +792,19 @@ public abstract class BaseConfigurationBuilderImpl { * @param service */ private ComponentReference createCallbackReference(Component component, ComponentService service) { + return createCallbackReference(component, service, assemblyFactory); + } + + /** + * Create a callback reference for a component service + * + * @param component + * @param service + * @param assemblyFactory + */ + protected static ComponentReference createCallbackReference(Component component, + ComponentService service, + AssemblyFactory assemblyFactory) { ComponentReference componentReference = assemblyFactory.createComponentReference(); componentReference.setIsCallback(true); componentReference.setName(service.getName()); diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java index d73286f7ab..ce3f817acf 100644 --- a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java +++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.assembly.builder.impl; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.CompositeService; @@ -83,6 +84,11 @@ public class ComponentServicePromotionBuilderImpl implements CompositeBuilder { newComponentService.setCallback(assemblyFactory.createCallback()); newComponentService.getCallback().getBindings() .addAll(componentService.getCallback().getBindings()); + ComponentReference callbackReference = + BaseConfigurationBuilderImpl.createCallbackReference(promotedComponent, newComponentService, + assemblyFactory); + callbackReference.getBindings().addAll(componentService.getCallback().getBindings()); + newComponentService.setCallbackReference(callbackReference); } // Change the composite service to now promote the diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java index ea0e88ac24..38cbaf7744 100644 --- a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java +++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.assembly.builder.impl; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.CompositeService; @@ -64,6 +65,11 @@ public class CompositeServicePromotionBuilderImpl implements CompositeBuilder { newComponentService.setCallback(assemblyFactory.createCallback()); newComponentService.getCallback().getBindings() .addAll(compositeService.getCallback().getBindings()); + ComponentReference callbackReference = + BaseConfigurationBuilderImpl.createCallbackReference(promotedComponent, newComponentService, + assemblyFactory); + callbackReference.getBindings().addAll(compositeService.getCallback().getBindings()); + newComponentService.setCallbackReference(callbackReference); } // Change the composite service to now promote the newly diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java index 5f4f42bb15..9adfaa2c56 100644 --- a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java +++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java @@ -574,14 +574,15 @@ abstract class PolicyConfigurationUtil { // Create a new target configured operation and copy everything from the source
// except the intents and policy sets (which must be computed below).
try {
- targetConfOp = (ConfiguredOperation)sourceConfOp.clone();
+ targetConfOp = (ConfiguredOperation) sourceConfOp.clone();
targetConfOp.setRequiredIntents(new ArrayList<Intent>());
targetConfOp.setPolicySets(new ArrayList<PolicySet>());
} catch (CloneNotSupportedException e) {
// will not happen
- }
+ }
}
+
List<Intent> prunedIntents =
computeInheritableIntents(attachPoint.getType(), sourceConfOp.getRequiredIntents());
PolicyComputationUtils.addInheritedIntents(prunedIntents, targetConfOp.getRequiredIntents());
diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java index 6d8f986051..ca88e39750 100644 --- a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java +++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java @@ -88,7 +88,8 @@ public class ConfiguredOperationImpl extends BaseImpl implements ConfiguredOpera public List<PolicySet> getApplicablePolicySets() {
return applicablePolicySets;
}
-
+
+ @Override
public Object clone() throws CloneNotSupportedException {
// Note this is a shallow copy.
return super.clone();
diff --git a/branches/sca-java-1.x/modules/assembly/src/main/resources/assembly-validation-messages.properties b/branches/sca-java-1.x/modules/assembly/src/main/resources/assembly-validation-messages.properties index 6aeda18aab..e827f7e78a 100644 --- a/branches/sca-java-1.x/modules/assembly/src/main/resources/assembly-validation-messages.properties +++ b/branches/sca-java-1.x/modules/assembly/src/main/resources/assembly-validation-messages.properties @@ -55,8 +55,8 @@ WireSourceNotFound = Wire source not found : {0} WireIncompatibleInterface = Incompatible interfaces on wire source and target : source = {0} target = {1} ComponentIncompatibleInterface = Incompatible interfaces on component reference and target : reference = {0} target = {1} TooManyReferenceTargets = Too many targets on reference: {0} -ReferenceInterfaceNotSubSet = Interface of composite reference {0} must be compatible with the interface declared by promoted component reference. -ServiceInterfaceNotSubSet = Interface of composite service {0} must be subset of the interface declared by promoted component service. +ReferenceInterfaceNotSubSet = Interface of composite reference must be compatible with the interface declared by promoted component reference {0} +ServiceInterfaceNotSubSet = Interface of composite service must be a subset of the interface declared by promoted component service {0} NoComponentReferenceTarget = No target services found for the component reference to be autowired: {0} NoTypeForComponentProperty = No type specified on component property: Component = {0} Property = {1} URLSyntaxException = URLSyntaxException when creating binding URI at component = {0} service = {1} binding = {2}
\ No newline at end of file diff --git a/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Sort.java b/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Sort.java index 8b22dd3efa..19daa1fefb 100644 --- a/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Sort.java +++ b/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Sort.java @@ -1,38 +1,38 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom.aggregator;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-
-/**
- * The Sort service business interface.
- *
- * @version $Rev: 639931 $ $Date: 2008-03-21 18:13:05 -0700 (Fri, 21 Mar 2008) $
- */
-public interface Sort {
-
- /**
- * Sort feed entries by published date.
- * @param entries
- * @return
- */
- List<Entry> sort(List<Entry> entries);
-}
+/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.atom.aggregator; + +import java.util.List; + +import org.apache.tuscany.sca.data.collection.Entry; + +/** + * The Sort service business interface. + * + * @version $Rev$ $Date$ + */ +public interface Sort { + + /** + * Sort feed entries by published date. + * @param entries + * @return + */ + List<Entry> sort(List<Entry> entries); +} diff --git a/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/SortImpl.java b/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/SortImpl.java index 8745683f6e..e81f450626 100644 --- a/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/SortImpl.java +++ b/branches/sca-java-1.x/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/SortImpl.java @@ -1,62 +1,62 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom.aggregator;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.osoa.sca.annotations.Property;
-
-/**
- * Implementation of a Feed Sort service component.
- *
- * @version $Rev: 685663 $ $Date: 2008-08-13 13:11:20 -0700 (Wed, 13 Aug 2008) $
- */
-public class SortImpl implements Sort {
-
- @Property
- public boolean newFirst = true;
-
- @SuppressWarnings("unchecked")
- public List<Entry> sort(List<Entry> entries) {
- Entry[] entriesArray = new Entry[entries.size()];
- entriesArray = (Entry<String,Item>[])entries.toArray(entriesArray);
- Arrays.sort(entriesArray, new Comparator() {
- public int compare(final Object xObj, final Object yObj) {
- Entry x = (Entry) xObj;
- Entry y = (Entry) yObj;
- Item xItem = (Item) x.getData();
- Item yItem = (Item) y.getData();
- Date xDate = xItem.getDate();
- Date yDate = yItem.getDate();
- if (xDate == null)
- return -1;
- if (newFirst)
- return yDate.compareTo(xDate);
- else
- return xDate.compareTo(yDate);
- }
- });
- return Arrays.asList(entriesArray);
- }
-}
+/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.atom.aggregator; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; + +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.Item; +import org.osoa.sca.annotations.Property; + +/** + * Implementation of a Feed Sort service component. + * + * @version $Rev$ $Date$ + */ +public class SortImpl implements Sort { + + @Property + public boolean newFirst = true; + + @SuppressWarnings("unchecked") + public List<Entry> sort(List<Entry> entries) { + Entry[] entriesArray = new Entry[entries.size()]; + entriesArray = (Entry<String,Item>[])entries.toArray(entriesArray); + Arrays.sort(entriesArray, new Comparator() { + public int compare(final Object xObj, final Object yObj) { + Entry x = (Entry) xObj; + Entry y = (Entry) yObj; + Item xItem = (Item) x.getData(); + Item yItem = (Item) y.getData(); + Date xDate = xItem.getDate(); + Date yDate = yItem.getDate(); + if (xDate == null) + return -1; + if (newFirst) + return yDate.compareTo(xDate); + else + return xDate.compareTo(yDate); + } + }); + return Arrays.asList(entriesArray); + } +} diff --git a/branches/sca-java-1.x/modules/binding-atom-js/LICENSE b/branches/sca-java-1.x/modules/binding-atom-js/LICENSE index 6e529a25c4..8aa906c321 100644 --- a/branches/sca-java-1.x/modules/binding-atom-js/LICENSE +++ b/branches/sca-java-1.x/modules/binding-atom-js/LICENSE @@ -1,205 +1,205 @@ -
- 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.
-
-
-
+ + 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/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingInvoker.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingInvoker.java index dd748fec85..67cf01eca9 100644 --- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingInvoker.java +++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingInvoker.java @@ -139,8 +139,6 @@ class GdataBindingInvoker implements Invoker, DataExchangeSemantics { @SuppressWarnings("finally") @Override public Message invoke(Message msg) { - - //System.out.println("[Debug Info]GdataBindingInvoker.PostInvoker --- invoke method reached"); // Post an entry Object[] args = (Object[])msg.getBody(); com.google.gdata.data.Entry feedEntry = null; diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingListenerServlet.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingListenerServlet.java index 34d6ca85dc..facf3bb641 100644 --- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingListenerServlet.java +++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingListenerServlet.java @@ -39,7 +39,6 @@ import javax.servlet.http.HttpServletResponse; import javax.xml.namespace.QName; import org.apache.abdera.parser.ParseException; - import org.apache.commons.codec.binary.Base64; import org.apache.tuscany.sca.data.collection.Entry; import org.apache.tuscany.sca.databinding.Mediator; diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java index be4cc657f4..af7027ca90 100644 --- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java +++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java @@ -40,7 +40,6 @@ public class ConsumerProviderTestCase { public static void setUp() throws Exception { // Setup the local GData servlet (Service Binding test) scaDomainProvider = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/Provider.composite"); - //System.out.println("[Debug Info] Provider.composite ready..."); // Initialize the GData client service (Reference Binding test) scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/Consumer.composite"); diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java index 7fb7fa9fe2..5dc9c0079f 100644 --- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java +++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java @@ -97,7 +97,6 @@ public class CustomerClientImpl implements CustomerClient { entry.setTitle(new PlainTextConstruct(newTitle)); resourceCollection.put(entryID, entry); //System.out.println("!!! Updated entry with id=" + entry.getId() + " title=" + entry.getTitle()); - //System.out.println("\n"); } diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java index 0772bd67ee..9c4d118cd6 100644 --- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java +++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java @@ -139,5 +139,4 @@ public class CustomerCollectionImpl implements Collection { //System.out.println(">>> ResourceCollectionImpl.query collection "); return getFeed(); } - } diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java index e426e22ec9..9c3122e134 100644 --- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java +++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java @@ -39,7 +39,7 @@ public class GoogleCalendarServiceTestCase { private static SCADomain scaDomainConsumer = null; private static CustomerClient testService = null; - public GoogleCalendarServiceTestCase(){ + public GoogleCalendarServiceTestCase() { } @@ -83,8 +83,6 @@ public class GoogleCalendarServiceTestCase { Assert.assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText()); } - - @Test public void testClientPost() throws Exception { String blogEntryTitle = "titleByGoogleCalendarTestcase"; @@ -95,7 +93,6 @@ public class GoogleCalendarServiceTestCase { Assert.assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText()); } - @Test public void testClientDelete() throws Exception { diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java index e365595ff0..1f261dfc90 100644 --- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java +++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java @@ -58,7 +58,7 @@ public class GoogleContactsServiceTestCase { @Test public void testClientGetFeed() throws Exception { Feed feed = testService.clientGetFeed(); - //System.out.println("feed title: " + feed.getTitle().getPlainText()); + System.out.println("feed title: " + feed.getTitle().getPlainText()); Assert.assertEquals("Haibo Zhao's Contacts", feed.getTitle().getPlainText()); } @@ -69,7 +69,6 @@ public class GoogleContactsServiceTestCase { Entry contactEntry = testService.clientGetEntry(entryID); //System.out.println("Entry ID: " + contactEntry.getId()); Assert.assertTrue(contactEntry.getId().endsWith(entryID)); - //System.out.println("------------------------------------------------------------\n\n"); } diff --git a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java index 6a657d6736..459c2f6933 100644 --- a/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java +++ b/branches/sca-java-1.x/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java @@ -26,6 +26,7 @@ import junit.framework.Assert; import org.apache.tuscany.sca.host.embedded.SCADomain; import org.junit.AfterClass; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import com.google.gdata.client.Query; @@ -43,8 +44,6 @@ public class GoogleWebAlbumServiceTestCase { @BeforeClass public static void setUp() throws Exception { - //System.out.println("Method Test Start-----------------------------------------------------------------------"); - //Initialize the GData client service (Reference Binding test) scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/ConsumerGoogleWebAlbum.composite"); testService = scaDomainConsumer.getService(CustomerClient.class, "CustomerClient"); @@ -52,8 +51,7 @@ public class GoogleWebAlbumServiceTestCase { @AfterClass public static void tearDown(){ - //System.out.println("Method Test End------------------------------------------------------------------------"); - //System.out.println("\n\n"); + scaDomainConsumer.close(); } @Test @@ -103,6 +101,7 @@ public class GoogleWebAlbumServiceTestCase { @Test + @Ignore("Not testing anything") public void testClientDelete() throws Exception { //Tested and it worked, but only once because we can not delete the same entry twice diff --git a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml index 7a82f95da9..c87079dd54 100644 --- a/branches/sca-java-1.x/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml +++ b/branches/sca-java-1.x/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml @@ -51,7 +51,7 @@ <intent name="deliveryMode.nonPersistent"> <description> - Message are sent non-persistently + Message are sent persistently </description> </intent> diff --git a/branches/sca-java-1.x/modules/binding-jsonrpc-js/LICENSE b/branches/sca-java-1.x/modules/binding-jsonrpc-js/LICENSE index 6e529a25c4..8aa906c321 100644 --- a/branches/sca-java-1.x/modules/binding-jsonrpc-js/LICENSE +++ b/branches/sca-java-1.x/modules/binding-jsonrpc-js/LICENSE @@ -1,205 +1,205 @@ -
- 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.
-
-
-
+ + 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/branches/sca-java-1.x/modules/binding-jsonrpc-js/NOTICE b/branches/sca-java-1.x/modules/binding-jsonrpc-js/NOTICE index be5f8bfbae..25bb89c9b2 100644 --- a/branches/sca-java-1.x/modules/binding-jsonrpc-js/NOTICE +++ b/branches/sca-java-1.x/modules/binding-jsonrpc-js/NOTICE @@ -4,6 +4,3 @@ 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/uses JSON-RPC JavaScript client (jsonrpc.js) - Copyright (c) 2003-2004 Jan-Klaas Kollhof - Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd diff --git a/branches/sca-java-1.x/modules/binding-jsonrpc-runtime/NOTICE b/branches/sca-java-1.x/modules/binding-jsonrpc-runtime/NOTICE index a69a0d2601..25bb89c9b2 100644 --- a/branches/sca-java-1.x/modules/binding-jsonrpc-runtime/NOTICE +++ b/branches/sca-java-1.x/modules/binding-jsonrpc-runtime/NOTICE @@ -4,7 +4,3 @@ 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/uses JSON-RPC JavaScript client (jsonrpc.js) - Copyright (c) 2003-2004 Jan-Klaas Kollhof - Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd - diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data.java b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data.java new file mode 100644 index 0000000000..8c1e6b68da --- /dev/null +++ b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2.itests.pojo; + +//import java.io.Serializable; + +public class Data { + + private Data2[] a = null; + private int b = 0; + private float c = 0.0f; + + public Data2[] getA() { + return this.a; + } + + public void setA(Data2[] a) { + this.a = a; + } + + public int getB() { + return this.b; + } + + public void setB(int b) { + this.b = b; + } + + public float getC() { + return this.c; + } + + public void setC(float c) { + this.c = c; + } + +} diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data2.java b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data2.java new file mode 100644 index 0000000000..25954a0603 --- /dev/null +++ b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/Data2.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.binding.ws.axis2.itests.pojo; + +public class Data2 { + + private String[] asdf = null; + + public String[] getAsdf() { + return this.asdf; + } + + public void setAsdf(String[] asdf) { + this.asdf = asdf; + } + + +} diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/POJOWSTestCase.java b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/POJOWSTestCase.java new file mode 100644 index 0000000000..35849ef77b --- /dev/null +++ b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/POJOWSTestCase.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2.itests.pojo; + +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.Test; + +public class POJOWSTestCase { + + @Test + public void testWS() throws Exception { + + SCAContribution contrib = new SCAContribution("c1", "target/test-classes"); + SCANode node = SCANodeFactory.newInstance().createSCANode("org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/test.composite", contrib); + node.start(); + +// try { +// System.out.println("Test server started (press enter to shutdown)"); +// System.in.read(); +// } +// catch (IOException e) { +// System.err.println(e); +// e.printStackTrace(); +// } + + node.stop(); + System.out.println("Test server stopped"); + } + +} diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestService.java b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestService.java new file mode 100644 index 0000000000..2becc472b8 --- /dev/null +++ b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2.itests.pojo; + +import org.osoa.sca.annotations.Remotable; + + +@Remotable +public interface TestService { + + public boolean printData(Data data); + +} diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestServiceImpl.java b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestServiceImpl.java new file mode 100644 index 0000000000..1946d67d79 --- /dev/null +++ b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/TestServiceImpl.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.binding.ws.axis2.itests.pojo; + +import java.util.Arrays; + +import org.osoa.sca.annotations.Service; + +@Service(TestService.class) +public class TestServiceImpl implements TestService { + + public boolean printData(Data data) { + if (data == null) { + System.out.println("data is null"); + return false; + } + + StringBuilder sb = new StringBuilder(256); + sb.append("Data:\n"); + Data2[] a = data.getA(); + if (a != null) { + for (int i = 0; i < a.length; i++) { + sb.append(" a["); + sb.append(i); + sb.append("] = "); + sb.append(Arrays.asList(a[i].getAsdf())); + sb.append("\n"); + } + } else { + sb.append(" a = null"); + } + sb.append("\n b = "); + sb.append(data.getB()); + sb.append("\n c = "); + sb.append(data.getC()); + sb.append("\n"); + + System.out.println(sb.toString()); + + return true; + } + +} diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/package-info.java b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/package-info.java new file mode 100644 index 0000000000..7c8867530e --- /dev/null +++ b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/package-info.java @@ -0,0 +1,21 @@ +/* + * 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. + */ +// @javax.xml.bind.annotation.XmlSchema(namespace="http://test/server") +package org.apache.tuscany.sca.binding.ws.axis2.itests.pojo; + diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/test.composite b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/test.composite new file mode 100644 index 0000000000..029a5e3c65 --- /dev/null +++ b/branches/sca-java-1.x/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/test.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://test" + xmlns:hw="http://helloworld" + name="test"> + <component name="TestServiceComponent"> + <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.pojo.TestServiceImpl" /> + <service name="TestService"> + <interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.pojo.TestService" /> + <binding.ws uri="http://localhost:8085/testService"/> + </service> + </component> +</composite> + diff --git a/branches/sca-java-1.x/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java b/branches/sca-java-1.x/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java index e1243dbc6a..c44a08c67b 100644 --- a/branches/sca-java-1.x/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java +++ b/branches/sca-java-1.x/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java @@ -6,25 +6,22 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.contribution.java.impl; import java.io.IOException; -import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; @@ -49,12 +46,12 @@ import org.apache.tuscany.sca.extensibility.ServiceDiscovery; public class ClassLoaderModelResolver extends URLClassLoader implements ModelResolver { private Contribution contribution; private Map<String, ModelResolver> importResolvers = new HashMap<String, ModelResolver>(); - + private static ClassLoader parentClassLoader() { - ClassLoader parentClassLoader = ServiceDiscovery.getInstance().getServiceDiscoverer().getClass().getClassLoader(); + ClassLoader parentClassLoader = ServiceDiscovery.class.getClassLoader(); return parentClassLoader; } - + private static URL[] getContributionURLs(final Contribution contribution) throws IOException { List<URL> urls = new ArrayList<URL>(); urls.add(new URL(contribution.getLocation())); @@ -65,7 +62,7 @@ public class ClassLoaderModelResolver extends URLClassLoader implements ModelRes public ClassLoaderModelResolver(final Contribution contribution, ModelFactoryExtensionPoint modelFactories) throws IOException { super(getContributionURLs(contribution), parentClassLoader()); this.contribution = contribution; - + // Index Java import resolvers by package name Map<String, List<ModelResolver>> resolverMap = new HashMap<String, List<ModelResolver>>(); for (Import import_: this.contribution.getImports()) { @@ -79,7 +76,7 @@ public class ClassLoaderModelResolver extends URLClassLoader implements ModelRes resolvers.add(javaImport.getModelResolver()); } } - + // Create a delegating model resolver for each imported package for (Map.Entry<String, List<ModelResolver>> entry: resolverMap.entrySet()) { importResolvers.put(entry.getKey(), new DefaultDelegatingModelResolver(entry.getValue())); @@ -98,38 +95,38 @@ public class ClassLoaderModelResolver extends URLClassLoader implements ModelRes if (!(unresolved instanceof ClassReference)) { return unresolved; } - + try { - + // Load the class and return a class reference for it String className = ((ClassReference)unresolved).getClassName(); Class<?> clazz = Class.forName(className, true, this); return modelClass.cast(new ClassReference(clazz)); - + } catch (ClassNotFoundException e) { return unresolved; } catch (NoClassDefFoundError e) { return unresolved; } } - + @Override public URL findResource(String name) { - + //TODO delegate to the Java import resolvers - + URL url = super.findResource(name); return url; } @Override public Enumeration<URL> findResources(String name) throws IOException { - + //TODO delegate to the Java import resolvers //Enumeration<URL> importedResources; - + Enumeration<URL> resources = super.findResources(name); - List<URL> allResources = new ArrayList<URL>(); + List<URL> allResources = new ArrayList<URL>(); //for (; importedResources.hasMoreElements(); ) { // allResources.add(importedResources.nextElement()); //} @@ -138,10 +135,10 @@ public class ClassLoaderModelResolver extends URLClassLoader implements ModelRes } return Collections.enumeration(allResources); } - + @Override protected Class<?> findClass(String name) throws ClassNotFoundException { - + // Extract the package name int d = name.lastIndexOf('.'); String packageName; @@ -150,7 +147,7 @@ public class ClassLoaderModelResolver extends URLClassLoader implements ModelRes } else { packageName = null; } - + // First try to load the class using the Java import resolvers ModelResolver importResolver = importResolvers.get(packageName); if (importResolver != null) { @@ -164,5 +161,5 @@ public class ClassLoaderModelResolver extends URLClassLoader implements ModelRes Class<?> clazz = super.findClass(name); return clazz; } - + } diff --git a/branches/sca-java-1.x/modules/contribution-jee-impl/pom.xml b/branches/sca-java-1.x/modules/contribution-jee-impl/pom.xml index 057e5394e7..3442beb923 100644 --- a/branches/sca-java-1.x/modules/contribution-jee-impl/pom.xml +++ b/branches/sca-java-1.x/modules/contribution-jee-impl/pom.xml @@ -63,19 +63,35 @@ <version>1.6-SNAPSHOT</version> </dependency> + <!-- TUSCANY-3165 Waiting for 3.0.2 to be released so + reverting to 3.0.1 for now. JEE itest will no work on + windows due to this <dependency> <groupId>org.apache.openejb</groupId> <artifactId>openejb-core</artifactId> - <version>3.0.1</version> + <version>3.0.2-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.openejb</groupId> <artifactId>openejb-jee</artifactId> + <version>3.0.2-SNAPSHOT</version> + </dependency> + --> + + <dependency> + <groupId>org.apache.openejb</groupId> + <artifactId>openejb-core</artifactId> <version>3.0.1</version> </dependency> <dependency> + <groupId>org.apache.openejb</groupId> + <artifactId>openejb-jee</artifactId> + <version>3.0.1</version> + </dependency> + + <dependency> <groupId>org.codehaus.woodstox</groupId> <artifactId>wstx-asl</artifactId> <version>3.2.4</version> diff --git a/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java b/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java index 4e0e58e6a1..9a84d88340 100644 --- a/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java +++ b/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java @@ -43,7 +43,6 @@ import org.apache.tuscany.sca.databinding.impl.Group2GroupTransformer; import org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint; import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSFaultExceptionMapper; import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor; import org.apache.tuscany.sca.interfacedef.java.jaxws.WebServiceInterfaceProcessor; import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint; @@ -61,9 +60,8 @@ public class DataBindingModuleActivator implements ModuleActivator { XMLAdapterExtensionPoint xmlAdapterExtensionPoint = registry.getExtensionPoint(XMLAdapterExtensionPoint.class); xmlAdapterExtensionPoint.addAdapter(CallableReference.class, CallableReferenceXMLAdapter.class); xmlAdapterExtensionPoint.addAdapter(OMElement.class, OMElementXMLAdapter.class); - FaultExceptionMapper faultExceptionMapper = new JAXWSFaultExceptionMapper(dataBindings, xmlAdapterExtensionPoint); - registry.getExtensionPoint(UtilityExtensionPoint.class).addUtility(faultExceptionMapper); - + FaultExceptionMapper faultExceptionMapper = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(FaultExceptionMapper.class); + Mediator mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class); Input2InputTransformer input2InputTransformer = new Input2InputTransformer(); diff --git a/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java b/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java index 0fa1d27d2a..0b3c043340 100644 --- a/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java +++ b/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java @@ -56,6 +56,25 @@ public class CglibProxyFactory implements ProxyFactory { return createProxy(serviceReference); } + private class CglibClassLoader extends ClassLoader { + private ClassLoader appLoader; + private ClassLoader bundleLoader; + + @Override + public Class<?> loadClass(String className) + throws ClassNotFoundException { + try { + return appLoader.loadClass(className); + } catch (ClassNotFoundException ex ) { + return bundleLoader.loadClass(className); + } + } + + CglibClassLoader(ClassLoader app, ClassLoader bundle) { + this.appLoader = app; + this.bundleLoader = bundle; + } + } /** * create the proxy with cglib. use the same JDKInvocationHandler as * JDKProxyService. @@ -63,6 +82,8 @@ public class CglibProxyFactory implements ProxyFactory { public <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException { Enhancer enhancer = new Enhancer(); Class<T> interfaze = callableReference.getBusinessInterface(); + ClassLoader cl = new CglibClassLoader(interfaze.getClassLoader(), getClass().getClassLoader()); + enhancer.setClassLoader(cl); enhancer.setSuperclass(interfaze); enhancer.setCallback(new CglibMethodInterceptor<T>(callableReference)); Object proxy = enhancer.create(); diff --git a/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java b/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java index 1112d02b7e..b591ccedd6 100644 --- a/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java +++ b/branches/sca-java-1.x/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java @@ -33,7 +33,7 @@ public class SCAProxy extends Proxy // This is a cache containing the proxy class constructor for each business interface.
// This improves performance compared to calling Proxy.newProxyInstance()
// every time that a proxy is needed.
- private static WeakHashMap cache = new WeakHashMap<Class, Object>();
+ private static WeakHashMap cache = new WeakHashMap<String, Object>();
public static Object newProxyInstance(ClassLoader classloader, Class aclass[], InvocationHandler invocationhandler)
throws IllegalArgumentException
@@ -44,13 +44,13 @@ public class SCAProxy extends Proxy // Lookup cached constructor. aclass[0] is the reference's business interface.
Constructor proxyCTOR;
synchronized(cache) {
- proxyCTOR = (Constructor) cache.get(aclass[0]);
+ proxyCTOR = (Constructor) cache.get(aclass[0].hashCode());
}
if(proxyCTOR == null) {
Class proxyClass = getProxyClass(classloader, aclass);
proxyCTOR = proxyClass.getConstructor(constructorParams);
synchronized(cache){
- cache.put(aclass[0],proxyCTOR);
+ cache.put(aclass[0].hashCode(),proxyCTOR);
}
}
return proxyCTOR.newInstance(new Object[] { invocationhandler });
diff --git a/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java b/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java index 695722be18..ada0c94a8d 100644 --- a/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java +++ b/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java @@ -138,16 +138,26 @@ public final class SDOContextHelper { } try { Type type = helperContext.getTypeHelper().getType(javaType); - if (type != null && (!type.isDataType())) { + return register(helperContext, type); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public static boolean register(HelperContext helperContext, Type type) { + if (type != null && (!type.isDataType())) { + try { Method method = type.getClass().getMethod("getEPackage"); Object factory = method.invoke(type, new Object[] {}); method = factory.getClass().getMethod("register", HelperContext.class); method.invoke(factory, new Object[] {helperContext}); return true; + } catch (Exception e) { + e.printStackTrace(); + return false; } + } else { return false; - } catch (Exception e) { - throw new TransformationException(e); } } diff --git a/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java b/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java index 0b58be9e41..39e9ffc161 100644 --- a/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java +++ b/branches/sca-java-1.x/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java @@ -69,7 +69,7 @@ public class SDODataBinding extends BaseDataBinding { } }); - Type type = context.getTypeHelper().getType(javaType); + final Type type = context.getTypeHelper().getType(javaType); if (type == null) { // FIXME: Need a better to test dynamic SDO if (DataObject.class.isAssignableFrom(javaType)) { @@ -92,10 +92,12 @@ public class SDODataBinding extends BaseDataBinding { public Object run() { if (context == SDOContextHelper.getDefaultHelperContext()) { HelperContext newContext = SDOUtil.createHelperContext(); - SDOContextHelper.register(newContext, javaType); + SDOContextHelper.register(newContext, type); if (operation != null) { operation.getInputType().setMetaData(HelperContext.class, newContext); } + } else { + SDOContextHelper.register(context, type); } return null; } diff --git a/branches/sca-java-1.x/modules/endpoint/pom.xml b/branches/sca-java-1.x/modules/endpoint/pom.xml index a77f1fee9a..ddcf178a76 100644 --- a/branches/sca-java-1.x/modules/endpoint/pom.xml +++ b/branches/sca-java-1.x/modules/endpoint/pom.xml @@ -50,27 +50,22 @@ <version>1.6-SNAPSHOT</version> </dependency> - <dependency> + <dependency> <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-contribution-impl</artifactId> + <artifactId>tuscany-core</artifactId> <version>1.6-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-contribution-xml</artifactId> - <version>1.6-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-core</artifactId> + <artifactId>tuscany-binding-sca</artifactId> <version>1.6-SNAPSHOT</version> + <scope>test</scope> </dependency> - <dependency> + <dependency> <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-binding-sca</artifactId> + <artifactId>tuscany-workspace-impl</artifactId> <version>1.6-SNAPSHOT</version> <scope>test</scope> </dependency> @@ -94,14 +89,7 @@ <artifactId>tuscany-monitor</artifactId> <version>1.6-SNAPSHOT</version> <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-workspace-impl</artifactId> - <version>1.6-SNAPSHOT</version> - <scope>test</scope> - </dependency> + </dependency> <dependency> <groupId>org.easymock</groupId> diff --git a/branches/sca-java-1.x/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxServiceDiscoveryActivator.java b/branches/sca-java-1.x/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxServiceDiscoveryActivator.java index 1cb1d09f8d..fa137daa16 100644 --- a/branches/sca-java-1.x/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxServiceDiscoveryActivator.java +++ b/branches/sca-java-1.x/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxServiceDiscoveryActivator.java @@ -28,7 +28,7 @@ import org.osgi.framework.BundleContext; /** * The Bundle Activator that creates the Equinox-based service discoverer * - * @version $Rev: $ $Date: $ + * @version $Rev$ $Date$ */ public class EquinoxServiceDiscoveryActivator implements BundleActivator { private static Logger logger = Logger.getLogger(EquinoxServiceDiscoveryActivator.class.getName()); diff --git a/branches/sca-java-1.x/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameService.java b/branches/sca-java-1.x/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameService.java index 74dd0fdc97..0a437f9ae9 100644 --- a/branches/sca-java-1.x/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameService.java +++ b/branches/sca-java-1.x/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameService.java @@ -188,10 +188,10 @@ public class TransientNameService { } catch (Throwable e) { // Ignore } - + // Call destroy after close the acceptors // In JDK 1.6u14 or later, destroy clean up the acceptors but it doesn't close them - createdOrb.destroy(); + createdOrb.destroy(); createdOrb = null; } } diff --git a/branches/sca-java-1.x/modules/host-embedded/pom.xml b/branches/sca-java-1.x/modules/host-embedded/pom.xml index cdd06580b8..3ede75bc6f 100644 --- a/branches/sca-java-1.x/modules/host-embedded/pom.xml +++ b/branches/sca-java-1.x/modules/host-embedded/pom.xml @@ -105,7 +105,14 @@ <artifactId>tuscany-host-http</artifactId> <version>1.6-SNAPSHOT</version> <scope>compile</scope> - </dependency> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-endpoint</artifactId> + <version>1.6-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> </dependencies> diff --git a/branches/sca-java-1.x/modules/host-webapp/pom.xml b/branches/sca-java-1.x/modules/host-webapp/pom.xml index e7feac7caa..de8a945ce5 100644 --- a/branches/sca-java-1.x/modules/host-webapp/pom.xml +++ b/branches/sca-java-1.x/modules/host-webapp/pom.xml @@ -49,6 +49,22 @@ </dependency> <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.1.1</version> + <exclusions> + <exclusion> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </exclusion> + <exclusion> + <groupId>avalon-framework</groupId> + <artifactId>avalon-framework</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.4</version> <!-- to keep compatible with older servlet containers --> @@ -62,22 +78,6 @@ <scope>provided</scope> </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.1.1</version> - <exclusions> - <exclusion> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - </exclusion> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> <build> diff --git a/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java b/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java index aaeea34219..f301082d59 100644 --- a/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java +++ b/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java @@ -21,7 +21,6 @@ package org.apache.tuscany.sca.implementation.bpel.ode.provider; import java.lang.reflect.InvocationTargetException; import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; import javax.transaction.SystemException; import javax.transaction.TransactionManager; @@ -56,11 +55,8 @@ import org.w3c.dom.Element; * @version $Rev$ $Date$ */ public class BPELInvoker implements Invoker { - private final static long TIME_OUT = 2000L; - protected final Log __log = LogFactory.getLog(getClass()); - private EmbeddedODEServer odeServer; private TransactionManager txMgr; @@ -155,8 +151,7 @@ public class BPELInvoker implements Invoker { // Waiting until the reply is ready in case the engine needs to continue in a different thread if (onhold != null) { try { - //add timeout to avoid blocking when there is a exception/failure - onhold.get(TIME_OUT, TimeUnit.MILLISECONDS); + onhold.get(); } catch (Exception e) { throw new InvocationTargetException(e,"Error invoking BPEL process : " + e.getMessage()); } diff --git a/branches/sca-java-1.x/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java b/branches/sca-java-1.x/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java index 2365298f71..e5fa399bf6 100644 --- a/branches/sca-java-1.x/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java +++ b/branches/sca-java-1.x/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.implementation.java.impl; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; +import java.lang.ref.WeakReference; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -36,8 +37,8 @@ import java.lang.reflect.Type; public class JavaElementImpl { private AnnotatedElement anchor; private ElementType elementType; - private Class<?> type; - private Type genericType; + private WeakReference<Class<?>> type; + private WeakReference<Type> genericType; private int index = -1; private String name; private Class<? extends Annotation> classifer; @@ -51,24 +52,24 @@ public class JavaElementImpl { public JavaElementImpl(Class<?> cls) { this.anchor = cls; this.elementType = ElementType.TYPE; - this.type = cls; - this.genericType = cls; + this.type = new WeakReference<Class<?>>(cls); + this.genericType = new WeakReference<Type>(cls); this.name = cls.getName(); } public JavaElementImpl(Field field) { this.anchor = field; this.elementType = ElementType.FIELD; - this.type = field.getType(); - this.genericType = field.getGenericType(); + this.type = new WeakReference<Class<?>>(field.getType()); + this.genericType = new WeakReference<Type>(field.getGenericType()); this.name = field.getName(); } public JavaElementImpl(Constructor<?> constructor, int index) { this.anchor = constructor; this.elementType = ElementType.PARAMETER; - this.type = constructor.getParameterTypes()[index]; - this.genericType = constructor.getGenericParameterTypes()[index]; + this.type = new WeakReference<Class<?>>(constructor.getParameterTypes()[index]); + this.genericType = new WeakReference<Type>(constructor.getGenericParameterTypes()[index]); this.index = index; this.name = ""; } @@ -76,8 +77,8 @@ public class JavaElementImpl { public JavaElementImpl(Method method, int index) { this.anchor = method; this.elementType = ElementType.PARAMETER; - this.type = method.getParameterTypes()[index]; - this.genericType = method.getGenericParameterTypes()[index]; + this.type = new WeakReference<Class<?>>(method.getParameterTypes()[index]); + this.genericType = new WeakReference<Type>(method.getGenericParameterTypes()[index]); this.index = index; this.name = ""; } @@ -92,7 +93,7 @@ public class JavaElementImpl { */ public JavaElementImpl(String name, Class<?> type, Class<? extends Annotation> classifer) { super(); - this.type = type; + this.type = new WeakReference<Class<?>>(type); this.name = name; this.classifer = classifer; } @@ -115,7 +116,7 @@ public class JavaElementImpl { * @return the genericType */ public Type getGenericType() { - return genericType; + return genericType.get(); } /** @@ -129,7 +130,7 @@ public class JavaElementImpl { * @return the type */ public Class<?> getType() { - return type; + return type.get(); } public Annotation[] getAnnotations() { diff --git a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java index c579915970..6e8f1e8df4 100644 --- a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java +++ b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java @@ -20,6 +20,7 @@ package org.apache.tuscany.sca.implementation.spring.runtime.context;
import java.net.URL;
+import java.util.Iterator;
import java.util.List;
import org.apache.tuscany.sca.implementation.spring.processor.ComponentNameAnnotationProcessor;
@@ -30,11 +31,17 @@ import org.apache.tuscany.sca.implementation.spring.processor.PropertyAnnotation import org.apache.tuscany.sca.implementation.spring.processor.PropertyValueStub;
import org.apache.tuscany.sca.implementation.spring.processor.ReferenceAnnotationProcessor;
import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.config.ConstructorArgumentValues;
+import org.springframework.beans.factory.config.TypedStringValue;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.support.ManagedList;
import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.UrlResource;
import org.springframework.core.SpringVersion;
@@ -51,11 +58,35 @@ public class SpringContextTie { private SpringImplementationStub implementation;
private boolean isAnnotationSupported;
private String versionSupported;
+ private boolean isMultipleContextSupport;
- public SpringContextTie(SpringImplementationStub implementation, List<URL> resource, boolean annotationSupport, String versionSupported) throws Exception {
+ // TUSCANY-3128
+ // extension of the generic application context just to force the classloader
+ // on the bean factory to stay set to the contribution classloader
+ // instead of being set back to the application classloader
+ private class LocalGenericApplicationContext extends GenericApplicationContext{
+
+ ClassLoader classloader = null;
+
+ public LocalGenericApplicationContext(DefaultListableBeanFactory beanFactory,
+ ApplicationContext parent,
+ ClassLoader classloader) {
+ super(beanFactory, parent);
+ this.classloader = classloader;
+ }
+
+ @Override
+ protected void postProcessBeanFactory(
+ ConfigurableListableBeanFactory beanFactory) {
+ beanFactory.setBeanClassLoader(classloader);
+ }
+ }
+
+ public SpringContextTie(SpringImplementationStub implementation, URL resource, boolean annotationSupport, String versionSupported, boolean multipleContextSupport) throws Exception {
this.implementation = implementation;
this.isAnnotationSupported = annotationSupport;
this.versionSupported = versionSupported;
+ this.isMultipleContextSupport = multipleContextSupport;
if (! this.versionSupported.equals("ANY")) {
if ((SpringVersion.getVersion()!= null) && (! SpringVersion.getVersion().equals(versionSupported)))
throw new RuntimeException("Unsupported version: Use only Spring Framework Version " + versionSupported);
@@ -81,36 +112,63 @@ public class SpringContextTie { /**
* Create appropriate ApplicationContext by reading the bean definitions.
*/
- private AbstractApplicationContext createApplicationContext(SCAParentApplicationContext scaParentContext, List<URL> resources) {
+ private AbstractApplicationContext createApplicationContext(SCAParentApplicationContext scaParentContext, URL resource) {
- XmlBeanFactory beanFactory = null;
- AbstractApplicationContext appContext = null;
-
- if (resources.size() > 1)
- {
- GenericApplicationContext appCtx =
- new SCAGenericApplicationContext(scaParentContext, implementation.getClassLoader());
- XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(appCtx);
- for (URL resource : resources) {
- xmlReader.loadBeanDefinitions(new UrlResource(resource));
- }
- xmlReader.setBeanClassLoader(implementation.getClassLoader());
- if (isAnnotationSupported)
- includeAnnotationProcessors(appCtx.getBeanFactory());
- return appCtx;
-
- } else {
- beanFactory = new XmlBeanFactory(new UrlResource(resources.get(0)));
- beanFactory.setBeanClassLoader(implementation.getClassLoader());
- }
+ XmlBeanFactory beanFactory = new XmlBeanFactory(new UrlResource(resource));
+ beanFactory.setBeanClassLoader(implementation.getClassLoader());
+ AbstractApplicationContext appContext = null;
+
+ if (isMultipleContextSupport) {
+ for (String bean : beanFactory.getBeanDefinitionNames()) {
+ String beanClassName = (beanFactory.getType(bean)).getName();
+ // Using FileSystemXmlApplicationContext is not supported, as the
+ // SCA runtime does not support paths relative to current VM working directory.
+ /*if (beanClassName.indexOf(".FileSystemXmlApplicationContext") != -1) {
+ throw new RuntimeException("Usage of FileSystemXmlApplicationContext Bean is not supported");
+ }*/
+
+ if (beanClassName.indexOf(".ClassPathXmlApplicationContext") != -1) {
+ BeanDefinition beanDef = beanFactory.getBeanDefinition(bean);
+ String[] configLocations = null;
+ List<ConstructorArgumentValues.ValueHolder> conArgs =
+ beanDef.getConstructorArgumentValues().getGenericArgumentValues();
+ for (ConstructorArgumentValues.ValueHolder conArg : conArgs) {
+ if (conArg.getValue() instanceof TypedStringValue) {
+ TypedStringValue value = (TypedStringValue) conArg.getValue();
+ if (value.getValue().indexOf(".xml") != -1)
+ configLocations = new String[]{value.getValue()};
+ }
+ if (conArg.getValue() instanceof ManagedList) {
+ Iterator itml = ((ManagedList)conArg.getValue()).iterator();
+ StringBuffer values = new StringBuffer();
+ while (itml.hasNext()) {
+ TypedStringValue next = (TypedStringValue)itml.next();
+ if (next.getValue().indexOf(".xml") != -1) {
+ values.append(implementation.getClassLoader().getResource(next.getValue()).toString());
+ values.append("~");
+ }
+ }
+ configLocations = (values.toString()).split("~");
+ }
+ }
+
+ appContext = new ClassPathXmlApplicationContext(configLocations, true, scaParentContext);
+ if (isAnnotationSupported)
+ includeAnnotationProcessors(appContext.getBeanFactory());
+ return appContext;
+ }
+ }
+ }
// use the generic application context as default
- if (isAnnotationSupported) {
+ if (isAnnotationSupported)
+ {
includeAnnotationProcessors(beanFactory);
- }
- appContext = new SCAGenericApplicationContext(beanFactory,
- scaParentContext,
- implementation.getClassLoader());
+ }
+
+ appContext = new LocalGenericApplicationContext(beanFactory,
+ scaParentContext,
+ implementation.getClassLoader());
return appContext;
}
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java index 61b707b1e1..bee0e462fc 100644 --- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java +++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java @@ -44,7 +44,7 @@ public class SpringImplementation extends ImplementationImpl implements Implemen // The location attribute which points to the Spring application-context XML file
private String location;
// The application-context file as a Spring Resource
- private List<URL> resource;
+ private URL resource;
private ComponentType componentType;
// Mapping of Services to Beans
private Hashtable<String, SpringBeanElement> serviceMap;
@@ -78,11 +78,11 @@ public class SpringImplementation extends ImplementationImpl implements Implemen return;
}
- public void setResource(List<URL> resource) {
+ public void setResource(URL resource) {
this.resource = resource;
}
- public List<URL> getResource() {
+ public URL getResource() {
return resource;
}
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java index 3b73ba00c1..54d42937db 100644 --- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java +++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java @@ -90,19 +90,22 @@ public class SpringXMLComponentTypeLoader { private AssemblyFactory assemblyFactory;
private JavaInterfaceFactory javaFactory;
private PolicyFactory policyFactory;
+ private boolean isMultipleContextSupported;
private SpringBeanIntrospector beanIntrospector;
public SpringXMLComponentTypeLoader(ModelFactoryExtensionPoint factories,
AssemblyFactory assemblyFactory,
JavaInterfaceFactory javaFactory,
- PolicyFactory policyFactory) {
+ PolicyFactory policyFactory,
+ boolean multipleContextSupport) {
super();
this.assemblyFactory = assemblyFactory;
this.javaFactory = javaFactory;
this.policyFactory = policyFactory;
this.contributionFactory = factories.getFactory(ContributionFactory.class);
this.xmlInputFactory = factories.getFactory(XMLInputFactory.class);
+ this.isMultipleContextSupported = multipleContextSupport;
}
protected Class<SpringImplementation> getImplementationClass() {
@@ -156,25 +159,23 @@ public class SpringXMLComponentTypeLoader { List<SpringSCAPropertyElement> scaproperties = new ArrayList<SpringSCAPropertyElement>();
URL resource;
- List<URL> contextResources = new ArrayList<URL>();
+
String contextPath = implementation.getLocation();
try {
resource = resolveLocation(resolver, contextPath);
- contextResources = getApplicationContextResource(resource);
+ resource = getApplicationContextResource(resource);
implementation.setClassLoader(new ContextClassLoader(resolver));
- implementation.setResource(contextResources);
+ implementation.setResource(resource);
// The URI is used to uniquely identify the Implementation
implementation.setURI(resource.toString());
+ reader = xmlInputFactory.createXMLStreamReader(resource.openStream());
+
+ // System.out.println("Spring TypeLoader - starting to read context file");
+ readContextDefinition(resolver, reader, contextPath, beans, services, references, scaproperties);
- for (URL contextResource : contextResources) {
- reader = xmlInputFactory.createXMLStreamReader(contextResource.openStream());
- // System.out.println("Spring TypeLoader - starting to read context file");
- readContextDefinition(resolver, reader, contextPath, beans, services, references, scaproperties);
-
- reader.close();
- }
+ reader.close();
} catch (IOException e) {
throw new ContributionReadException(e);
@@ -218,7 +219,7 @@ public class SpringXMLComponentTypeLoader { private XMLStreamReader getApplicationContextReader(ModelResolver resolver, String location) throws ContributionReadException {
try {
- URL resource = getApplicationContextResource(resolveLocation(resolver, location)).get(0);
+ URL resource = getApplicationContextResource(resolveLocation(resolver, location));
XMLStreamReader reader =
xmlInputFactory.createXMLStreamReader(resource.openStream());
return reader;
@@ -341,6 +342,13 @@ public class SpringXMLComponentTypeLoader { if (reader.getAttributeValue(null, "value") != null) {
String value = reader.getAttributeValue(null, "value");
constructorArg.addValue(value);
+ if ((isMultipleContextSupported) && (value.indexOf(".xml") != -1)) {
+ if (bean.getClassName().indexOf(".ClassPathXmlApplicationContext") != -1) {
+ XMLStreamReader creader = getApplicationContextReader(resolver, value);
+ // Read the context definition for the constructor-arg resources
+ readContextDefinition(resolver, creader, contextPath, beans, services, references, scaproperties);
+ }
+ }
}
bean.addCustructorArgs(constructorArg);
} else if (SpringImplementationConstants.REF_ELEMENT.equals(qname)) {
@@ -352,8 +360,17 @@ public class SpringXMLComponentTypeLoader { } else if (SpringImplementationConstants.VALUE_ELEMENT.equals(qname)) {
String value = reader.getElementText();
// Check if the parent element is a constructor-arg
- if (constructorArg != null)
+ if (constructorArg != null) {
constructorArg.addValue(value);
+ // Identify the XML resource specified for the constructor-arg element
+ if ((isMultipleContextSupported) && (value.indexOf(".xml") != -1)) {
+ if (bean.getClassName().indexOf(".ClassPathXmlApplicationContext") != -1) {
+ XMLStreamReader creader = getApplicationContextReader(resolver, value);
+ // Read the context definition for the constructor-arg resources
+ readContextDefinition(resolver, creader, contextPath, beans, services, references, scaproperties);
+ }
+ }
+ }
} // end if
break;
case END_ELEMENT:
@@ -555,9 +572,9 @@ public class SpringXMLComponentTypeLoader { Class<?> interfaze = resolveClass(resolver, paramType);
// Create a component type reference/property if the constructor-arg element has a
// type attribute OR index attribute declared...
- if ((conArgElement.getType() != null && paramType.equals(conArgElement.getType())) ||
+ if ((conArgElement.getType() != null && paramType.equals(conArgElement.getType())) ||
(conArgElement.getIndex() != -1 && (conArgElement.getIndex() == parameter.getIndex())))
- {
+ {
if (parameter.getClassifer().getName().equals("org.osoa.sca.annotations.Reference")) {
Reference theReference = createReference(interfaze, conArgElement.getRef());
componentType.getReferences().add(theReference);
@@ -653,19 +670,19 @@ public class SpringXMLComponentTypeLoader { * @param locationAttr - the location attribute from the <implementation.spring../> element
* @param cl - the ClassLoader for the Spring implementation
*/
- protected List<URL> getApplicationContextResource(URL url)
+ protected URL getApplicationContextResource(URL url)
throws ContributionReadException {
File manifestFile = null;
File appXmlFile;
File locationFile = null;
- List<URL> appCtxResources = new ArrayList<URL>();
if (url != null) {
String path = url.getPath();
locationFile = new File(path);
} else {
- throw new ContributionReadException("SpringXMLComponentTypeLoader getApplicationContextResource: "
- + "unable to find resource file " + url);
+ throw new ContributionReadException(
+ "SpringXMLLoader getApplicationContextResource: " + "unable to find resource file "
+ + url);
}
if (locationFile.isDirectory()) {
@@ -675,26 +692,21 @@ public class SpringXMLComponentTypeLoader { Manifest mf = new Manifest(new FileInputStream(manifestFile));
Attributes mainAttrs = mf.getMainAttributes();
String appCtxPath = mainAttrs.getValue("Spring-Context");
- if (appCtxPath != null) {
- String[] cxtPaths = appCtxPath.split(";");
- for (String path : cxtPaths) {
- appXmlFile = new File(locationFile, path);
- if (appXmlFile.exists()) {
- appCtxResources.add(appXmlFile.toURI().toURL());
- }
- }
- return appCtxResources;
+ if (appCtxPath != null) {
+ appXmlFile = new File(locationFile, appCtxPath);
+ if (appXmlFile.exists()) {
+ return appXmlFile.toURL();
+ }
}
}
// no manifest-specified Spring context, use default
appXmlFile = new File(locationFile, "META-INF" + File.separator + "spring"
+ File.separator + SpringImplementationConstants.APPLICATION_CONTEXT);
if (appXmlFile.exists()) {
- appCtxResources.add(appXmlFile.toURI().toURL());
- return appCtxResources;
+ return appXmlFile.toURL();
}
} catch (IOException e) {
- throw new ContributionReadException("Error reading manifest " + manifestFile);
+ throw new ContributionReadException("Error reading manifest inside the folder: ", e);
}
} else {
if (locationFile.isFile() && locationFile.getName().endsWith(".jar")) {
@@ -706,22 +718,18 @@ public class SpringXMLComponentTypeLoader { Attributes mainAttrs = mf.getMainAttributes();
String appCtxPath = mainAttrs.getValue("Spring-Context");
if (appCtxPath != null) {
- String[] cxtPaths = appCtxPath.split(";");
- for (String path : cxtPaths) {
- je = jf.getJarEntry(path);
- if (je != null) {
- appCtxResources.add(new URL("jar:" + locationFile.toURI().toURL() + "!/" + appCtxPath));
- }
- }
- return appCtxResources;
+ je = jf.getJarEntry(appCtxPath);
+ if (je != null) {
+ // TODO return a Spring specific Resource type for jars
+ return new URL("jar:" + locationFile.toURI().toURL() + "!/" + appCtxPath);
+ }
}
}
// Look for the default applicaiton-context.xml file, when MANIFEST.MF is absent.
je = jf.getJarEntry("META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
if (je != null) {
- appCtxResources.add(new URL("jar:" + locationFile.toURI().toURL() + "!/" +
- "META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT));
- return appCtxResources;
+ return new URL("jar:" + locationFile.toURI().toURL() + "!/" +
+ "META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
}
} catch (IOException e) {
// TODO: create a more appropriate exception type
@@ -731,14 +739,13 @@ public class SpringXMLComponentTypeLoader { }
else {
if (locationFile.getName().endsWith(".xml")) {
- appCtxResources.add(url);
- return appCtxResources;
+ return url;
}
else {
// Deal with the directory inside a jar file, in case the contribution itself is a JAR file.
try {
if (locationFile.getPath().indexOf(".jar") > 0) {
- String jarPath = url.getPath().substring(6, url.getPath().indexOf("!"));
+ String jarPath = url.getPath().substring(5, url.getPath().indexOf("!"));
JarFile jf = new JarFile(jarPath);
JarEntry je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2)
+ "/" + "META-INF" + "/" + "MANIFEST.MF");
@@ -747,34 +754,29 @@ public class SpringXMLComponentTypeLoader { Attributes mainAttrs = mf.getMainAttributes();
String appCtxPath = mainAttrs.getValue("Spring-Context");
if (appCtxPath != null) {
- String[] cxtPaths = appCtxPath.split(";");
- for (String path : cxtPaths) {
- je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2) + "/" + path);
- if (je != null) {
- appCtxResources.add(new URL("jar:" + url.getPath() + "/" + path));
- return appCtxResources;
- }
- }
+ je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2) + "/" + appCtxPath);
+ if (je != null) {
+ return new URL("jar:" + url.getPath() + "/" + appCtxPath);
+ }
}
}
// Look for the default applicaiton-context.xml file, when MANIFEST.MF is absent.
je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2) + "/" +
"META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
if (je != null) {
- appCtxResources.add(new URL("jar:" + url.getPath() + "/" +
- "META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT));
- return appCtxResources;
+ return new URL("jar:" + url.getPath() + "/" +
+ "META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
}
}
} catch (IOException e) {
- throw new ContributionReadException("Error reading manifest " + manifestFile);
+ throw new ContributionReadException("Error reading manifest inside the jar folder: ", e);
}
}
}
}
- throw new ContributionReadException("SpringXMLComponentTypeLoader getApplicationContextResource: "
- + "unable to read resource file " + url);
+ throw new ContributionReadException("SpringXMLLoader getApplicationContextResource: "
+ + "META-INF/spring/" + SpringImplementationConstants.APPLICATION_CONTEXT + " not found");
} // end method getApplicationContextResource
/**
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ConfigurationPropertiesExtensionPoint.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ConfigurationPropertiesExtensionPoint.java index 0464355565..4fdcb52241 100644 --- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ConfigurationPropertiesExtensionPoint.java +++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ConfigurationPropertiesExtensionPoint.java @@ -4,6 +4,8 @@ public interface ConfigurationPropertiesExtensionPoint { boolean isAnnotationSupported();
+ boolean isMultipleContextSupported();
+
String getSupportedVersion();
}
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java index a0e7186eab..94b8e0eb36 100644 --- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java +++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java @@ -8,11 +8,17 @@ public class DefaultConfigurationPropertiesExtensionPoint implements Configurati }
// By default SCA annotations for implementation.spring
- // will be supproted.
+ // will be supproted for Tuscany.
public boolean isAnnotationSupported() {
return true;
}
+ // By default multiple application context implementation.spring
+ // will be supproted for Tuscany.
+ public boolean isMultipleContextSupported() {
+ return true;
+ }
+
// By defauly all the Spring version are supported for
// Tuscany.
public String getSupportedVersion() {
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java index 290bbff171..818bc4e102 100644 --- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java +++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java @@ -22,7 +22,7 @@ package org.apache.tuscany.sca.implementation.spring.invocation; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.List;
+import java.net.URL;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
@@ -47,9 +47,10 @@ public class SpringContextStub { ProxyFactory proxyService,
JavaPropertyValueObjectFactory propertyValueObjectFactory,
boolean annotationSupport,
- String versionSupported) {
+ String versionSupported,
+ boolean multipleContextSupport) {
- initTie(component, implementation, propertyValueObjectFactory, annotationSupport, versionSupported);
+ initTie(component, implementation, propertyValueObjectFactory, annotationSupport, versionSupported, multipleContextSupport);
}
@@ -57,7 +58,8 @@ public class SpringContextStub { SpringImplementation implementation,
JavaPropertyValueObjectFactory propertyValueObjectFactory,
boolean annotationSupport,
- String versionSupported) {
+ String versionSupported,
+ boolean multipleContextSupport) {
// TODO: what class loader to use?
ClassLoader cl = Thread.currentThread().getContextClassLoader();
@@ -69,8 +71,8 @@ public class SpringContextStub { Object stub = stubConstructor.newInstance(new SpringImplementationTie(implementation, component, propertyValueObjectFactory));
Class<?> tieClass = Class.forName("org.apache.tuscany.sca.implementation.spring.runtime.context.SpringContextTie", true, cl);
- Constructor<?> tieConstructor = tieClass.getConstructor(new Class<?>[]{stubClass, List.class, boolean.class, String.class});
- this.tie = tieConstructor.newInstance(stub, implementation.getResource(), annotationSupport, versionSupported);
+ Constructor<?> tieConstructor = tieClass.getConstructor(new Class<?>[]{stubClass, URL.class, boolean.class, String.class, boolean.class});
+ this.tie = tieConstructor.newInstance(stub, implementation.getResource(), annotationSupport, versionSupported, multipleContextSupport);
this.startMethod = tieClass.getMethod("start");
this.closeMethod = tieClass.getMethod("close");
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java index 1fc01b2627..105bb4a553 100644 --- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java +++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java @@ -52,13 +52,14 @@ public class SpringImplementationProvider implements ImplementationProvider { ProxyFactory proxyService,
JavaPropertyValueObjectFactory propertyValueObjectFactory,
boolean annotationSupport,
- String versionSupported) {
+ String versionSupported,
+ boolean multipleContextSupport) {
super();
this.implementation = implementation;
this.component = component;
this.propertyValueObjectFactory = propertyValueObjectFactory;
- springContext = new SpringContextStub(component, implementation, proxyService, propertyValueObjectFactory, annotationSupport, versionSupported);
+ springContext = new SpringContextStub(component, implementation, proxyService, propertyValueObjectFactory, annotationSupport, versionSupported, multipleContextSupport);
} // end constructor
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java index 4796aa0de9..e0d31203bc 100644 --- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java +++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java @@ -41,6 +41,7 @@ public class SpringImplementationProviderFactory implements ImplementationProvid private ConfigurationPropertiesExtensionPoint configProperties;
private boolean annotationSupport;
private String versionSupported;
+ private boolean multipleContextSupport;
/**
* Simple constructor
@@ -58,6 +59,7 @@ public class SpringImplementationProviderFactory implements ImplementationProvid }
annotationSupport = configProperties.isAnnotationSupported();
versionSupported = configProperties.getSupportedVersion();
+ multipleContextSupport = configProperties.isMultipleContextSupported();
// TODO: could the runtime have a default PropertyValueObjectFactory?
propertyFactory = new JavaPropertyValueObjectFactory(new MediatorImpl(extensionPoints));
@@ -77,7 +79,8 @@ public class SpringImplementationProviderFactory implements ImplementationProvid proxyFactory,
propertyFactory,
annotationSupport,
- versionSupported);
+ versionSupported,
+ multipleContextSupport);
}
/**
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java index 1d941e2a4f..29dc0a38a1 100644 --- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java +++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java @@ -39,11 +39,13 @@ import org.apache.tuscany.sca.contribution.service.ContributionResolveException; import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
import org.apache.tuscany.sca.implementation.spring.introspect.SpringXMLComponentTypeLoader;
+import org.apache.tuscany.sca.implementation.spring.invocation.ConfigurationPropertiesExtensionPoint;
+import org.apache.tuscany.sca.implementation.spring.invocation.DefaultConfigurationPropertiesExtensionPoint;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.Problem;
import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl; +import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
import org.apache.tuscany.sca.policy.PolicyFactory;
/**
@@ -63,9 +65,11 @@ public class SpringImplementationProcessor implements StAXArtifactProcessor<Spri private JavaInterfaceFactory javaFactory;
private PolicyFactory policyFactory;
private PolicyAttachPointProcessor policyProcessor;
+ private ConfigurationPropertiesExtensionPoint configProperties;
private Monitor monitor;
-
+
private ModelFactoryExtensionPoint factories;
+ private boolean multipleContextSupport;
public SpringImplementationProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) {
this.factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
@@ -73,6 +77,12 @@ public class SpringImplementationProcessor implements StAXArtifactProcessor<Spri this.javaFactory = factories.getFactory(JavaInterfaceFactory.class);
this.policyFactory = factories.getFactory(PolicyFactory.class);
this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+
+ this.configProperties = extensionPoints.getExtensionPoint(ConfigurationPropertiesExtensionPoint.class);
+ if (configProperties == null) {
+ configProperties = new DefaultConfigurationPropertiesExtensionPoint();
+ }
+ this.multipleContextSupport = configProperties.isMultipleContextSupported();
this.monitor = monitor;
}
@@ -197,7 +207,7 @@ public class SpringImplementationProcessor implements StAXArtifactProcessor<Spri /* Load the Spring component type by reading the Spring application context */
SpringXMLComponentTypeLoader springLoader =
- new SpringXMLComponentTypeLoader(factories, assemblyFactory, javaFactory, policyFactory);
+ new SpringXMLComponentTypeLoader(factories, assemblyFactory, javaFactory, policyFactory, multipleContextSupport);
try {
// Load the Spring Implementation information from its application context file...
springLoader.load(springImplementation, resolver);
diff --git a/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/store.html b/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/store.html index 95b0d10a15..fc6375b547 100644 --- a/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/store.html +++ b/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/store.html @@ -1,127 +1,127 @@ -<!--
- * 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.
--->
-<html>
-<head>
-<title>Store</TITLE>
-
-<!-- one js include per sca component -->
-<script type="text/javascript" src="store.js"></script>
-
-<script language="JavaScript">
-
- //@Reference
- var catalog = new tuscany.sca.Reference("Catalog");
-
- //@Reference
+<!-- + * 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. +--> +<html> +<head> +<title>Store</TITLE> + +<!-- one js include per sca component --> +<script type="text/javascript" src="store.js"></script> + +<script language="JavaScript"> + + //@Reference + var catalog = new tuscany.sca.Reference("Catalog"); + + //@Reference var shoppingCart = new tuscany.sca.Reference("ShoppingCart"); //@Property - var locale = Property("locale");
-
- function catalog_getResponse(items,exception) {
- if(exception){
- alert(exception.message);
- return;
- }
- var catalog = "";
- for (var i=0; i<items.length; i++)
- catalog += '<input name="items" type="checkbox" value="' +
- items[i] + '">' + items[i]+ ' <br>';
- document.getElementById('catalog').innerHTML=catalog;
- }
-
- function shoppingCart_getResponse(feed) {
- if (feed != null) {
- var entries = feed.getElementsByTagName("entry");
- var list = "";
- for (var i=0; i<entries.length; i++) {
- var item = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- list += item + ' <br>';
- }
- document.getElementById("shoppingCart").innerHTML = list;
- document.getElementById('total').innerHTML = feed.getElementsByTagName("subtitle")[0].firstChild.nodeValue;
- }
- }
- function shoppingCart_postResponse(entry) {
- shoppingCart.get("", shoppingCart_getResponse);
- }
-
-
- function addToCart() {
- var items = document.catalogForm.items;
- var j = 0;
- for (var i=0; i<items.length; i++)
- if (items[i].checked) {
- var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>cart-item</title><content type="text">'+items[i].value+'</content></entry>'
- shoppingCart.post(entry, shoppingCart_postResponse);
- items[i].checked = false;
- }
- }
- function checkoutCart() {
- document.getElementById('store').innerHTML='<h2>' +
- 'Thanks for Shopping With Us!</h2>'+
- '<h2>Your Order</h2>'+
- '<form name="orderForm" action="/ufs/store.html">'+
- document.getElementById('shoppingCart').innerHTML+
- '<br>'+
- document.getElementById('total').innerHTML+
- '<br>'+
- '<br>'+
- '<input type="submit" value="Continue Shopping">'+
- '</form>';
- shoppingCart.del("", null);
- }
- function deleteCart() {
- shoppingCart.del("", null);
- document.getElementById('shoppingCart').innerHTML = "";
- document.getElementById('total').innerHTML = "";
- }
+ var locale = Property("locale"); + + function catalog_getResponse(items,exception) { + if(exception){ + alert(exception.message); + return; + } + var catalog = ""; + for (var i=0; i<items.length; i++) + catalog += '<input name="items" type="checkbox" value="' + + items[i] + '">' + items[i]+ ' <br>'; + document.getElementById('catalog').innerHTML=catalog; + } + + function shoppingCart_getResponse(feed) { + if (feed != null) { + var entries = feed.getElementsByTagName("entry"); + var list = ""; + for (var i=0; i<entries.length; i++) { + var item = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue; + list += item + ' <br>'; + } + document.getElementById("shoppingCart").innerHTML = list; + document.getElementById('total').innerHTML = feed.getElementsByTagName("subtitle")[0].firstChild.nodeValue; + } + } + function shoppingCart_postResponse(entry) { + shoppingCart.get("", shoppingCart_getResponse); + } + + + function addToCart() { + var items = document.catalogForm.items; + var j = 0; + for (var i=0; i<items.length; i++) + if (items[i].checked) { + var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>cart-item</title><content type="text">'+items[i].value+'</content></entry>' + shoppingCart.post(entry, shoppingCart_postResponse); + items[i].checked = false; + } + } + function checkoutCart() { + document.getElementById('store').innerHTML='<h2>' + + 'Thanks for Shopping With Us!</h2>'+ + '<h2>Your Order</h2>'+ + '<form name="orderForm" action="/ufs/store.html">'+ + document.getElementById('shoppingCart').innerHTML+ + '<br>'+ + document.getElementById('total').innerHTML+ + '<br>'+ + '<br>'+ + '<input type="submit" value="Continue Shopping">'+ + '</form>'; + shoppingCart.del("", null); + } + function deleteCart() { + shoppingCart.del("", null); + document.getElementById('shoppingCart').innerHTML = ""; + document.getElementById('total').innerHTML = ""; + } + + //alert(locale); + catalog.get(catalog_getResponse); + shoppingCart.get("", shoppingCart_getResponse); +</script> + +</head> - //alert(locale);
- catalog.get(catalog_getResponse);
- shoppingCart.get("", shoppingCart_getResponse);
-</script>
-
-</head>
-
-<body>
-<h1>Store</h1>
- <div id="store">
- <h2>Catalog</h2>
- <form name="catalogForm">
- <div id="catalog" ></div>
- <br>
- <input type="button" onClick="addToCart()" value="Add to Cart">
- </form>
-
- <br>
-
- <h2>Your Shopping Cart</h2>
- <form name="shoppingCartForm">
- <div id="shoppingCart"></div>
- <br>
- <div id="total"></div>
- <br>
- <input type="button" onClick="checkoutCart()" value="Checkout">
- <input type="button" onClick="deleteCart()" value="Empty">
- <a href="../ShoppingCart/">(feed)</a>
- </form>
- </div>
-</body>
+<body> +<h1>Store</h1> + <div id="store"> + <h2>Catalog</h2> + <form name="catalogForm"> + <div id="catalog" ></div> + <br> + <input type="button" onClick="addToCart()" value="Add to Cart"> + </form> + + <br> + + <h2>Your Shopping Cart</h2> + <form name="shoppingCartForm"> + <div id="shoppingCart"></div> + <br> + <div id="total"></div> + <br> + <input type="button" onClick="checkoutCart()" value="Checkout"> + <input type="button" onClick="deleteCart()" value="Empty"> + <a href="../ShoppingCart/">(feed)</a> + </form> + </div> +</body> </html> diff --git a/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/storeJS.html b/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/storeJS.html index 2e3d76d9a3..c8026f8b24 100644 --- a/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/storeJS.html +++ b/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/storeJS.html @@ -1,152 +1,152 @@ -<!--
- * 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.
--->
-<html>
-<head>
-<title>Store</TITLE>
-
-<!-- one js include per sca component -->
-<!-- For Atom, the Tuscany JavaScript client includes the model for Atom.
- Using this JavaScript model, users can use syntax such as:
- item += "name=" + entry.getName() + ", price=" + entry.getContent()
- rather than
- item += entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- -->
-<script type="text/javascript" src="storeJS.js"></script>
-
-<script language="JavaScript">
-
- //@Reference
- var catalog = new tuscany.sca.Reference("Catalog");
-
- //@Reference
+<!-- + * 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. +--> +<html> +<head> +<title>Store</TITLE> + +<!-- one js include per sca component --> +<!-- For Atom, the Tuscany JavaScript client includes the model for Atom. + Using this JavaScript model, users can use syntax such as: + item += "name=" + entry.getName() + ", price=" + entry.getContent() + rather than + item += entries[i].getElementsByTagName("content")[0].firstChild.nodeValue; + --> +<script type="text/javascript" src="storeJS.js"></script> + +<script language="JavaScript"> + + //@Reference + var catalog = new tuscany.sca.Reference("Catalog"); + + //@Reference var shoppingCart = new tuscany.sca.Reference("ShoppingCart"); //@Property - var locale = Property("locale");
-
- function catalog_getResponse(items,exception) {
- if(exception){
- alert(exception.message);
- return;
- }
- var catalog = "";
- for (var i=0; i<items.length; i++)
- catalog += '<input name="items" type="checkbox" value="' +
- items[i] + '">' + items[i]+ ' <br>';
- document.getElementById('catalog').innerHTML=catalog;
- }
-
- function shoppingCart_getResponse(feedDoc) {
- // var xmlString = new XMLSerializer().serializeToString(feedDoc);
- // alert("shoppingCart_getResponse feed xml=" + xmlString);
- var feed = new Feed( feedDoc );
-
- if (feed != null) {
- // var entries = feed.getElementsByTagName("entry");
- var entries = feed.getEntries();
- var list = "";
- for (var i=0; i<entries.length; i++) {
- // var item = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- var item = entries[ i ].getContent().getText();
- list += item + ' <br>';
- }
- document.getElementById("shoppingCart").innerHTML = list;
- // document.getElementById('total').innerHTML = feed.getElementsByTagName("subtitle")[0].firstChild.nodeValue;
- var text = feed.getSubtitle().getText();
- document.getElementById('total').innerHTML = text;
- }
- }
-
- function shoppingCart_postResponse(entry) {
- shoppingCart.get("", shoppingCart_getResponse);
- }
-
- function addToCart() {
- var items = document.catalogForm.items;
- var j = 0;
- for (var i=0; i<items.length; i++)
- if (items[i].checked) {
- var entry = new Entry( "cart-item" );
- entry.setContent( items[i].value );
- var entryXML = entry.toXML();
- var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>cart-item</title><content type="text">'+items[i].value+'</content></entry>'
- shoppingCart.post(entry, shoppingCart_postResponse);
- items[i].checked = false;
- }
- }
-
- function checkoutCart() {
- document.getElementById('store').innerHTML='<h2>' +
- 'Thanks for Shopping With Us!</h2>'+
- '<h2>Your Order</h2>'+
- '<form name="orderForm" action="/ufs/store.html">'+
- document.getElementById('shoppingCart').innerHTML+
- '<br>'+
- document.getElementById('total').innerHTML+
- '<br>'+
- '<br>'+
- '<input type="submit" value="Continue Shopping">'+
- '</form>';
- shoppingCart.del("", null);
- }
- function deleteCart() {
- shoppingCart.del("", null);
- document.getElementById('shoppingCart').innerHTML = "";
- document.getElementById('total').innerHTML = "";
- }
- function testFeedtoXML() {
- if(exception){
- alert(exception.message);
- return;
- }
- document.getElementById('results').innerHTML = text;
- }
-
- //alert(locale);
- catalog.get(catalog_getResponse);
- shoppingCart.get("", shoppingCart_getResponse);
-</script>
-
-</head>
-
-<body>
-<h1>Store</h1>
- <div id="store">
- <h2>Catalog</h2>
- <form name="catalogForm">
- <div id="catalog" ></div>
- <br>
- <input type="button" onClick="addToCart()" value="Add to Cart">
- </form>
-
- <br>
-
- <h2>Your Shopping Cart</h2>
- <form name="shoppingCartForm">
- <div id="shoppingCart"></div>
- <br>
- <div id="total"></div>
- <br>
- <input type="button" onClick="checkoutCart()" value="Checkout">
- <input type="button" onClick="deleteCart()" value="Empty">
- <a href="../ShoppingCart/">(feed)</a>
- </form>
- </div>
-</body>
+ var locale = Property("locale"); + + function catalog_getResponse(items,exception) { + if(exception){ + alert(exception.message); + return; + } + var catalog = ""; + for (var i=0; i<items.length; i++) + catalog += '<input name="items" type="checkbox" value="' + + items[i] + '">' + items[i]+ ' <br>'; + document.getElementById('catalog').innerHTML=catalog; + } + + function shoppingCart_getResponse(feedDoc) { + // var xmlString = new XMLSerializer().serializeToString(feedDoc); + // alert("shoppingCart_getResponse feed xml=" + xmlString); + var feed = new Feed( feedDoc ); + + if (feed != null) { + // var entries = feed.getElementsByTagName("entry"); + var entries = feed.getEntries(); + var list = ""; + for (var i=0; i<entries.length; i++) { + // var item = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue; + var item = entries[ i ].getContent().getText(); + list += item + ' <br>'; + } + document.getElementById("shoppingCart").innerHTML = list; + // document.getElementById('total').innerHTML = feed.getElementsByTagName("subtitle")[0].firstChild.nodeValue; + var text = feed.getSubtitle().getText(); + document.getElementById('total').innerHTML = text; + } + } + + function shoppingCart_postResponse(entry) { + shoppingCart.get("", shoppingCart_getResponse); + } + + function addToCart() { + var items = document.catalogForm.items; + var j = 0; + for (var i=0; i<items.length; i++) + if (items[i].checked) { + var entry = new Entry( "cart-item" ); + entry.setContent( items[i].value ); + var entryXML = entry.toXML(); + var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>cart-item</title><content type="text">'+items[i].value+'</content></entry>' + shoppingCart.post(entry, shoppingCart_postResponse); + items[i].checked = false; + } + } + + function checkoutCart() { + document.getElementById('store').innerHTML='<h2>' + + 'Thanks for Shopping With Us!</h2>'+ + '<h2>Your Order</h2>'+ + '<form name="orderForm" action="/ufs/store.html">'+ + document.getElementById('shoppingCart').innerHTML+ + '<br>'+ + document.getElementById('total').innerHTML+ + '<br>'+ + '<br>'+ + '<input type="submit" value="Continue Shopping">'+ + '</form>'; + shoppingCart.del("", null); + } + function deleteCart() { + shoppingCart.del("", null); + document.getElementById('shoppingCart').innerHTML = ""; + document.getElementById('total').innerHTML = ""; + } + function testFeedtoXML() { + if(exception){ + alert(exception.message); + return; + } + document.getElementById('results').innerHTML = text; + } + + //alert(locale); + catalog.get(catalog_getResponse); + shoppingCart.get("", shoppingCart_getResponse); +</script> + +</head> + +<body> +<h1>Store</h1> + <div id="store"> + <h2>Catalog</h2> + <form name="catalogForm"> + <div id="catalog" ></div> + <br> + <input type="button" onClick="addToCart()" value="Add to Cart"> + </form> + + <br> + + <h2>Your Shopping Cart</h2> + <form name="shoppingCartForm"> + <div id="shoppingCart"></div> + <br> + <div id="total"></div> + <br> + <input type="button" onClick="checkoutCart()" value="Checkout"> + <input type="button" onClick="deleteCart()" value="Empty"> + <a href="../ShoppingCart/">(feed)</a> + </form> + </div> +</body> </html> diff --git a/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/unitTests.html b/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/unitTests.html index 352dd85508..14ead9f467 100644 --- a/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/unitTests.html +++ b/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/content/unitTests.html @@ -1,250 +1,250 @@ -<!--
- * 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.
--->
-<html>
-<head>
-<title>Atom JavaScript Client Unit Tests</title>
-
-<!-- Include Tuscany JavaScript client model for Atom.
- Using this JavaScript model, users can use syntax such as:
- item += "name=" + entry.getName() + ", price=" + entry.getContent()
- rather than
- item += entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- -->
-<script type="text/javascript" src="atomModel.js"></script>
-
-<script language="JavaScript">
-
- function testUritoXML() {
- var test = new Uri( "http://example.org/edit/first-post.atom" );
- var text = text.toXML();
- alert( "Uri=" + text );
- }
-
- function testEmailtoXML() {
- var test = new Email( "john.doe@ibm.com" );
- var text = test.toXML();
- alert( "Email=" + text );
- }
-
- function testIdtoXML() {
- var test = new Id( "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a" );
- var text = test.toXML();
- alert( "Id=" + text );
- }
-
- function testLogotoXML() {
- var test = new Logo( "goofyGraphic.png" );
- var text = test.toXML();
- alert( "Logo=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testTexttoXML() {
- var test = new Text( "This is ordinary text." );
- var text = test.toXML();
- alert( "Text=" + text );
- var test = new Text( "This is <b>HTML</b> text.", "html" );
- var text = test.toXML( "supertext" );
- alert( "Text=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testPersontoXML() {
- var test = new Person( "John Doe", "john.doe@ibm.com" );
- var text = test.toXML();
- alert( "Person=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testGeneratortoXML() {
- var test = new Generator( "Power Station", "http://www.powerstation.com" );
- var text = test.toXML();
- alert( "Generator=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testCategorytoXML() {
- var test = new Category( "CategoryXYZ", "http://www.site.com/?category=CategoryXYZ" );
- var text = test.toXML();
- alert( "Category=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testLinktoXML() {
- var test = new Link( "http://example.org/edit/first-post.atom", "edit" );
- var text = test.toXML();
- alert( "Link=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testEntrytoXML() {
- // <?xml version="1.0"?>
- // <entry xmlns="http://www.w3.org/2005/Atom">
- // <title>Atom-Powered Robots Run Amok</title>
- // <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
- // <updated>2003-12-13T18:30:02Z</updated>
- // <author><name>John Doe</name></author>
- // <content>Some text.</content>
- // <link rel="edit" href="http://example.org/edit/first-post.atom"/>
- // </entry>
-
- var entry = new Entry();
- entry.setNamespace( "http://www.w3.org/2005/Atom" );
- entry.setTitle( "Atom-Powered Robots Run Amok" );
- entry.setId( "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a" );
- entry.setUpdated( "2003-12-13T18:30:02Z" );
- entry.setContent( "Some text." );
- entry.addAuthor( new Person( "John Doe" ) );
- entry.addAuthor( new Person( "Mark Pilgrim", "f8dy@example.com" ));
- entry.addContributor( new Person( "Sam Ruby" ));
- entry.addContributor( new Person( "Joe Gregorio" ));
- entry.addLink( new Link( "http://example.org/edit/first-post.atom", "edit" ));
- var text = entry.toXML();
-
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testFeedtoXML() {
- // <feed xmlns="http://www.w3.org/2005/Atom">
- // <title type="text">dive into mark</title>
- // <subtitle type="html">A <em>lot</em> of effort went into making this effortless </subtitle>
- // <updated>2005-07-31T12:29:29Z</updated>
- // <id>tag:example.org,2003:3</id>
- // <link rel="alternate" type="text/html" hreflang="en" href="http://example.org/"/>
- // <link rel="self" type="application/atom+xml" href="http://example.org/feed.atom"/>
- // <rights>Copyright (c) 2003, Mark Pilgrim</rights>
- // <generator uri="http://www.example.com/" version="1.0">Example Toolkit</generator>
- // <entry>
- // <title>Atom draft-07 snapshot</title>
- // <link rel="alternate" type="text/html" href="http://example.org/2005/04/02/atom"/>
- // <link rel="enclosure" type="audio/mpeg" length="1337" href="http://example.org/audio/ph34r_my_podcast.mp3"/>
- // <id>tag:example.org,2003:3.2397</id>
- // <updated>2005-07-31T12:29:29Z</updated>
- // <published>2003-12-13T08:29:29-04:00</published>
- // <author><name>Mark Pilgrim</name><uri>http://example.org/</uri><email>f8dy@example.com</email></author>
- // <contributor><name>Sam Ruby</name></contributor>
- // <contributor><name>Joe Gregorio</name></contributor>
- // <content type="xhtml" xml:lang="en" xml:base="http://diveintomark.org/">
- // <div xmlns="http://www.w3.org/1999/xhtml">
- // <p><i>[Update: The Atom draft is finished.]</i></p>
- // </div>
- // </content>
- // </entry>
- // <entry>
- // <title>Dan Becker's Triathlon Site - Best Hills In Austin</title>
- // <category term="triathlons"/>
- // <id>tag:www.io.com,2008-09-05:/~beckerdo/triathlons/besthills.html</id>
- // <link href="http://www.io.com/~beckerdo/triathlons/besthills.html"/>
- // <published>2008-09-05T14:09:32-05:00</published>
- // <updated>2008-09-06T08:49:12-05:00</updated>
- // <summary type='html'>
- // <a href='http://www.io.com/~beckerdo/triathlons/besthills.html'><img src='http://www.io.com/~beckerdo/pictures/LittleDan25.png' width='25' height='25' alt='Little Dan' align='left'></a>
- // A description and Google maps of the best running and biking hills in Austin, Texas.
- // </summary>
- // </entry>
- // </feed>
-
- var feed = new Feed( "Dive into Mark" );
- feed.setSubtitle( new Text( "A <em>lot</em> of effort went into making this effortless", "html" ));
- feed.setUpdated( "2005-07-31T12:29:29Z" );
- feed.setId( "tag:example.org,2003:3" );
- var link = new Link( "http://example.org", "alternate" );
- link.setMimeType( "text/html" );
- link.setHRefLang( "en" );
- feed.addLink( link );
- feed.addLink( new Link( "http://example.org/feed.atom", "self" ));
- feed.setRights( "Copyright (c) 2003, Mark Pilgrim" );
- feed.setGenerator( new Generator( "Example Toolkit", "http://www.example.com/" ));
- feed.addAuthor( new Person( "Mark Pilgrim", "f8dy@example.com" ));
- feed.addContributor( new Person( "Sam Ruby" ));
- feed.addContributor( new Person( "Joe Gregorio" ));
- // <entry>
- // <title>Atom draft-07 snapshot</title>
- // <link rel="alternate" type="text/html" href="http://example.org/2005/04/02/atom"/>
- // <link rel="enclosure" type="audio/mpeg" length="1337" href="http://example.org/audio/ph34r_my_podcast.mp3"/>
- // <id>tag:example.org,2003:3.2397</id>
- // <updated>2005-07-31T12:29:29Z</updated>
- // <published>2003-12-13T08:29:29-04:00</published>
- // <author><name>Mark Pilgrim</name><uri>http://example.org/</uri><email>f8dy@example.com</email></author>
- // <contributor><name>Sam Ruby</name></contributor>
- // <contributor><name>Joe Gregorio</name></contributor>
- // <content type="xhtml" xml:lang="en" xml:base="http://diveintomark.org/">
- // <div xmlns="http://www.w3.org/1999/xhtml">
- // <p><i>[Update: The Atom draft is finished.]</i></p>
- // </div>
- // </content>
- // </entry>
- // <entry>
- // <title>Dan Becker's Triathlon Site - Best Hills In Austin</title>
- // <category term="triathlons"/>
- // <id>tag:www.io.com,2008-09-05:/~beckerdo/triathlons/besthills.html</id>
- // <link href="http://www.io.com/~beckerdo/triathlons/besthills.html"/>
- // <published>2008-09-05T14:09:32-05:00</published>
- // <updated>2008-09-06T08:49:12-05:00</updated>
- // <summary type='html'>
- // <a href='http://www.io.com/~beckerdo/triathlons/besthills.html'><img src='http://www.io.com/~beckerdo/pictures/LittleDan25.png' width='25' height='25' alt='Little Dan' align='left'></a>
- // A description and Google maps of the best running and biking hills in Austin, Texas.
- // </summary>
- // </entry>
- // </feed>
- var entry = new Entry( "Dan Becker's Triathlon Site - Best Hills In Austin" );
- entry.addCategory( new Category( "running" ));
- entry.addCategory( new Category( "triathlons" ));
- entry.setId( "tag:www.io.com,2008-09-05:/~beckerdo/triathlons/besthills.html" );
- entry.addLink( new Link ( "http://www.io.com/~beckerdo/triathlons/besthills.html" ));
- entry.setPublished( "2008-09-05T14:09:32-05:00" );
- entry.setUpdated( "2008-09-06T08:49:12-05:00" );
- entry.setSummary( new Text (
- "<a href='http://www.io.com/~beckerdo/triathlons/besthills.html'><img src='http://www.io.com/~beckerdo/pictures/LittleDan25.png' width='25' height='25' alt='Little Dan' align='left'></a>\n" +
- "A description and Google maps of the best running and biking hills in Austin, Texas.", "html" ));
- feed.addEntry( entry );
-
- var text = feed.toXML();
- alert( "Feed xml=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function removeBrackets( input ) {
- input = input.replace( /</g, "<" ); // replaceAll
- input = input.replace( />/g, ">" ); // replaceAll
- return input;
- }
-</script>
-</head>
-
-<body>
-<h1>Atom JavaScript Client Unit Tests</h1>
-<p>This document tests the serialization and deserialization of the Atom JavaScript client.
- <h2>Model to XML Tests</h2>
- <input type="button" onClick="testUritoXML()" value="Uri to XML"><br>
- <input type="button" onClick="testEmailtoXML()" value="Email to XML"><br>
- <input type="button" onClick="testIdtoXML()" value="Id to XML"><br>
- <input type="button" onClick="testLogotoXML()" value="Logo to XML"><br>
- <input type="button" onClick="testTexttoXML()" value="Text to XML"><br>
- <input type="button" onClick="testPersontoXML()" value="Person to XML"><br>
- <input type="button" onClick="testGeneratortoXML()" value="Generator to XML"><br>
- <input type="button" onClick="testCategorytoXML()" value="Category to XML"><br>
- <input type="button" onClick="testLinktoXML()" value="Link to XML"><br>
- <input type="button" onClick="testEntrytoXML()" value="Entry to XML"><br>
- <input type="button" onClick="testFeedtoXML()" value="Feed to XML"><br>
- <h2>Results</h2>
- <code id="results">
- </code>
-</body>
+<!-- + * 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. +--> +<html> +<head> +<title>Atom JavaScript Client Unit Tests</title> + +<!-- Include Tuscany JavaScript client model for Atom. + Using this JavaScript model, users can use syntax such as: + item += "name=" + entry.getName() + ", price=" + entry.getContent() + rather than + item += entries[i].getElementsByTagName("content")[0].firstChild.nodeValue; + --> +<script type="text/javascript" src="atomModel.js"></script> + +<script language="JavaScript"> + + function testUritoXML() { + var test = new Uri( "http://example.org/edit/first-post.atom" ); + var text = text.toXML(); + alert( "Uri=" + text ); + } + + function testEmailtoXML() { + var test = new Email( "john.doe@ibm.com" ); + var text = test.toXML(); + alert( "Email=" + text ); + } + + function testIdtoXML() { + var test = new Id( "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a" ); + var text = test.toXML(); + alert( "Id=" + text ); + } + + function testLogotoXML() { + var test = new Logo( "goofyGraphic.png" ); + var text = test.toXML(); + alert( "Logo=" + text ); + document.getElementById('results').innerHTML = removeBrackets( text ); + } + + function testTexttoXML() { + var test = new Text( "This is ordinary text." ); + var text = test.toXML(); + alert( "Text=" + text ); + var test = new Text( "This is <b>HTML</b> text.", "html" ); + var text = test.toXML( "supertext" ); + alert( "Text=" + text ); + document.getElementById('results').innerHTML = removeBrackets( text ); + } + + function testPersontoXML() { + var test = new Person( "John Doe", "john.doe@ibm.com" ); + var text = test.toXML(); + alert( "Person=" + text ); + document.getElementById('results').innerHTML = removeBrackets( text ); + } + + function testGeneratortoXML() { + var test = new Generator( "Power Station", "http://www.powerstation.com" ); + var text = test.toXML(); + alert( "Generator=" + text ); + document.getElementById('results').innerHTML = removeBrackets( text ); + } + + function testCategorytoXML() { + var test = new Category( "CategoryXYZ", "http://www.site.com/?category=CategoryXYZ" ); + var text = test.toXML(); + alert( "Category=" + text ); + document.getElementById('results').innerHTML = removeBrackets( text ); + } + + function testLinktoXML() { + var test = new Link( "http://example.org/edit/first-post.atom", "edit" ); + var text = test.toXML(); + alert( "Link=" + text ); + document.getElementById('results').innerHTML = removeBrackets( text ); + } + + function testEntrytoXML() { + // <?xml version="1.0"?> + // <entry xmlns="http://www.w3.org/2005/Atom"> + // <title>Atom-Powered Robots Run Amok</title> + // <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> + // <updated>2003-12-13T18:30:02Z</updated> + // <author><name>John Doe</name></author> + // <content>Some text.</content> + // <link rel="edit" href="http://example.org/edit/first-post.atom"/> + // </entry> + + var entry = new Entry(); + entry.setNamespace( "http://www.w3.org/2005/Atom" ); + entry.setTitle( "Atom-Powered Robots Run Amok" ); + entry.setId( "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a" ); + entry.setUpdated( "2003-12-13T18:30:02Z" ); + entry.setContent( "Some text." ); + entry.addAuthor( new Person( "John Doe" ) ); + entry.addAuthor( new Person( "Mark Pilgrim", "f8dy@example.com" )); + entry.addContributor( new Person( "Sam Ruby" )); + entry.addContributor( new Person( "Joe Gregorio" )); + entry.addLink( new Link( "http://example.org/edit/first-post.atom", "edit" )); + var text = entry.toXML(); + + document.getElementById('results').innerHTML = removeBrackets( text ); + } + + function testFeedtoXML() { + // <feed xmlns="http://www.w3.org/2005/Atom"> + // <title type="text">dive into mark</title> + // <subtitle type="html">A <em>lot</em> of effort went into making this effortless </subtitle> + // <updated>2005-07-31T12:29:29Z</updated> + // <id>tag:example.org,2003:3</id> + // <link rel="alternate" type="text/html" hreflang="en" href="http://example.org/"/> + // <link rel="self" type="application/atom+xml" href="http://example.org/feed.atom"/> + // <rights>Copyright (c) 2003, Mark Pilgrim</rights> + // <generator uri="http://www.example.com/" version="1.0">Example Toolkit</generator> + // <entry> + // <title>Atom draft-07 snapshot</title> + // <link rel="alternate" type="text/html" href="http://example.org/2005/04/02/atom"/> + // <link rel="enclosure" type="audio/mpeg" length="1337" href="http://example.org/audio/ph34r_my_podcast.mp3"/> + // <id>tag:example.org,2003:3.2397</id> + // <updated>2005-07-31T12:29:29Z</updated> + // <published>2003-12-13T08:29:29-04:00</published> + // <author><name>Mark Pilgrim</name><uri>http://example.org/</uri><email>f8dy@example.com</email></author> + // <contributor><name>Sam Ruby</name></contributor> + // <contributor><name>Joe Gregorio</name></contributor> + // <content type="xhtml" xml:lang="en" xml:base="http://diveintomark.org/"> + // <div xmlns="http://www.w3.org/1999/xhtml"> + // <p><i>[Update: The Atom draft is finished.]</i></p> + // </div> + // </content> + // </entry> + // <entry> + // <title>Dan Becker's Triathlon Site - Best Hills In Austin</title> + // <category term="triathlons"/> + // <id>tag:www.io.com,2008-09-05:/~beckerdo/triathlons/besthills.html</id> + // <link href="http://www.io.com/~beckerdo/triathlons/besthills.html"/> + // <published>2008-09-05T14:09:32-05:00</published> + // <updated>2008-09-06T08:49:12-05:00</updated> + // <summary type='html'> + // <a href='http://www.io.com/~beckerdo/triathlons/besthills.html'><img src='http://www.io.com/~beckerdo/pictures/LittleDan25.png' width='25' height='25' alt='Little Dan' align='left'></a> + // A description and Google maps of the best running and biking hills in Austin, Texas. + // </summary> + // </entry> + // </feed> + + var feed = new Feed( "Dive into Mark" ); + feed.setSubtitle( new Text( "A <em>lot</em> of effort went into making this effortless", "html" )); + feed.setUpdated( "2005-07-31T12:29:29Z" ); + feed.setId( "tag:example.org,2003:3" ); + var link = new Link( "http://example.org", "alternate" ); + link.setMimeType( "text/html" ); + link.setHRefLang( "en" ); + feed.addLink( link ); + feed.addLink( new Link( "http://example.org/feed.atom", "self" )); + feed.setRights( "Copyright (c) 2003, Mark Pilgrim" ); + feed.setGenerator( new Generator( "Example Toolkit", "http://www.example.com/" )); + feed.addAuthor( new Person( "Mark Pilgrim", "f8dy@example.com" )); + feed.addContributor( new Person( "Sam Ruby" )); + feed.addContributor( new Person( "Joe Gregorio" )); + // <entry> + // <title>Atom draft-07 snapshot</title> + // <link rel="alternate" type="text/html" href="http://example.org/2005/04/02/atom"/> + // <link rel="enclosure" type="audio/mpeg" length="1337" href="http://example.org/audio/ph34r_my_podcast.mp3"/> + // <id>tag:example.org,2003:3.2397</id> + // <updated>2005-07-31T12:29:29Z</updated> + // <published>2003-12-13T08:29:29-04:00</published> + // <author><name>Mark Pilgrim</name><uri>http://example.org/</uri><email>f8dy@example.com</email></author> + // <contributor><name>Sam Ruby</name></contributor> + // <contributor><name>Joe Gregorio</name></contributor> + // <content type="xhtml" xml:lang="en" xml:base="http://diveintomark.org/"> + // <div xmlns="http://www.w3.org/1999/xhtml"> + // <p><i>[Update: The Atom draft is finished.]</i></p> + // </div> + // </content> + // </entry> + // <entry> + // <title>Dan Becker's Triathlon Site - Best Hills In Austin</title> + // <category term="triathlons"/> + // <id>tag:www.io.com,2008-09-05:/~beckerdo/triathlons/besthills.html</id> + // <link href="http://www.io.com/~beckerdo/triathlons/besthills.html"/> + // <published>2008-09-05T14:09:32-05:00</published> + // <updated>2008-09-06T08:49:12-05:00</updated> + // <summary type='html'> + // <a href='http://www.io.com/~beckerdo/triathlons/besthills.html'><img src='http://www.io.com/~beckerdo/pictures/LittleDan25.png' width='25' height='25' alt='Little Dan' align='left'></a> + // A description and Google maps of the best running and biking hills in Austin, Texas. + // </summary> + // </entry> + // </feed> + var entry = new Entry( "Dan Becker's Triathlon Site - Best Hills In Austin" ); + entry.addCategory( new Category( "running" )); + entry.addCategory( new Category( "triathlons" )); + entry.setId( "tag:www.io.com,2008-09-05:/~beckerdo/triathlons/besthills.html" ); + entry.addLink( new Link ( "http://www.io.com/~beckerdo/triathlons/besthills.html" )); + entry.setPublished( "2008-09-05T14:09:32-05:00" ); + entry.setUpdated( "2008-09-06T08:49:12-05:00" ); + entry.setSummary( new Text ( + "<a href='http://www.io.com/~beckerdo/triathlons/besthills.html'><img src='http://www.io.com/~beckerdo/pictures/LittleDan25.png' width='25' height='25' alt='Little Dan' align='left'></a>\n" + + "A description and Google maps of the best running and biking hills in Austin, Texas.", "html" )); + feed.addEntry( entry ); + + var text = feed.toXML(); + alert( "Feed xml=" + text ); + document.getElementById('results').innerHTML = removeBrackets( text ); + } + + function removeBrackets( input ) { + input = input.replace( /</g, "<" ); // replaceAll + input = input.replace( />/g, ">" ); // replaceAll + return input; + } +</script> +</head> + +<body> +<h1>Atom JavaScript Client Unit Tests</h1> +<p>This document tests the serialization and deserialization of the Atom JavaScript client. + <h2>Model to XML Tests</h2> + <input type="button" onClick="testUritoXML()" value="Uri to XML"><br> + <input type="button" onClick="testEmailtoXML()" value="Email to XML"><br> + <input type="button" onClick="testIdtoXML()" value="Id to XML"><br> + <input type="button" onClick="testLogotoXML()" value="Logo to XML"><br> + <input type="button" onClick="testTexttoXML()" value="Text to XML"><br> + <input type="button" onClick="testPersontoXML()" value="Person to XML"><br> + <input type="button" onClick="testGeneratortoXML()" value="Generator to XML"><br> + <input type="button" onClick="testCategorytoXML()" value="Category to XML"><br> + <input type="button" onClick="testLinktoXML()" value="Link to XML"><br> + <input type="button" onClick="testEntrytoXML()" value="Entry to XML"><br> + <input type="button" onClick="testFeedtoXML()" value="Feed to XML"><br> + <h2>Results</h2> + <code id="results"> + </code> +</body> </html> diff --git a/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/widgetJS.composite b/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/widgetJS.composite index e44a56e520..71c5a3350f 100644 --- a/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/widgetJS.composite +++ b/branches/sca-java-1.x/modules/implementation-widget-runtime-tuscany/src/test/resources/widgetJS.composite @@ -1,58 +1,58 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
- targetNamespace="http://sample/resource"
- xmlns:sr="http://sample/resource"
- name="resource">
-
- <component name="storeJS">
- <!-- Note: the store.html and storeJS.html clients are similar
- except that store.html edits the client document using JavaScript
- and many node queries, and storeJS.html uses the client Atom
- JavaScript mode (fewer node queries and less XML knowledge needed.-->
- <tuscany:implementation.widget location="content/storeJS.html"/>
- <property name="locale">en</property>
- <service name="Widget">
- <tuscany:binding.http uri="/storeJS"/>
- </service>
- <reference name="Catalog" target="Catalog">
- <tuscany:binding.jsonrpc uri="/Catalog"/>
- </reference>
- <reference name="ShoppingCart" target="ShoppingCart">
- <tuscany:binding.atom uri="/ShoppingCart"/>
- </reference>
- </component>
-
- <component name="Catalog">
- <implementation.java class="store.CatalogImpl"/>
- <service name="Catalog">
- <tuscany:binding.jsonrpc uri="/Catalog"/>
- </service>
- </component>
-
- <component name="ShoppingCart">
- <implementation.java class="store.ShoppingCartImpl"/>
- <service name="Collection">
- <tuscany:binding.atom uri="/ShoppingCart"/>
- </service>
- </component>
-
-</composite>
+<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + targetNamespace="http://sample/resource" + xmlns:sr="http://sample/resource" + name="resource"> + + <component name="storeJS"> + <!-- Note: the store.html and storeJS.html clients are similar + except that store.html edits the client document using JavaScript + and many node queries, and storeJS.html uses the client Atom + JavaScript mode (fewer node queries and less XML knowledge needed.--> + <tuscany:implementation.widget location="content/storeJS.html"/> + <property name="locale">en</property> + <service name="Widget"> + <tuscany:binding.http uri="/storeJS"/> + </service> + <reference name="Catalog" target="Catalog"> + <tuscany:binding.jsonrpc uri="/Catalog"/> + </reference> + <reference name="ShoppingCart" target="ShoppingCart"> + <tuscany:binding.atom uri="/ShoppingCart"/> + </reference> + </component> + + <component name="Catalog"> + <implementation.java class="store.CatalogImpl"/> + <service name="Catalog"> + <tuscany:binding.jsonrpc uri="/Catalog"/> + </service> + </component> + + <component name="ShoppingCart"> + <implementation.java class="store.ShoppingCartImpl"/> + <service name="Collection"> + <tuscany:binding.atom uri="/ShoppingCart"/> + </service> + </component> + +</composite> diff --git a/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java b/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java index e18fc162b3..08f2fbe679 100644 --- a/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java +++ b/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java @@ -90,7 +90,7 @@ class WidgetImplementationProvider implements ImplementationProvider { WidgetComponentScriptServlet widgetScriptServlet; widgetScriptServlet = new WidgetComponentScriptServlet(this.component, javaScriptGenerator); servletHost.addServletMapping(scriptURI, widgetScriptServlet); - } + } } public void stop() { diff --git a/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.java b/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.java index 9ca8c59e6c..3a3754f67d 100644 --- a/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.java +++ b/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.java @@ -19,7 +19,6 @@ package org.apache.tuscany.sca.implementation.widget; - /** * Factory for the widget implementation model. * diff --git a/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java b/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java index d54999a8b1..c0087e97fe 100644 --- a/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java +++ b/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java @@ -160,7 +160,7 @@ public class WidgetImplementationProcessor extends BaseStAXArtifactProcessor imp } public void write(WidgetImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - // Write <implementation.widget> + // Write <implementation.widget> writeStart(writer, IMPLEMENTATION_WIDGET.getNamespaceURI(), IMPLEMENTATION_WIDGET.getLocalPart()); if (implementation.getLocation() != null) { diff --git a/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationFactoryImpl.java b/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationFactoryImpl.java index 98feaedf00..c24c9e7eab 100644 --- a/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationFactoryImpl.java +++ b/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationFactoryImpl.java @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.implementation.widget.impl; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.implementation.widget.WidgetImplementation; import org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; @@ -39,7 +40,7 @@ public class WidgetImplementationFactoryImpl implements WidgetImplementationFact javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); } - public WidgetImplementationImpl createWidgetImplementation() { + public WidgetImplementation createWidgetImplementation() { return new WidgetImplementationImpl(assemblyFactory, javaFactory); } diff --git a/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java b/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java index adb1224066..8245428d0f 100644 --- a/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java +++ b/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java @@ -30,6 +30,7 @@ import java.security.PrivilegedAction; import javax.xml.namespace.QName; import javax.xml.ws.WebFault; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; import org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint; import org.apache.tuscany.sca.interfacedef.DataType; @@ -62,6 +63,11 @@ public class JAXWSFaultExceptionMapper implements FaultExceptionMapper { this.dataBindingExtensionPoint = dataBindingExtensionPoint; this.xmlAdapterExtensionPoint = xmlAdapters; } + + public JAXWSFaultExceptionMapper(ExtensionPointRegistry registry) { + this.dataBindingExtensionPoint = registry.getExtensionPoint(DataBindingExtensionPoint.class); + this.xmlAdapterExtensionPoint = registry.getExtensionPoint(XMLAdapterExtensionPoint.class); + } /** * The following is quoted from the JAX-WS Specification v2.1 @@ -394,9 +400,4 @@ public class JAXWSFaultExceptionMapper implements FaultExceptionMapper { return Character.toUpperCase(name.charAt(0)) + name.substring(1); } } - - public void setDataBindingExtensionPoint(DataBindingExtensionPoint dataBindingExtensionPoint) { - this.dataBindingExtensionPoint = dataBindingExtensionPoint; - } - } diff --git a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java index 8fa91a8e52..2065940c8d 100644 --- a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java +++ b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java @@ -18,6 +18,7 @@ */ package org.apache.tuscany.sca.interfacedef.impl; +import java.lang.ref.WeakReference; import java.lang.reflect.Type; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -43,8 +44,8 @@ import org.apache.tuscany.sca.interfacedef.DataType; */ public class DataTypeImpl<L> implements DataType<L> { private String dataBinding; - private Class<?> physical; - private Type genericType; + private WeakReference<Class<?>> physical; + private WeakReference<Type> genericType; private L logical; private Map<Class<?>, Object> metaDataMap; @@ -77,8 +78,8 @@ public class DataTypeImpl<L> implements DataType<L> { public DataTypeImpl(String dataBinding, Class<?> physical, Type genericType, L logical) { super(); this.dataBinding = dataBinding; - this.physical = physical; - this.genericType = genericType; + this.physical = new WeakReference<Class<?>>(physical); + this.genericType = new WeakReference<Type>(genericType); this.logical = logical; } @@ -88,14 +89,14 @@ public class DataTypeImpl<L> implements DataType<L> { * @return the physical type used by the runtime */ public Class<?> getPhysical() { - return physical; + return physical.get(); } /** * @param physical the physical to set */ public void setPhysical(Class<?> physical) { - this.physical = physical; + this.physical = new WeakReference<Class<?>>(physical); } /** @@ -103,7 +104,7 @@ public class DataTypeImpl<L> implements DataType<L> { * @return The java generic type */ public Type getGenericType() { - return genericType; + return genericType.get(); } /** @@ -111,7 +112,7 @@ public class DataTypeImpl<L> implements DataType<L> { * @param genericType */ public void setGenericType(Type genericType) { - this.genericType = genericType; + this.genericType = new WeakReference<Type>(genericType); } /** @@ -161,9 +162,9 @@ public class DataTypeImpl<L> implements DataType<L> { final int prime = 31; int result = 1; result = prime * result + ((dataBinding == null) ? 0 : dataBinding.hashCode()); - result = prime * result + ((genericType == null) ? 0 : genericType.hashCode()); + result = prime * result + ((genericType == null || genericType.get() == null) ? 0 : genericType.get().hashCode()); result = prime * result + ((logical == null) ? 0 : logical.hashCode()); - result = prime * result + ((physical == null) ? 0 : physical.hashCode()); + result = prime * result + ((physical == null || physical.get() == null) ? 0 : physical.get().hashCode()); return result; } @@ -181,20 +182,20 @@ public class DataTypeImpl<L> implements DataType<L> { return false; } else if (!dataBinding.equals(other.dataBinding)) return false; - if (genericType == null) { + if (genericType == null || genericType.get() == null) { if (other.genericType != null) return false; - } else if (!genericType.equals(other.genericType)) + } else if (!genericType.get().equals(other.genericType.get())) return false; if (logical == null) { if (other.logical != null) return false; } else if (!logical.equals(other.logical)) return false; - if (physical == null) { + if (physical == null || physical.get() == null) { if (other.physical != null) return false; - } else if (!physical.equals(other.physical)) + } else if (!physical.get().equals(other.physical.get())) return false; return true; } @@ -219,8 +220,8 @@ public class DataTypeImpl<L> implements DataType<L> { StringBuilder b = new StringBuilder( 256 ); b.append( "DataType[" ); b.append( "dataBinding=" + ((dataBinding==null) ? "null" : dataBinding) ); - b.append( ", genericType=" + ((genericType==null) ? "null" : genericType) ); - b.append( ", physical=" + ((physical==null) ? "null" : physical) ); + b.append( ", genericType=" + ((genericType==null || genericType.get()==null) ? "null" : genericType.get()) ); + b.append( ", physical=" + ((physical==null || physical.get()==null) ? "null" : physical.get()) ); b.append( ", logical=" + ((logical==null) ? "null" : logical) ); b.append( ", metaData size=" + ((metaDataMap==null) ? "0" : metaDataMap.size()) ); b.append( "]" ); diff --git a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java index 149e6306e5..9aeeafe6b9 100644 --- a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java +++ b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java @@ -209,8 +209,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { } for (Operation operation : source.getCallbackInterface().getOperations()) { - Operation targetOperation = - getOperation(target.getCallbackInterface().getOperations(), operation.getName()); + Operation targetOperation = map(target.getCallbackInterface(), operation); if (targetOperation == null) { if (!silent) { throw new IncompatibleInterfaceContractException("Callback operation not found on target", source, @@ -221,7 +220,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { } if (!source.getCallbackInterface().isRemotable()) { // FIXME: for remotable operation, only compare name for now - if (!operation.equals(targetOperation)) { + if (!isCompatible(operation, targetOperation, false)) { if (!silent) { throw new IncompatibleInterfaceContractException("Target callback operation is not compatible", source, target, operation, targetOperation); diff --git a/branches/sca-java-1.x/modules/node-impl/pom.xml b/branches/sca-java-1.x/modules/node-impl/pom.xml index e44586d6ec..0b9c502d5b 100644 --- a/branches/sca-java-1.x/modules/node-impl/pom.xml +++ b/branches/sca-java-1.x/modules/node-impl/pom.xml @@ -115,6 +115,13 @@ <version>1.6-SNAPSHOT</version> <scope>runtime</scope> </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-endpoint</artifactId> + <version>1.6-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> diff --git a/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java b/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java index 9df2079d8c..4d78bf8dfe 100644 --- a/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java +++ b/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java @@ -109,6 +109,7 @@ public class RuntimeBootStrapper { public void start() throws ActivationException { long start = System.currentTimeMillis(); + // Create our extension point registry UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); // Get work scheduler diff --git a/branches/sca-java-1.x/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java b/branches/sca-java-1.x/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java index b5e77061d7..eb06ad7411 100644 --- a/branches/sca-java-1.x/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java +++ b/branches/sca-java-1.x/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java @@ -100,11 +100,9 @@ public class DomainManagerLauncher { int k = 0; try { while ((k != 'q') && (k != 'r')) { - // k = System.in.read(); - Thread.sleep(100); - + k = System.in.read(); } - } catch (Exception e) { + } catch (IOException e) { // Wait forever Object lock = new Object(); diff --git a/branches/sca-java-1.x/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java b/branches/sca-java-1.x/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java index 3f1b15075f..58a6d21ee7 100644 --- a/branches/sca-java-1.x/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java +++ b/branches/sca-java-1.x/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java @@ -101,7 +101,7 @@ public class JDKLoggingPolicyInterceptor implements Interceptor { } Object[] logParams = new Object[] {operation.getName(), sb.toString()}; - logger.logp(Level.FINER, context, "", "Invoking operation {0} with arguments ({1})", logParams); + logger.logp(Level.FINER, context, "", "Invoking operation {0} with arguments {1}", logParams); } Message responseMsg = null; @@ -115,7 +115,7 @@ public class JDKLoggingPolicyInterceptor implements Interceptor { if (responseMsg != null) { Object[] logParams = new Object[] {operation.getName(), responseMsg.getBody()}; logger.logp(Level.INFO, context, "", "Returned from operation - " + operation.getName()); - logger.logp(Level.FINER, context, "", "Returning from operation {0} with return value ({1})", logParams); + logger.logp(Level.FINER, context, "", "Returning from operation {0} with return value {1}", logParams); } } } diff --git a/branches/sca-java-1.x/modules/policy-security-http/LICENSE b/branches/sca-java-1.x/modules/policy-security-http/LICENSE index 6e529a25c4..8aa906c321 100644 --- a/branches/sca-java-1.x/modules/policy-security-http/LICENSE +++ b/branches/sca-java-1.x/modules/policy-security-http/LICENSE @@ -1,205 +1,205 @@ -
- 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.
-
-
-
+ + 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/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationCallbackHandler.java b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationCallbackHandler.java index 6c5c2df2e5..ee094f022d 100644 --- a/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationCallbackHandler.java +++ b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationCallbackHandler.java @@ -46,7 +46,7 @@ public class LDAPRealmAuthenticationCallbackHandler implements CallbackHandler { BasicAuthenticationPrincipal principal = SecurityUtil.getPrincipal(subject, BasicAuthenticationPrincipal.class); if (principal != null){ - /* + /* System.out.println(">>> LDAPRealmAuthenticationCallbackHandler" + " Username: " + principal.getName() + " Password: " + principal.getPassword()); diff --git a/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProviderFactory.java b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProviderFactory.java index 43d13b665a..45fe650b22 100644 --- a/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProviderFactory.java +++ b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProviderFactory.java @@ -41,8 +41,8 @@ public class LDAPRealmAuthenticationPolicyProviderFactory implements PolicyProvi LDAPSecurityHandlerExtensionPoint securityHandlerExtensionPoint = registry.getExtensionPoint(LDAPSecurityHandlerExtensionPoint.class); if (securityHandlerExtensionPoint.getLDAPSecurityHandlers().size() > 0) { - securityHandler = securityHandlerExtensionPoint.getLDAPSecurityHandlers().get(0); - } + securityHandler = securityHandlerExtensionPoint.getLDAPSecurityHandlers().get(0); + } } public Class<LDAPRealmAuthenticationPolicy> getModelType() { diff --git a/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java index afa8f1e8de..5a8b7c7d85 100644 --- a/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java +++ b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java @@ -213,7 +213,7 @@ public class LDAPRealmAuthenticationServicePolicyProvider implements PolicyProvi return polices; } - + /** * Find a given configured operation * @param operation diff --git a/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java index 7439137b78..b454289673 100644 --- a/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java +++ b/branches/sca-java-1.x/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java @@ -32,7 +32,6 @@ import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.Problem.Severity; -import org.apache.tuscany.sca.monitor.impl.ProblemImpl; /** @@ -87,7 +86,7 @@ public class DefaultLDAPSecurityExtensionPoint implements LDAPSecurityHandlerExt */ private void error(String message, Object model, Exception ex) { if (monitor != null) { - Problem problem = new ProblemImpl(this.getClass().getName(), null, Severity.ERROR, model, message, ex); + Problem problem = monitor.createProblem(this.getClass().getName(), null, Severity.ERROR, model, message, ex); monitor.problem(problem); } } diff --git a/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java b/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java index c1fab9efe4..e783d77c97 100644 --- a/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java +++ b/branches/sca-java-1.x/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java @@ -27,7 +27,6 @@ import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.policy.SecurityUtil; -import org.osoa.sca.ServiceRuntimeException; /** @@ -52,7 +51,14 @@ public class BasicAuthenticationServicePolicyInterceptor implements Interceptor } private void init() { - + if (policySet != null) { + for (Object policyObject : policySet.getPolicies()){ + if (policyObject instanceof BasicAuthenticationPolicy){ + policy = (BasicAuthenticationPolicy)policyObject; + break; + } + } + } } public Message invoke(Message msg) { @@ -60,35 +66,17 @@ public class BasicAuthenticationServicePolicyInterceptor implements Interceptor Subject subject = SecurityUtil.getSubject(msg); BasicAuthenticationPrincipal principal = SecurityUtil.getPrincipal(subject, BasicAuthenticationPrincipal.class); - boolean authenticated = false; - + if (principal != null){ - System.out.println("Authenticating user: " + - principal.getName()); + System.out.println("Username: " + + principal.getName() + + " Password: " + + principal.getPassword()); // could call out here to some 3rd party system to do whatever you - // need to do do with username and password. For this very simple - // interceptor just check that the credentials match crendentials in - // the policy - - if (policySet != null) { - for (Object policyObject : policySet.getPolicies()){ - if (policyObject instanceof BasicAuthenticationPolicy){ - BasicAuthenticationPolicy policy = (BasicAuthenticationPolicy)policyObject; - - if (policy.getUserName().equals(principal.getName())){ - if (policy.getPassword().equals(principal.getPassword())){ - authenticated = true; - } - } - } - } - } - } - - if (authenticated == false){ - throw new ServiceRuntimeException("User: " + principal.getName() + " cannot be authenticated"); + // need to do do with username and password + } return getNext().invoke(msg); diff --git a/branches/sca-java-1.x/modules/web-javascript-dojo/NOTICE b/branches/sca-java-1.x/modules/web-javascript-dojo/NOTICE index 4b63e48b54..c11317f24d 100644 --- a/branches/sca-java-1.x/modules/web-javascript-dojo/NOTICE +++ b/branches/sca-java-1.x/modules/web-javascript-dojo/NOTICE @@ -8,3 +8,4 @@ This product includes dojotoolkit files (http://dojotoolkit.org/) under the "New" BSD License (see the LICENSE file contained in this distribution) under the following copyright Copyright (c) 2005, The Dojo Foundation. All rights reserved. + diff --git a/branches/sca-java-1.x/modules/web-javascript-dojo/build-dojo.xml b/branches/sca-java-1.x/modules/web-javascript-dojo/build-dojo.xml index 15444f7d39..f029ed7e87 100644 --- a/branches/sca-java-1.x/modules/web-javascript-dojo/build-dojo.xml +++ b/branches/sca-java-1.x/modules/web-javascript-dojo/build-dojo.xml @@ -74,7 +74,7 @@ <patternset> <include name="dojo-release-${dojo.version}/dojo/**"/> <exclude name="dojo-release-${dojo.version}/dojo/tests/**"/> - <include name="dojo-release-${dojo.version}/dijit/**"/> + <exclude name="dojo-release-${dojo.version}/dijit/**"/> <exclude name="dojo-release-${dojo.version}/dojox/**"/> <exclude name="dojo-release-${dojo.version}/util/**"/> </patternset> diff --git a/branches/sca-java-1.x/modules/web-javascript-dojo/pom.xml b/branches/sca-java-1.x/modules/web-javascript-dojo/pom.xml index 5ccfe4a992..47460d3005 100644 --- a/branches/sca-java-1.x/modules/web-javascript-dojo/pom.xml +++ b/branches/sca-java-1.x/modules/web-javascript-dojo/pom.xml @@ -30,14 +30,6 @@ <name>Apache Tuscany SCA Web JavaScript for DOJO</name> <dependencies> - - <dependency> - <groupId>org.dojotoolkit</groupId> - <artifactId>dojo</artifactId> - <version>1.3.0</version> - <type>zip</type> - </dependency> - <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-core</artifactId> @@ -81,8 +73,8 @@ </dependency> </dependencies> <executions> - <execution> - <id>install-dojo</id> + <execution> + <id>install-dojo</id> <phase>validate</phase> <goals> <goal>run</goal> @@ -94,7 +86,7 @@ </ant> </tasks> </configuration> - </execution> + </execution> <execution> <id>copy-dojo-files</id> <phase>generate-resources</phase> diff --git a/branches/sca-java-1.x/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java b/branches/sca-java-1.x/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java index 3eaf6bf47a..987ef466fc 100644 --- a/branches/sca-java-1.x/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java +++ b/branches/sca-java-1.x/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java @@ -69,7 +69,7 @@ public class DojoModuleActivator implements ModuleActivator { public void stop(ExtensionPointRegistry registry) { Servlet servlet = servletHost.getServletMapping(dojoBaseUri); - if(servlet == null) { + if(servlet != null) { servletHost.removeServletMapping(dojoBaseUri); servletHost.removeServletMapping(dojoUri); diff --git a/branches/sca-java-1.x/modules/workspace-impl/pom.xml b/branches/sca-java-1.x/modules/workspace-impl/pom.xml index c84570e0f9..d08880e88c 100644 --- a/branches/sca-java-1.x/modules/workspace-impl/pom.xml +++ b/branches/sca-java-1.x/modules/workspace-impl/pom.xml @@ -55,16 +55,10 @@ <dependency> <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-embedded</artifactId> - <version>1.6-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-contribution-namespace</artifactId> <version>1.6-SNAPSHOT</version> <scope>test</scope> - </dependency> + </dependency> </dependencies> diff --git a/branches/sca-java-1.x/modules/workspace/pom.xml b/branches/sca-java-1.x/modules/workspace/pom.xml index c4fd5261b1..7b2c5f5358 100644 --- a/branches/sca-java-1.x/modules/workspace/pom.xml +++ b/branches/sca-java-1.x/modules/workspace/pom.xml @@ -29,12 +29,6 @@ <name>Apache Tuscany SCA Domain Workspace Model</name> <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-sca-api</artifactId> - <version>1.6-SNAPSHOT</version> - </dependency> - <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-contribution</artifactId> diff --git a/branches/sca-java-1.x/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.java b/branches/sca-java-1.x/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.java index 99ecbb4c0c..e41cc3ea83 100644 --- a/branches/sca-java-1.x/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.java +++ b/branches/sca-java-1.x/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.java @@ -30,7 +30,7 @@ import org.apache.tuscany.sca.workspace.WorkspaceFactory; */ public class WorkspaceFactoryImpl implements WorkspaceFactory { - public WorkspaceFactoryImpl() { + protected WorkspaceFactoryImpl() { } public Workspace createWorkspace() { diff --git a/branches/sca-java-1.x/modules/xsd/pom.xml b/branches/sca-java-1.x/modules/xsd/pom.xml index cd32d635af..674ac63615 100644 --- a/branches/sca-java-1.x/modules/xsd/pom.xml +++ b/branches/sca-java-1.x/modules/xsd/pom.xml @@ -7,15 +7,15 @@ * 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.
+ * under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
@@ -39,6 +39,12 @@ <groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
|