You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2008/03/19 15:26:42 UTC
svn commit: r638840 - in /incubator/tuscany/java/sca/modules:
assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/
policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/
Author: svkrish
Date: Wed Mar 19 07:26:30 2008
New Revision: 638840
URL: http://svn.apache.org/viewvc?rev=638840&view=rev
Log:
fixing resolution of intentattachpointtypes and fixing composite preprocessing for applicablepolicySets for the case of multiple contributions with their own definitions.xml
Modified:
incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java
Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java?rev=638840&r1=638839&r2=638840&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java Wed Mar 19 07:26:30 2008
@@ -24,6 +24,7 @@
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
+import java.net.URLConnection;
import java.util.Collection;
import java.util.Hashtable;
import java.util.List;
@@ -69,18 +70,26 @@
public Composite read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
InputStream scdlStream = null;
try {
- if ( domainPolicySets == null ) {
+ if (scaDefnSink != null ) {
fillDomainPolicySets(scaDefnSink);
}
+
byte[] transformedArtifactContent = null;
try {
- transformedArtifactContent =
- PolicyComputationUtils.addApplicablePolicySets(url, domainPolicySets);
+ if ( domainPolicySets != null ) {
+ transformedArtifactContent =
+ PolicyComputationUtils.addApplicablePolicySets(url, domainPolicySets);
+ scdlStream = new ByteArrayInputStream(transformedArtifactContent);
+ } else {
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ scdlStream = connection.getInputStream();
+ }
} catch ( Exception e ) {
throw new ContributionReadException(e);
}
- scdlStream = new ByteArrayInputStream(transformedArtifactContent);
+
XMLStreamReader reader = inputFactory.createXMLStreamReader(scdlStream);
reader.nextTag();
@@ -138,8 +147,16 @@
}
private void fillDomainPolicySets(List scaDefnsSink) {
- Map<QName, PolicySet> domainPolicySetMap = new Hashtable<QName, PolicySet>();
- if ( scaDefnsSink != null ) {
+ Map<QName, PolicySet> domainPolicySetMap = null;
+ if ( !scaDefnsSink.isEmpty() ) {
+ domainPolicySetMap = new Hashtable<QName, PolicySet>();
+
+ if ( domainPolicySets != null ) {
+ for ( PolicySet policySet : domainPolicySets ) {
+ domainPolicySetMap.put(policySet.getName(), policySet);
+ }
+ }
+
for ( Object object : scaDefnsSink ) {
if ( object instanceof SCADefinitions ) {
for ( PolicySet policySet : ((SCADefinitions)object).getPolicySets() ) {
@@ -147,7 +164,8 @@
}
}
}
+ domainPolicySets = domainPolicySetMap.values();
+ scaDefnsSink.clear();
}
- domainPolicySets = domainPolicySetMap.values();
}
}
Modified: incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java?rev=638840&r1=638839&r2=638840&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java Wed Mar 19 07:26:30 2008
@@ -44,7 +44,7 @@
}
@Override
- public IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
+ protected IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
if ( extnType instanceof BindingTypeImpl ) {
BindingTypeImpl bindingType = (BindingTypeImpl)extnType;
return resolver.resolveModel(BindingTypeImpl.class, bindingType);
Modified: incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java?rev=638840&r1=638839&r2=638840&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java Wed Mar 19 07:26:30 2008
@@ -45,7 +45,7 @@
}
@Override
- public IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
+ protected IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
if ( extnType instanceof ImplementationTypeImpl ) {
ImplementationTypeImpl implType = (ImplementationTypeImpl)extnType;
return resolver.resolveModel(ImplementationTypeImpl.class, implType);
Modified: incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java?rev=638840&r1=638839&r2=638840&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java Wed Mar 19 07:26:30 2008
@@ -50,7 +50,7 @@
private IntentAttachPointTypeFactory attachPointTypeFactory;
private PolicyFactory policyFactory;
- public abstract IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException;
+ protected abstract IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException;
public IntentAttachPointTypeProcessor(PolicyFactory policyFactory, IntentAttachPointTypeFactory attachPointTypeFactory, StAXArtifactProcessor<Object> extensionProcessor) {
this.policyFactory = policyFactory;
@@ -64,7 +64,7 @@
if ( type.getLocalPart().startsWith(BINDING) ) {
IntentAttachPointType bindingType = attachPointTypeFactory.createBindingType();
bindingType.setName(type);
- bindingType.setUnresolved(false);
+ bindingType.setUnresolved(true);
readAlwaysProvidedIntents(bindingType, reader);
readMayProvideIntents(bindingType, reader);
@@ -72,7 +72,7 @@
} else if ( type.getLocalPart().startsWith(IMPLEMENTATION) ) {
IntentAttachPointType implType = attachPointTypeFactory.createImplementationType();
implType.setName(type);
- implType.setUnresolved(false);
+ implType.setUnresolved(true);
readAlwaysProvidedIntents(implType, reader);
readMayProvideIntents(implType, reader);
@@ -157,11 +157,8 @@
public void resolve(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
resolveAlwaysProvidedIntents(extnType, resolver);
resolveMayProvideIntents(extnType, resolver);
- resolveExtensionType(extnType, resolver);
-
-/* if ( !extnType.isUnresolved() ) {
- resolver.addModel(extnType);
- }*/
+ extnType.setUnresolved(false);
+ //resolveExtensionType(extnType, resolver);
}
private void resolveAlwaysProvidedIntents(IntentAttachPointType extensionType,
@@ -171,9 +168,9 @@
List<Intent> alwaysProvided = new ArrayList<Intent>();
for (Intent providedIntent : extensionType.getAlwaysProvidedIntents()) {
if (providedIntent.isUnresolved()) {
- Intent resolvedProvidedIntent = resolver.resolveModel(Intent.class, providedIntent);
- if (resolvedProvidedIntent != null) {
- alwaysProvided.add(resolvedProvidedIntent);
+ providedIntent = resolver.resolveModel(Intent.class, providedIntent);
+ if (!providedIntent.isUnresolved()) {
+ alwaysProvided.add(providedIntent);
} else {
throw new ContributionResolveException(
"Always Provided Intent - " + providedIntent
@@ -197,9 +194,9 @@
List<Intent> mayProvide = new ArrayList<Intent>();
for (Intent providedIntent : extensionType.getMayProvideIntents()) {
if (providedIntent.isUnresolved()) {
- Intent resolvedProvidedIntent = resolver.resolveModel(Intent.class, providedIntent);
- if (resolvedProvidedIntent != null) {
- mayProvide.add(resolvedProvidedIntent);
+ providedIntent = resolver.resolveModel(Intent.class, providedIntent);
+ if (!providedIntent.isUnresolved()) {
+ mayProvide.add(providedIntent);
} else {
throw new ContributionResolveException(
"May Provide Intent - " + providedIntent
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org