You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2009/04/30 06:39:57 UTC
svn commit: r770058 [1/2] - in /tuscany/branches/sca-java-1.x/modules:
binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/
binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/
binding-gdata-runtime/src/ma...
Author: rfeng
Date: Thu Apr 30 04:39:55 2009
New Revision: 770058
URL: http://svn.apache.org/viewvc?rev=770058&view=rev
Log:
Fix for TUSCANY-3000
Added:
tuscany/branches/sca-java-1.x/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.Mediator
tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory
Modified:
tuscany/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java
tuscany/branches/sca-java-1.x/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java
tuscany/branches/sca-java-1.x/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java
tuscany/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingProviderFactory.java
tuscany/branches/sca-java-1.x/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java
tuscany/branches/sca-java-1.x/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
tuscany/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java
tuscany/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java
tuscany/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
tuscany/branches/sca-java-1.x/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java
tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java
tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java
tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
tuscany/branches/sca-java-1.x/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java
tuscany/branches/sca-java-1.x/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.java
tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProviderFactory.java
tuscany/branches/sca-java-1.x/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProviderFactory.java
Modified: tuscany/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java (original)
+++ tuscany/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.binding.atom.provider;
@@ -22,10 +22,8 @@
import org.apache.tuscany.sca.binding.atom.AtomBinding;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -52,8 +50,7 @@
this.servletHost = servletHosts.getServletHosts().get(0);
ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
this.messageFactory = modelFactories.getFactory(MessageFactory.class);
- this.mediator = new MediatorImpl(extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class),
- extensionPoints.getExtensionPoint(TransformerExtensionPoint.class));
+ this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
}
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
Modified: tuscany/branches/sca-java-1.x/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java (original)
+++ tuscany/branches/sca-java-1.x/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.binding.feed.provider;
@@ -22,10 +22,8 @@
import org.apache.tuscany.sca.binding.feed.AtomBinding;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -52,8 +50,7 @@
this.servletHost = servletHosts.getServletHosts().get(0);
ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
this.messageFactory = modelFactories.getFactory(MessageFactory.class);
- this.mediator = new MediatorImpl(extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class),
- extensionPoints.getExtensionPoint(TransformerExtensionPoint.class));
+ this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
}
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
Modified: tuscany/branches/sca-java-1.x/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java (original)
+++ tuscany/branches/sca-java-1.x/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.binding.feed.provider;
@@ -22,10 +22,8 @@
import org.apache.tuscany.sca.binding.feed.RSSBinding;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -52,8 +50,7 @@
this.servletHost = servletHosts.getServletHosts().get(0);
ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
this.messageFactory = modelFactories.getFactory(MessageFactory.class);
- this.mediator = new MediatorImpl(extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class),
- extensionPoints.getExtensionPoint(TransformerExtensionPoint.class));
+ this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
}
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
Modified: tuscany/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingProviderFactory.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingProviderFactory.java (original)
+++ tuscany/branches/sca-java-1.x/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingProviderFactory.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.binding.gdata.provider;
@@ -22,10 +22,8 @@
import org.apache.tuscany.sca.binding.gdata.GdataBinding;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -40,7 +38,7 @@
/**
* Implementation of a Binding provider factory for the Atom binding.
- *
+ *
* @version $Rev$ $Date$
*/
public class GdataBindingProviderFactory implements BindingProviderFactory<GdataBinding> {
@@ -54,9 +52,7 @@
this.servletHost = servletHosts.getServletHosts().get(0);
ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
this.messageFactory = modelFactories.getFactory(MessageFactory.class);
- this.mediator =
- new MediatorImpl(extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class), extensionPoints
- .getExtensionPoint(TransformerExtensionPoint.class));
+ this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
}
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
@@ -68,7 +64,7 @@
e.printStackTrace();
return null; //Google authentication error! : This exception needs to be handled into a better way
}
-
+
}
public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
Modified: tuscany/branches/sca-java-1.x/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java (original)
+++ tuscany/branches/sca-java-1.x/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.binding.rss.provider;
@@ -22,10 +22,8 @@
import org.apache.tuscany.sca.binding.rss.RSSBinding;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -52,8 +50,7 @@
this.servletHost = servletHosts.getServletHosts().get(0);
ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
this.messageFactory = modelFactories.getFactory(MessageFactory.class);
- this.mediator = new MediatorImpl(extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class),
- extensionPoints.getExtensionPoint(TransformerExtensionPoint.class));
+ this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
}
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
Modified: tuscany/branches/sca-java-1.x/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java (original)
+++ tuscany/branches/sca-java-1.x/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.contribution.service.impl;
@@ -25,7 +25,6 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
-import java.net.URLClassLoader;
import java.net.URLConnection;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -57,7 +56,6 @@
import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
import org.apache.tuscany.sca.contribution.service.TypeDescriber;
import org.apache.tuscany.sca.contribution.service.util.IOHelper;
-import org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -69,7 +67,7 @@
/**
* Service interface that manages artifacts contributed to a Tuscany runtime.
- *
+ *
* @version $Rev$ $Date$
*/
public class ContributionServiceImpl implements ContributionService {
@@ -128,16 +126,16 @@
* Contribution model factory
*/
private ContributionFactory contributionFactory;
-
-
+
+
private ModelResolver policyDefinitionsResolver;
- private List policyDefinitions;
-
+ private List policyDefinitions;
+
private Monitor monitor;
-
- private String COMPOSITE_FILE_EXTN = ".composite";
-
+
+ private String COMPOSITE_FILE_EXTN = ".composite";
+
private TypeDescriber packageTypeDescriber;
public ContributionServiceImpl(ContributionRepository repository,
@@ -152,7 +150,7 @@
ContributionFactory contributionFactory,
XMLInputFactory xmlFactory,
List<SCADefinitions> policyDefinitions,
- ExtensionPointRegistry extensionPoints,
+ ExtensionPointRegistry extensionPoints,
Monitor monitor) {
super();
this.extensionPoints = extensionPoints;
@@ -169,13 +167,13 @@
this.policyDefinitionsResolver = policyDefinitionsResolver;
this.policyDefinitions = policyDefinitions;
this.monitor = monitor;
-
+
this.packageTypeDescriber = new PackageTypeDescriberImpl();
}
-
+
/**
* Report a error.
- *
+ *
* @param problems
* @param message
* @param model
@@ -261,24 +259,25 @@
/**
* Perform read of the contribution metadata loader (sca-contribution.xml and sca-contribution-generated.xml)
* When the two metadata files are available, the information provided are merged, and the sca-contribution has priorities
- *
+ *
* @param sourceURL
* @return Contribution
* @throws ContributionException
*/
+ /*
private Contribution readContributionMetadata(URL sourceURL) throws ContributionException {
Contribution contributionMetadata = contributionFactory.createContribution();
ContributionMetadataDocumentProcessor metadataDocumentProcessor =
new ContributionMetadataDocumentProcessor(modelFactories, staxProcessor, monitor);
-
+
final URL[] urls = {sourceURL};
// Allow access to create classloader. Requires RuntimePermission in security policy.
URLClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() {
public URLClassLoader run() {
return new URLClassLoader(urls, null);
}
- });
+ });
for (String path: new String[]{
Contribution.SCA_CONTRIBUTION_GENERATED_META,
Contribution.SCA_CONTRIBUTION_META}) {
@@ -290,7 +289,7 @@
contributionMetadata.getDeployables().addAll(contribution.getDeployables());
}
}
-
+
// For debugging purposes, write it back to XML
// if (contributionMetadata != null) {
// try {
@@ -311,7 +310,8 @@
return contributionMetadata;
}
-
+ */
+
private static boolean isDirectory(URL url) {
if ("file".equals(url.getProtocol())) {
try {
@@ -322,7 +322,7 @@
}
});
} catch (URISyntaxException e) {
- // Ignore
+ // Ignore
}
}
return false;
@@ -330,13 +330,13 @@
/**
* Note:
- *
+ *
* @param contributionURI ContributionID
* @param sourceURL contribution location
* @param contributionStream contribution content
* @param storeInRepository flag if we store the contribution into the
* repository or not
- * @return the contribution model representing the contribution
+ * @return the contribution model representing the contribution
* @throws IOException
* @throws DeploymentException
*/
@@ -361,8 +361,7 @@
}
}
- //initialize contribution based on it's metadata if available
- Contribution contribution = readContributionMetadata(locationURL);
+ Contribution contribution = contributionFactory.createContribution();
// Create contribution model resolver
if (modelResolver == null) {
@@ -376,7 +375,7 @@
contribution.setLocation(locationURL.toString());
contribution.setModelResolver(modelResolver);
contribution.setType(packageTypeDescriber.getType(locationURL, null));
-
+
List<URI> contributionArtifacts = null;
//NOTE: if a contribution is stored on the repository
@@ -400,7 +399,7 @@
throw (IOException)e.getException();
}
}
-
+
try {
// process the contribution
contributionArtifacts = this.packageProcessor.getArtifacts(locationURL, contributionStream);
@@ -412,7 +411,7 @@
// process the contribution
contributionArtifacts = this.packageProcessor.getArtifacts(locationURL, contributionStream);
}
-
+
// Read all artifacts in the contribution
try {
// Allow access to read system properties. Requires PropertyPermission in security policy.
@@ -422,6 +421,8 @@
throw new ContributionException(e);
}
+ readContributionMetadata(contribution);
+
//
this.contributionListener.contributionAdded(this.contributionRepository, contribution);
@@ -450,12 +451,34 @@
return contribution;
}
+ private void readContributionMetadata(Contribution contribution) {
+ ContributionMetadata m1 = null, m2 = null;
+ for(Artifact a: contribution.getArtifacts()) {
+ if(Contribution.SCA_CONTRIBUTION_GENERATED_META.equals(a.getURI())) {
+ m1 = (ContributionMetadata) a.getModel();
+ }
+ if(Contribution.SCA_CONTRIBUTION_META.equals(a.getURI())) {
+ m2 = (ContributionMetadata) a.getModel();
+ }
+ }
+ if (m1 != null) {
+ contribution.getImports().addAll(m1.getImports());
+ contribution.getExports().addAll(m1.getExports());
+ contribution.getDeployables().addAll(m1.getDeployables());
+ }
+ if (m2 != null) {
+ contribution.getImports().addAll(m2.getImports());
+ contribution.getExports().addAll(m2.getExports());
+ contribution.getDeployables().addAll(m2.getDeployables());
+ }
+ }
+
/**
- * Process any application composite (eg see 5.1.3 of SCA JEE spec)
+ * Process any application composite (eg see 5.1.3 of SCA JEE spec)
* TODO: see TUSCANY-2581
*/
private void processApplicationComposite(Contribution contribution) {
-
+
Composite composite = findComposite("web-inf/web.composite", contribution);
if (composite != null) {
if (!contribution.getDeployables().contains(composite)) {
@@ -485,9 +508,9 @@
}
/**
- * This utility method process each artifact and delegates to proper
+ * This utility method process each artifact and delegates to proper
* artifactProcessor to read the model and generate the in-memory representation
- *
+ *
* @param contribution
* @param artifacts
* @throws ContributionException
@@ -498,9 +521,9 @@
ModelResolver modelResolver = contribution.getModelResolver();
URL contributionURL = new URL(contribution.getLocation());
-
+
List<URI> compositeUris = new ArrayList<URI>();
-
+
Object model = null;
for (URI anArtifactUri : artifacts) {
if ( anArtifactUri.toString().endsWith(COMPOSITE_FILE_EXTN)) {
@@ -514,32 +537,32 @@
artifact.setLocation(artifactURL.toString());
contribution.getArtifacts().add(artifact);
modelResolver.addModel(artifact);
-
+
model = this.artifactProcessor.read(contributionURL, anArtifactUri, artifactURL);
-
+
if (model != null) {
artifact.setModel(model);
// Add the loaded model to the model resolver
modelResolver.addModel(model);
-
+
// Add policy definitions to the list of policy definitions
- if (model instanceof SCADefinitions) {
+ if (model instanceof SCADefinitions) {
policyDefinitions.add(model);
-
+
SCADefinitions definitions = (SCADefinitions)model;
for (Intent intent : definitions.getPolicyIntents() ) {
policyDefinitionsResolver.addModel(intent);
}
-
+
for (PolicySet policySet : definitions.getPolicySets() ) {
policyDefinitionsResolver.addModel(policySet);
}
-
+
for (IntentAttachPointType attachPointType : definitions.getBindingTypes() ) {
policyDefinitionsResolver.addModel(attachPointType);
}
-
+
for (IntentAttachPointType attachPointType : definitions.getImplementationTypes() ) {
policyDefinitionsResolver.addModel(attachPointType);
}
@@ -550,7 +573,7 @@
}
}
}
-
+
for (URI anArtifactUri : compositeUris) {
URL artifactURL = packageProcessor.getArtifactURL(new URL(contribution.getLocation()), anArtifactUri);
@@ -560,7 +583,7 @@
artifact.setLocation(artifactURL.toString());
contribution.getArtifacts().add(artifact);
modelResolver.addModel(artifact);
-
+
model = this.artifactProcessor.read(contributionURL, anArtifactUri, artifactURL);
if (model != null) {
artifact.setModel(model);
@@ -571,9 +594,9 @@
}
/**
- * This utility method process each artifact and delegates to proper
+ * This utility method process each artifact and delegates to proper
* artifactProcessor to resolve the model references
- *
+ *
* @param contribution
* @throws ContributionException
*/
Modified: tuscany/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java (original)
+++ tuscany/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java Thu Apr 30 04:39:55 2009
@@ -6,22 +6,24 @@
* 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.core.databinding.module;
+import org.apache.axiom.om.OMElement;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.core.databinding.processor.DataBindingJavaInterfaceProcessor;
import org.apache.tuscany.sca.core.databinding.processor.WrapperJavaInterfaceProcessor;
import org.apache.tuscany.sca.core.databinding.transformers.Array2ArrayTransformer;
@@ -30,14 +32,14 @@
import org.apache.tuscany.sca.core.databinding.transformers.CallableReferenceXMLAdapter;
import org.apache.tuscany.sca.core.databinding.transformers.Exception2ExceptionTransformer;
import org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer;
+import org.apache.tuscany.sca.core.databinding.transformers.OMElementXMLAdapter;
import org.apache.tuscany.sca.core.databinding.transformers.Output2OutputTransformer;
import org.apache.tuscany.sca.core.databinding.transformers.XMLStreamReader2CallableReference;
-import org.apache.tuscany.sca.core.databinding.transformers.OMElementXMLAdapter;
import org.apache.tuscany.sca.core.databinding.wire.DataBindingRuntimeWireProcessor;
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.Mediator;
import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
import org.apache.tuscany.sca.databinding.impl.Group2GroupTransformer;
-import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
import org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint;
import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
@@ -46,7 +48,6 @@
import org.apache.tuscany.sca.interfacedef.java.jaxws.WebServiceInterfaceProcessor;
import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
import org.osoa.sca.CallableReference;
-import org.apache.axiom.om.OMElement;
/**
* @version $Rev$ $Date$
@@ -61,8 +62,9 @@
xmlAdapterExtensionPoint.addAdapter(CallableReference.class, CallableReferenceXMLAdapter.class);
xmlAdapterExtensionPoint.addAdapter(OMElement.class, OMElementXMLAdapter.class);
FaultExceptionMapper faultExceptionMapper = new JAXWSFaultExceptionMapper(dataBindings, xmlAdapterExtensionPoint);
-
- MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+
+ Mediator mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
+
Input2InputTransformer input2InputTransformer = new Input2InputTransformer();
input2InputTransformer.setMediator(mediator);
transformers.addTransformer(input2InputTransformer, true);
@@ -73,7 +75,7 @@
Exception2ExceptionTransformer exception2ExceptionTransformer = new Exception2ExceptionTransformer(mediator, faultExceptionMapper);
transformers.addTransformer(exception2ExceptionTransformer, false);
-
+
Array2ArrayTransformer array2ArrayTransformer = new Array2ArrayTransformer();
array2ArrayTransformer.setMediator(mediator);
transformers.addTransformer(array2ArrayTransformer, true);
@@ -81,14 +83,14 @@
Group2GroupTransformer group2GroupTransformer = new Group2GroupTransformer();
group2GroupTransformer.setMediator(mediator);
transformers.addTransformer(group2GroupTransformer, true);
-
+
dataBindings.addDataBinding(new CallableReferenceDataBinding());
transformers.addTransformer(new CallableReference2XMLStreamReader(), true);
transformers.addTransformer(new XMLStreamReader2CallableReference(), false);
ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- // Add the WebServiceInterfaceProcessor to mark the interface remotable
+ // Add the WebServiceInterfaceProcessor to mark the interface remotable
javaFactory.addInterfaceVisitor(new WebServiceInterfaceProcessor());
// Introspect the data types
javaFactory.addInterfaceVisitor(new DataBindingJavaInterfaceProcessor(dataBindings));
@@ -100,7 +102,7 @@
if (wireProcessorExtensionPoint != null) {
wireProcessorExtensionPoint.addWireProcessor(new DataBindingRuntimeWireProcessor(mediator, dataBindings, faultExceptionMapper));
}
-
+
}
public void stop(ExtensionPointRegistry registry) {
Modified: tuscany/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java (original)
+++ tuscany/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.databinding;
@@ -28,6 +28,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
import org.apache.tuscany.sca.databinding.javabeans.JavaExceptionDataBinding;
import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
@@ -39,10 +40,11 @@
/**
* The default implementation of a data binding extension point.
- *
+ *
* @version $Rev$ $Date$
*/
public class DefaultDataBindingExtensionPoint implements DataBindingExtensionPoint {
+ private ExtensionPointRegistry registry;
private final Map<String, DataBinding> bindings = new HashMap<String, DataBinding>();
private final List<DataBinding> databindings = new ArrayList<DataBinding>();
private static final Logger logger = Logger.getLogger(DefaultDataBindingExtensionPoint.class.getName());
@@ -51,6 +53,10 @@
public DefaultDataBindingExtensionPoint() {
}
+ public DefaultDataBindingExtensionPoint(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ }
+
public DataBinding getDataBinding(String id) {
if (id == null) {
return null;
@@ -121,7 +127,7 @@
* A data binding facade allowing data bindings to be lazily loaded and
* initialized.
*/
- private static class LazyDataBinding implements DataBinding {
+ private class LazyDataBinding implements DataBinding {
private String name;
private ServiceDeclaration dataBindingDeclaration;
@@ -134,7 +140,7 @@
/**
* Load and instantiate the data binding class.
- *
+ *
* @return The data binding.
*/
@SuppressWarnings("unchecked")
@@ -142,8 +148,14 @@
if (dataBinding == null) {
try {
Class<DataBinding> dataBindingClass = (Class<DataBinding>)dataBindingDeclaration.loadClass();
- Constructor<DataBinding> constructor = dataBindingClass.getConstructor();
- dataBinding = constructor.newInstance();
+ try {
+ Constructor<DataBinding> constructor = dataBindingClass.getConstructor();
+ dataBinding = constructor.newInstance();
+ } catch (NoSuchMethodException e) {
+ Constructor<DataBinding> constructor =
+ dataBindingClass.getConstructor(ExtensionPointRegistry.class);
+ dataBinding = constructor.newInstance(DefaultDataBindingExtensionPoint.this.registry);
+ }
} catch (Exception e) {
throw new IllegalStateException(e);
}
Modified: tuscany/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java (original)
+++ tuscany/branches/sca-java-1.x/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java Thu Apr 30 04:39:55 2009
@@ -6,23 +6,25 @@
* 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.databinding.impl;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
import org.apache.tuscany.sca.databinding.DataPipe;
import org.apache.tuscany.sca.databinding.DataPipeTransformer;
@@ -43,15 +45,21 @@
* @version $Rev$ $Date$
*/
public class MediatorImpl implements Mediator {
-
+ private ExtensionPointRegistry registry;
private DataBindingExtensionPoint dataBindings;
private TransformerExtensionPoint transformers;
- public MediatorImpl(DataBindingExtensionPoint dataBindings, TransformerExtensionPoint transformers) {
+ MediatorImpl(DataBindingExtensionPoint dataBindings, TransformerExtensionPoint transformers) {
this.dataBindings = dataBindings;
this.transformers = transformers;
}
+ public MediatorImpl(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ this.dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ this.transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ }
+
@SuppressWarnings("unchecked")
public Object mediate(Object source, DataType sourceDataType, DataType targetDataType, Map<String, Object> metadata) {
if (sourceDataType == null || sourceDataType.getDataBinding() == null) {
@@ -103,7 +111,7 @@
DataType targetType =
(index == size - 1) ? targetDataType : new DataTypeImpl<Object>(transformer.getTargetDataBinding(),
Object.class, targetDataType.getLogical());
-
+
//FIXME The ClassLoader should be passed in
// Allow privileged access to get ClassLoader. Requires RuntimePermission in security
// policy.
@@ -111,9 +119,15 @@
public ClassLoader run() {
return Thread.currentThread().getContextClassLoader();
}
- });
-
- TransformationContext context = new TransformationContextImpl(sourceType, targetType, classLoader, metadata);
+ });
+
+ Map<String, Object> copy = new HashMap<String, Object>();
+ if (metadata != null) {
+ copy.putAll(metadata);
+ }
+ copy.put(ExtensionPointRegistry.class.getName(), registry);
+
+ TransformationContext context = new TransformationContextImpl(sourceType, targetType, classLoader, copy);
return context;
}
Added: tuscany/branches/sca-java-1.x/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.Mediator
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.Mediator?rev=770058&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.Mediator (added)
+++ tuscany/branches/sca-java-1.x/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.Mediator Thu Apr 30 04:39:55 2009
@@ -0,0 +1,17 @@
+# 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.
+org.apache.tuscany.sca.databinding.impl.MediatorImpl
\ No newline at end of file
Modified: tuscany/branches/sca-java-1.x/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java (original)
+++ tuscany/branches/sca-java-1.x/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.extension.helper.impl;
@@ -31,9 +31,8 @@
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.databinding.Mediator;
import org.apache.tuscany.sca.extension.helper.ImplementationActivator;
import org.apache.tuscany.sca.extension.helper.utils.DefaultPropertyValueObjectFactory;
import org.apache.tuscany.sca.extension.helper.utils.PropertyValueObjectFactory;
@@ -50,16 +49,14 @@
public class ImplementationsActivator implements ModuleActivator {
protected List<ImplementationActivator> implementationActivators;
-
+
public void start(ExtensionPointRegistry registry) {
ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
- DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
- TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
- MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
-
+ Mediator mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
+
//FIXME Pass this factory differently as it's not an extension point
PropertyValueObjectFactory propertyFactory = new DefaultPropertyValueObjectFactory(mediator);
registry.addExtensionPoint(propertyFactory);
Modified: tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java (original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.implementation.java.injection;
@@ -26,6 +26,8 @@
import org.apache.tuscany.sca.assembly.ComponentProperty;
import org.apache.tuscany.sca.assembly.Property;
import org.apache.tuscany.sca.context.PropertyValueFactory;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.core.factory.ObjectCreationException;
import org.apache.tuscany.sca.core.factory.ObjectFactory;
import org.apache.tuscany.sca.databinding.Mediator;
@@ -55,7 +57,11 @@
public JavaPropertyValueObjectFactory(Mediator mediator) {
this.mediator = mediator;
}
-
+
+ public JavaPropertyValueObjectFactory(ExtensionPointRegistry registry) {
+ this.mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
+ }
+
public ObjectFactory createValueFactory(Property property, Object propertyValue, JavaElementImpl javaElement) {
isSimpleType = isSimpleType(property);
Document doc = (Document)propertyValue;
@@ -131,7 +137,7 @@
}
}
- }
+ }
private boolean isSimpleType(Property property) {
if (property.getXSDType() != null) {
@@ -227,10 +233,10 @@
try {
return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
} catch (NumberFormatException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
+ throw new ObjectCreationException("Failed to create instance for property "
+ property.getName() + " with value " + propertyValue, ex);
} catch (IllegalArgumentException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
+ throw new ObjectCreationException("Failed to create instance for property "
+ property.getName() + " with value " + propertyValue, ex);
}
} else {
@@ -253,12 +259,12 @@
try {
values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
} catch (NumberFormatException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
- + property.getName() + " with value " + aValue
+ throw new ObjectCreationException("Failed to create instance for property "
+ + property.getName() + " with value " + aValue
+ " from value list of " + propertyValue, ex);
} catch (IllegalArgumentException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
- + property.getName() + " with value " + aValue
+ throw new ObjectCreationException("Failed to create instance for property "
+ + property.getName() + " with value " + aValue
+ " from value list of " + propertyValue, ex);
}
}
@@ -272,7 +278,7 @@
}
}
}
-
+
public class ArrayObjectFactoryImpl extends ObjectFactoryImplBase {
public ArrayObjectFactoryImpl(Property property, List<?> propertyValues, boolean isSimpleType, Class javaType) {
super(property, propertyValues, isSimpleType, javaType);
@@ -287,11 +293,11 @@
try {
Array.set(values, count++, simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
} catch (NumberFormatException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
+ throw new ObjectCreationException("Failed to create instance for property "
+ property.getName() + " with value " + aValue
+ " from value list of " + propertyValue, ex);
} catch (IllegalArgumentException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
+ throw new ObjectCreationException("Failed to create instance for property "
+ property.getName() + " with value " + aValue
+ " from value list of " + propertyValue, ex);
}
@@ -310,11 +316,11 @@
/**
* This method will create an instance of the value for the specified Property.
- *
+ *
* @param property The Property from which to retrieve the property value
* @param type The type of the property value being retrieved from the Property
* @param <B> Type type of the property value being looked up
- *
+ *
* @return the value for the Property
*/
public <B> B createPropertyValue(ComponentProperty property, Class<B> type)
Modified: tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java (original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.implementation.java.invocation;
@@ -37,6 +37,7 @@
import org.apache.tuscany.sca.assembly.Multiplicity;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
import org.apache.tuscany.sca.context.RequestContextFactory;
import org.apache.tuscany.sca.core.context.ComponentContextImpl;
import org.apache.tuscany.sca.core.context.InstanceWrapper;
@@ -68,7 +69,7 @@
/**
* The runtime instantiation of Java component implementations
- *
+ *
* @version $Rev$ $Date$
*/
public class JavaComponentContextProvider {
@@ -81,7 +82,7 @@
public JavaComponentContextProvider(RuntimeComponent component,
JavaInstanceFactoryProvider configuration,
DataBindingExtensionPoint dataBindingExtensionPoint,
- JavaPropertyValueObjectFactory propertyValueObjectFactory,
+ PropertyValueFactory propertyValueObjectFactory,
ComponentContextFactory componentContextFactory,
RequestContextFactory requestContextFactory) {
super();
@@ -94,7 +95,7 @@
// }
this.component = component;
this.dataBindingRegistry = dataBindingExtensionPoint;
- this.propertyValueFactory = propertyValueObjectFactory;
+ this.propertyValueFactory = (JavaPropertyValueObjectFactory) propertyValueObjectFactory;
}
InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
@@ -132,7 +133,7 @@
ObjectFactory<?> propertyObjectFactory =
createPropertyValueFactory(configuredProperty, configuredProperty.getValue(), element);
instanceFactoryProvider.setObjectFactory(element, propertyObjectFactory);
-
+
JavaConstructorImpl constructor = instanceFactoryProvider.getImplementation().getConstructor();
for(JavaElementImpl p: constructor.getParameters()){
if(element.getName().equals(p.getName())) {
@@ -265,7 +266,7 @@
}
// We need to set the PropertyValueFactory on the ComponentContextImpl
- // so the ComponentContext can "de-marshal" the property type to a value
+ // so the ComponentContext can "de-marshal" the property type to a value
// when the getProperty() method is called
ComponentContextImpl ccImpl = (ComponentContextImpl)component.getComponentContext();
ccImpl.setPropertyValueFactory(propertyValueFactory);
Modified: tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java (original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.implementation.java.invocation;
@@ -24,6 +24,7 @@
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
import org.apache.tuscany.sca.context.RequestContextFactory;
import org.apache.tuscany.sca.core.context.InstanceWrapper;
import org.apache.tuscany.sca.core.factory.ObjectFactory;
@@ -33,7 +34,6 @@
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
import org.apache.tuscany.sca.implementation.java.JavaImplementation;
import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
import org.apache.tuscany.sca.implementation.java.injection.RequestContextObjectFactory;
import org.apache.tuscany.sca.implementation.java.injection.ResourceHost;
import org.apache.tuscany.sca.implementation.java.injection.ResourceObjectFactory;
@@ -55,12 +55,12 @@
private JavaImplementation implementation;
private JavaComponentContextProvider componentContextProvider;
private RequestContextFactory requestContextFactory;
-
+
public JavaImplementationProvider(RuntimeComponent component,
JavaImplementation implementation,
ProxyFactory proxyService,
DataBindingExtensionPoint dataBindingRegistry,
- JavaPropertyValueObjectFactory propertyValueObjectFactory,
+ PropertyValueFactory propertyValueObjectFactory,
ComponentContextFactory componentContextFactory,
RequestContextFactory requestContextFactory,
List<PolicyHandlerTuple> policyHandlerClassNames) {
@@ -68,16 +68,16 @@
this.implementation = implementation;
this.requestContextFactory = requestContextFactory;
this.implementation.setPolicyHandlerClassNames(policyHandlerClassNames);
-
+
try {
JavaInstanceFactoryProvider configuration = new JavaInstanceFactoryProvider(implementation);
configuration.setProxyFactory(proxyService);
componentContextProvider =
- new JavaComponentContextProvider(component,
- configuration,
+ new JavaComponentContextProvider(component,
+ configuration,
dataBindingRegistry,
propertyValueObjectFactory,
- componentContextFactory,
+ componentContextFactory,
requestContextFactory);
Scope scope = getScope();
@@ -110,9 +110,9 @@
} catch (Exception e) {
throw new IllegalStateException(e);
}
-
+
}
-
+
private void handleResources(JavaImplementation componentType, ProxyFactory proxyService) {
for (JavaResourceImpl resource : componentType.getResources().values()) {
String name = resource.getName();
@@ -169,7 +169,7 @@
}
}
}
-
+
public boolean supportsOneWayInvocation() {
return false;
}
Modified: tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java (original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java Thu Apr 30 04:39:55 2009
@@ -6,15 +6,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.
*/
package org.apache.tuscany.sca.implementation.java.invocation;
@@ -22,11 +22,11 @@
import java.util.List;
import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
import org.apache.tuscany.sca.context.RequestContextFactory;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
import org.apache.tuscany.sca.provider.ImplementationProvider;
import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
@@ -36,7 +36,7 @@
* @version $Rev$ $Date$
*/
public class JavaImplementationProviderFactory implements ImplementationProviderFactory<JavaImplementation> {
- private JavaPropertyValueObjectFactory propertyValueObjectFactory;
+ private PropertyValueFactory propertyValueObjectFactory;
private DataBindingExtensionPoint dataBindingRegistry;
private ProxyFactory proxyService;
private ComponentContextFactory componentContextFactory;
@@ -45,7 +45,7 @@
public JavaImplementationProviderFactory(ProxyFactory proxyService,
DataBindingExtensionPoint dataBindingRegistry,
- JavaPropertyValueObjectFactory propertyValueObjectFactory,
+ PropertyValueFactory propertyValueObjectFactory,
ComponentContextFactory componentContextFactory,
RequestContextFactory requestContextFactory,
List<PolicyHandlerTuple> policyHandlerClassNames) {
@@ -60,12 +60,12 @@
public ImplementationProvider createImplementationProvider(RuntimeComponent component,
JavaImplementation implementation) {
- return new JavaImplementationProvider(component,
- implementation,
- proxyService,
+ return new JavaImplementationProvider(component,
+ implementation,
+ proxyService,
dataBindingRegistry,
- propertyValueObjectFactory,
- componentContextFactory,
+ propertyValueObjectFactory,
+ componentContextFactory,
requestContextFactory,
policyHandlerClassNames);
}
Modified: tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java?rev=770058&r1=770057&r2=770058&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java (original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java Thu Apr 30 04:39:55 2009
@@ -6,25 +6,25 @@
* 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.implementation.java.module;
import java.util.List;
-import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.tuscany.sca.context.ComponentContextFactory;
import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
import org.apache.tuscany.sca.context.RequestContextFactory;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
@@ -35,9 +35,7 @@
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.databinding.Mediator;
import org.apache.tuscany.sca.implementation.java.invocation.JavaCallbackRuntimeWireProcessor;
import org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProviderFactory;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
@@ -62,7 +60,7 @@
ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
-
+
UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
InterfaceContractMapper interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
@@ -76,9 +74,8 @@
JavaInterfaceFactory javaFactory = factories.getFactory(JavaInterfaceFactory.class);
DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
- TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
- MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
- JavaPropertyValueObjectFactory factory = new JavaPropertyValueObjectFactory(mediator);
+ Mediator mediator = utilities.getUtility(Mediator.class);
+ PropertyValueFactory factory = utilities.getUtility(PropertyValueFactory.class);
ContextFactoryExtensionPoint contextFactories = registry.getExtensionPoint(ContextFactoryExtensionPoint.class);
ComponentContextFactory componentContextFactory = contextFactories.getFactory(ComponentContextFactory.class);
@@ -86,9 +83,9 @@
List<PolicyHandlerTuple> policyHandlerClassNames = null;
policyHandlerClassNames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
-
+
ProxyFactory proxyFactory = new ExtensibleProxyFactory(proxyFactories);
-
+
JavaImplementationProviderFactory javaImplementationProviderFactory =
new JavaImplementationProviderFactory(proxyFactory, dataBindings, factory, componentContextFactory,
requestContextFactory, policyHandlerClassNames);
Added: tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory?rev=770058&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory (added)
+++ tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory Thu Apr 30 04:39:55 2009
@@ -0,0 +1,17 @@
+# 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.
+org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory
\ No newline at end of file