summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-08-14 06:54:03 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-08-14 06:54:03 +0000
commit1d6516b79fb3a086b7002bfdda54ac2651ca58be (patch)
treed2f2a1a78ebe68ea8f44bd0c299c27ff105dc4ad
parenta0cde52968abd25f8d86804b90177c7a44ceb1a5 (diff)
Remove calls to XMLStreamWriter.setPrefix() as writeNamespace() invokes it internally (TUSCANY-3212)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@804091 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--branches/sca-java-1.5.1/itest/workspace-manager/src/main/java/org/apache/tuscany/sca/implementation/xyz/ImplementationXYZProcessor.java4
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java29
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java43
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java45
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java14
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java6
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java21
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java37
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java12
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite16
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java1
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java1
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java53
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java3
-rw-r--r--branches/sca-java-1.5.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java1
-rw-r--r--branches/sca-java-1.5.1/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java1
17 files changed, 151 insertions, 167 deletions
diff --git a/branches/sca-java-1.5.1/itest/workspace-manager/src/main/java/org/apache/tuscany/sca/implementation/xyz/ImplementationXYZProcessor.java b/branches/sca-java-1.5.1/itest/workspace-manager/src/main/java/org/apache/tuscany/sca/implementation/xyz/ImplementationXYZProcessor.java
index e70d22a0f6..792732e73f 100644
--- a/branches/sca-java-1.5.1/itest/workspace-manager/src/main/java/org/apache/tuscany/sca/implementation/xyz/ImplementationXYZProcessor.java
+++ b/branches/sca-java-1.5.1/itest/workspace-manager/src/main/java/org/apache/tuscany/sca/implementation/xyz/ImplementationXYZProcessor.java
@@ -28,16 +28,13 @@ import javax.xml.stream.XMLStreamWriter;
import org.apache.tuscany.sca.artifact.xyz.XYZ;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.policy.PolicyFactory;
@@ -149,7 +146,6 @@ public class ImplementationXYZProcessor implements StAXArtifactProcessor<Impleme
public void write(ImplementationXYZ implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
// Write <implementation.xyz> element
- policyProcessor.writePolicyPrefixes(implementation, writer);
writer.writeStartElement(IMPLEMENTATION_XYZ.getNamespaceURI(), IMPLEMENTATION_XYZ.getLocalPart());
policyProcessor.writePolicyAttributes(implementation, writer);
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java
index aa4980fcb6..0f062dbda5 100644
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java
+++ b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java
@@ -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.assembly.xml;
@@ -34,8 +34,8 @@ import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.policy.PolicyFactory;
import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.PolicyFactory;
/**
* Processor for dealing with 'operation' elements from composite definitions
@@ -43,27 +43,27 @@ import org.apache.tuscany.sca.monitor.Monitor;
* @version $Rev$ $Date$
*/
public class ConfiguredOperationProcessor implements StAXArtifactProcessor<ConfiguredOperation>, Constants{
-
+
private AssemblyFactory assemblyFactory;
private PolicyAttachPointProcessor policyProcessor;
private PolicyFactory policyFactory;
private Monitor monitor;
-
+
public ConfiguredOperationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
this.monitor = monitor;
}
-
+
public ConfiguredOperation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
ConfiguredOperation configuredOp = assemblyFactory.createConfiguredOperation();
-
+
//Read an <operation>
configuredOp.setName(reader.getAttributeValue(null, NAME));
configuredOp.setContractName(reader.getAttributeValue(null, SERVICE));
configuredOp.setUnresolved(true);
-
+
// Read policies
policyProcessor.readPolicies(configuredOp, reader);
@@ -73,15 +73,14 @@ public class ConfiguredOperationProcessor implements StAXArtifactProcessor<Confi
break;
}
}
-
+
return configuredOp;
}
-
+
public void write(ConfiguredOperation configuredOperation, XMLStreamWriter writer)
throws ContributionWriteException, XMLStreamException {
// Write an <operation>
- policyProcessor.writePolicyPrefixes(configuredOperation, writer);
writer.writeStartElement(Constants.SCA10_NS, OPERATION);
policyProcessor.writePolicyAttributes(configuredOperation, writer);
@@ -91,15 +90,15 @@ public class ConfiguredOperationProcessor implements StAXArtifactProcessor<Confi
}
writer.writeEndElement();
}
-
+
public void resolve(ConfiguredOperation configuredOperation, ModelResolver resolver)
throws ContributionResolveException {
}
-
+
public QName getArtifactType() {
return OPERATION_QNAME;
}
-
+
public Class<ConfiguredOperation> getModelType() {
return ConfiguredOperation.class;
}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
index fc4e10654d..44be1b6de1 100644
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
+++ b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
@@ -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.assembly.xml;
@@ -43,9 +43,9 @@ import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
* @version $Rev$ $Date$
*/
public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implements Constants {
-
+
private PolicyFactory policyFactory;
-
+
public PolicyAttachPointProcessor(PolicyFactory policyFactory) {
this.policyFactory = policyFactory;
}
@@ -123,7 +123,7 @@ public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implem
policySets.add(policySet);
}
}
-
+
value = reader.getAttributeValue(SCA10_TUSCANY_NS, APPLICABLE_POLICY_SETS);
if (value != null) {
List<PolicySet> applicablePolicySets = policySetAttachPoint.getApplicablePolicySets();
@@ -140,7 +140,7 @@ public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implem
}
}
}
-
+
/**
* Write policies
* @param attachPoint
@@ -160,15 +160,6 @@ public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implem
}
/**
- * Write policies
- * @param attachPoint
- * @return
- */
- public void writePolicyPrefixes(Object attachPoint, XMLStreamWriter writer) throws XMLStreamException {
- writePolicyPrefixes(attachPoint, (Operation)null, writer);
- }
-
- /**
* Write policies associated with an operation
* @param attachPoint
* @param operation
@@ -234,14 +225,14 @@ public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implem
}
return new XAttr(Constants.POLICY_SETS, qnames);
}
-
+
public void resolvePolicies(Object attachPoint, ModelResolver resolver) {
if ( attachPoint instanceof PolicySetAttachPoint ) {
PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)attachPoint;
-
+
List<Intent> requiredIntents = new ArrayList<Intent>();
Intent resolvedIntent = null;
-
+
if ( policySetAttachPoint.getRequiredIntents() != null && policySetAttachPoint.getRequiredIntents().size() > 0 ) {
for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) {
resolvedIntent = resolver.resolveModel(Intent.class, intent);
@@ -250,7 +241,7 @@ public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implem
policySetAttachPoint.getRequiredIntents().clear();
policySetAttachPoint.getRequiredIntents().addAll(requiredIntents);
}
-
+
if ( policySetAttachPoint.getPolicySets() != null && policySetAttachPoint.getPolicySets().size() > 0 ) {
List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
PolicySet resolvedPolicySet = null;
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java b/branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
index 8c82ef2378..034aaf0339 100644
--- a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
+++ b/branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
@@ -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.sca.xml;
@@ -52,21 +52,21 @@ import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
*/
public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, Constants{
-
+
private SCABindingFactory scaBindingFactory;
private ExtensionFactory extensionFactory;
private PolicyFactory policyFactory;
private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
- private PolicyAttachPointProcessor policyProcessor;
+ private PolicyAttachPointProcessor policyProcessor;
private StAXAttributeProcessor<Object> extensionAttributeProcessor;
-
+
private Monitor monitor;
protected static final String BINDING_SCA = "binding.sca";
protected static final QName BINDING_SCA_QNAME = new QName(Constants.SCA10_NS, BINDING_SCA);
- public SCABindingProcessor(ModelFactoryExtensionPoint modelFactories,
+ public SCABindingProcessor(ModelFactoryExtensionPoint modelFactories,
StAXArtifactProcessor extensionProcessor,
StAXAttributeProcessor extensionAttributeProcessor,
Monitor monitor) {
@@ -74,9 +74,9 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C
this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
-
+
this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.extensionAttributeProcessor = extensionAttributeProcessor;
+ this.extensionAttributeProcessor = extensionAttributeProcessor;
this.monitor = monitor;
}
@@ -95,10 +95,10 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C
bindingType.setName(getArtifactType());
bindingType.setUnresolved(true);
((PolicySetAttachPoint)scaBinding).setType(bindingType);
-
+
// Read policies
policyProcessor.readPolicies(scaBinding, reader);
-
+
// Read binding name
String name = reader.getAttributeValue(null, NAME);
if (name != null) {
@@ -110,12 +110,12 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C
if (uri != null) {
scaBinding.setURI(uri);
}
-
+
// Handle extended attributes
for (int a = 0; a < reader.getAttributeCount(); a++) {
QName attributeName = reader.getAttributeName(a);
if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
- if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
+ if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
(! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
Extension attributeExtension;
@@ -127,7 +127,7 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C
scaBinding.getAttributeExtensions().add(attributeExtension);
}
}
- }
+ }
// Skip to end element
while (reader.hasNext()) {
@@ -137,15 +137,14 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C
}
return scaBinding;
}
-
+
public void resolve(SCABinding model, ModelResolver resolver) throws ContributionResolveException {
policyProcessor.resolvePolicies(model, resolver);
- }
+ }
public void write(SCABinding scaBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
// Write <binding.sca>
- policyProcessor.writePolicyPrefixes(scaBinding, writer);
writer.writeStartElement(Constants.SCA10_NS, BINDING_SCA);
policyProcessor.writePolicyAttributes(scaBinding, writer);
@@ -153,20 +152,20 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C
if (scaBinding.getName() != null) {
writer.writeAttribute(NAME, scaBinding.getName());
}
-
+
// Write binding URI
if (scaBinding.getURI() != null) {
writer.writeAttribute(URI, scaBinding.getURI());
}
-
+
// Write extended attributes
for(Extension extension : scaBinding.getAttributeExtensions()) {
if(extension.isAttribute()) {
extensionAttributeProcessor.write(extension, writer);
}
- }
-
+ }
+
writer.writeEndElement();
}
-
+
}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
index 0b09fdd507..a3dfcc3c5b 100644
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
+++ b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
@@ -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.ws.xml;
@@ -89,9 +89,9 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
private ConfiguredOperationProcessor configuredOperationProcessor;
private StAXAttributeProcessor<Object> extensionAttributeProcessor;
private Monitor monitor;
-
+
public WebServiceBindingProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) {
-
+
this.extensionPoints = extensionPoints;
ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
@@ -102,16 +102,16 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
this.monitor = monitor;
this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories, this.monitor);
-
+
XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
StAXAttributeProcessorExtensionPoint attributeExtensionPoint = extensionPoints.getExtensionPoint(StAXAttributeProcessorExtensionPoint.class);
this.extensionAttributeProcessor = new ExtensibleStAXAttributeProcessor(attributeExtensionPoint ,inputFactory, outputFactory, this.monitor);
}
-
+
/**
* Report a warning.
- *
+ *
* @param problem
* @param model
* @param message data
@@ -122,10 +122,10 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
monitor.problem(problem);
}
}
-
+
/**
* Report an error.
- *
+ *
* @param problem
* @param model
* @param message data
@@ -134,12 +134,12 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
if (monitor != null) {
Problem problem = new ProblemImpl(this.getClass().getName(), "binding-wsxml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
monitor.problem(problem);
- }
+ }
}
/**
* Report an exception.
- *
+ *
* @param problem
* @param model
* @param exception
@@ -148,7 +148,7 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
if (monitor != null) {
Problem problem = new ProblemImpl(this.getClass().getName(), "binding-wsxml-validation-messages", Severity.ERROR, model, message, ex);
monitor.problem(problem);
- }
+ }
}
public WebServiceBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
@@ -237,12 +237,12 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
// Read wsdlLocation
wsBinding.setLocation(reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION));
-
+
// Handle extended attributes
for (int a = 0; a < reader.getAttributeCount(); a++) {
QName attributeName = reader.getAttributeName(a);
if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI() != WSDLI_NS && attributeName.getNamespaceURI().length() > 0) {
- if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
+ if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
(! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
Extension attributeExtension;
@@ -294,7 +294,6 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
XMLStreamException {
// Write a <binding.ws>
- policyProcessor.writePolicyPrefixes(wsBinding, writer);
writer.writeStartElement(Constants.SCA10_NS, BINDING_WS);
policyProcessor.writePolicyAttributes(wsBinding, writer);
@@ -361,7 +360,7 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
extensionAttributeProcessor.write(extension, writer);
}
}
-
+
if (wsBinding.getEndPointReference() != null) {
EndPointReferenceHelper.writeEndPointReference(wsBinding.getEndPointReference(), writer);
}
@@ -370,10 +369,10 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
}
public void resolve(WebServiceBinding model, ModelResolver resolver) throws ContributionResolveException {
-
+
if (model == null || !model.isUnresolved())
return;
-
+
WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
wsdlDefinition.setUnresolved(true);
wsdlDefinition.setNamespace(model.getNamespace());
@@ -384,7 +383,7 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
ContributionResolveException ce = new ContributionResolveException(e.getCause());
error("ContributionResolveException", wsdlDefinition, ce);
//throw ce;
- }
+ }
if (resolved != null && !resolved.isUnresolved()) {
wsdlDefinition.setDefinition(resolved.getDefinition());
@@ -435,8 +434,8 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
ContributionResolveException ce = new ContributionResolveException("WSDL binding operation output name " + operation.getOutput().getName() + " does not match with PortType Definition");
error("ContributionResolveException", wsdlDefinition, ce);
}
- }
-
+ }
+
WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
WSDLInterface wsdlInterface = null;
try {
@@ -444,7 +443,7 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
interfaceContract.setInterface(wsdlInterface);
model.setBindingInterfaceContract(interfaceContract);
} catch (InvalidInterfaceException e) {
- warning("InvalidInterfaceException", wsdlFactory, model.getName());
+ warning("InvalidInterfaceException", wsdlFactory, model.getName());
}
}
}
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java
index 70398deaa9..d326324a5d 100644
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java
+++ b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java
@@ -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.processor.xml;
@@ -60,7 +60,7 @@ public class XMLDocumentStreamReader implements XMLStreamReader {
}
this.realReader = realReader;
-
+
if (realReader instanceof XMLFragmentStreamReader) {
((XMLFragmentStreamReader)realReader).init();
}
@@ -142,7 +142,11 @@ public class XMLDocumentStreamReader implements XMLStreamReader {
}
public String getCharacterEncodingScheme() {
+ if (isDelegating()) {
return realReader.getCharacterEncodingScheme();
+ } else {
+ return "UTF-8";
+ }
}
public String getElementText() throws XMLStreamException {
@@ -412,7 +416,7 @@ public class XMLDocumentStreamReader implements XMLStreamReader {
state = STATE_COMPLETED;
} else if (!realReader.hasNext()) {
state = STATE_COMPLETE_AT_NEXT;
- }
+ }
if (fragment && returnEvent == END_ELEMENT) {
level--;
if (level == -1) {
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
index 84ac93313d..a451316883 100644
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
+++ b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
@@ -208,7 +208,7 @@ public abstract class BaseStAXArtifactProcessor {
break;
}
}
- writer.setPrefix(prefix, uri);
+ // writer.setPrefix(prefix, uri);
return prefix;
}
@@ -484,7 +484,7 @@ public abstract class BaseStAXArtifactProcessor {
break;
}
}
- writer.setPrefix(prefix, uri);
+ // writer.setPrefix(prefix, uri);
writer.writeNamespace(prefix, uri);
return prefix + ":" + qname.getLocalPart();
}
@@ -516,7 +516,7 @@ public abstract class BaseStAXArtifactProcessor {
break;
}
}
- writer.setPrefix(prefix, uri);
+ // writer.setPrefix(prefix, uri);
writer.writeNamespace(prefix, uri);
}
}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java
index 8a83f630e9..8b99701baa 100644
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java
+++ b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java
@@ -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;
@@ -45,7 +45,7 @@ import org.apache.tuscany.sca.extension.helper.utils.AbstractBinding;
/**
* An SCDL ArtifactProcessor which uses the Binding class getters/setters
* to define the SCDL attributes.
- *
+ *
* TODO: merge this with SCDLProcessor
*
* @version $Rev$ $Date$
@@ -126,7 +126,7 @@ public class BindingSCDLProcessor implements StAXArtifactProcessor {
//FIXME: none of the attributes of Binding seem to be working with PojoBinding
// For now at least read the binding URI
String uri = reader.getAttributeValue(null, "uri");
-
+
if (elementTextSetter != null) {
try {
String value = reader.getElementText();
@@ -144,7 +144,7 @@ public class BindingSCDLProcessor implements StAXArtifactProcessor {
if (!(impl instanceof Binding)) {
impl = new PojoBinding(impl);
-
+
//FIXME: none of the attributes of Binding seem to be working with PojoBinding
// For now at least read the binding URI
if (uri != null) {
@@ -161,8 +161,8 @@ public class BindingSCDLProcessor implements StAXArtifactProcessor {
//FIXME: none of the attributes of Binding seem to be working with PojoBinding
// For now at least write the binding URI
-
- // Find a namespace prefix and write the element
+
+ // Find a namespace prefix and write the element
String prefix = writer.getPrefix(scdlQName.getNamespaceURI());
if (prefix == null) {
NamespaceContext nsc = writer.getNamespaceContext();
@@ -172,9 +172,10 @@ public class BindingSCDLProcessor implements StAXArtifactProcessor {
break;
}
}
- writer.setPrefix(prefix, scdlQName.getNamespaceURI());
+ // writer.setPrefix(prefix, scdlQName.getNamespaceURI());
}
writer.writeStartElement(scdlQName.getNamespaceURI(), scdlQName.getLocalPart());
+ writer.writeNamespace(prefix, scdlQName.getNamespaceURI());
// Write the binding URI attribute
String uri;
@@ -186,7 +187,7 @@ public class BindingSCDLProcessor implements StAXArtifactProcessor {
if (uri != null) {
writer.writeAttribute("uri", uri);
}
-
+
writer.writeEndElement();
}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
index b80440959b..7445209672 100644
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
+++ b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
@@ -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.xml;
@@ -98,10 +98,10 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm
this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories, this.monitor);
this.extensionAttributeProcessor = extensionAttributeProcessor;
}
-
+
/**
* Report a error.
- *
+ *
* @param problems
* @param message
* @param model
@@ -110,12 +110,12 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm
if (monitor != null) {
Problem problem = new ProblemImpl(this.getClass().getName(), "impl-javaxml-validation-messages", Severity.ERROR, model, message,(Object[])messageParameters);
monitor.problem(problem);
- }
+ }
}
-
+
/**
* Report a exception.
- *
+ *
* @param problems
* @param message
* @param model
@@ -124,32 +124,32 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm
if (monitor != null) {
Problem problem = new ProblemImpl(this.getClass().getName(), "impl-javaxml-validation-messages", Severity.ERROR, model, message, ex);
monitor.problem(problem);
- }
+ }
}
public JavaImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
// Read an <implementation.java>
JavaImplementation javaImplementation = javaFactory.createJavaImplementation();
-
+
/*if ( javaImplementation instanceof PolicySetAttachPoint ) {
IntentAttachPointType implType = intentAttachPointTypeFactory.createImplementationType();
implType.setName(getArtifactType());
implType.setUnresolved(true);
((PolicySetAttachPoint)javaImplementation).setType(implType);
}*/
-
+
javaImplementation.setUnresolved(true);
javaImplementation.setName(reader.getAttributeValue(null, CLASS));
// Read policies
policyProcessor.readPolicies(javaImplementation, reader);
-
+
// Handle extended attributes
for (int a = 0; a < reader.getAttributeCount(); a++) {
QName attributeName = reader.getAttributeName(a);
if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
- if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
+ if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
(! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
Extension attributeExtension;
@@ -163,7 +163,7 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm
}
}
-
+
// read operation elements if exists or skip unto end element
int event;
@@ -193,7 +193,6 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm
XMLStreamException {
// Write an <implementation.java>
- policyProcessor.writePolicyPrefixes(javaImplementation, writer);
writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_JAVA);
policyProcessor.writePolicyAttributes(javaImplementation, writer);
@@ -207,7 +206,7 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm
extensionAttributeProcessor.write(extension, writer);
}
}
-
+
writer.writeEndElement();
}
@@ -222,8 +221,8 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm
//throw new ContributionResolveException(new ClassNotFoundException(javaImplementation.getName()));
return;
}
-
- javaImplementation.setJavaClass(javaClass);
+
+ javaImplementation.setJavaClass(javaClass);
try {
javaFactory.createJavaImplementation(javaImplementation, javaImplementation.getJavaClass());
@@ -233,7 +232,7 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm
//throw ce;
return;
}
-
+
javaImplementation.setUnresolved(false);
mergeComponentType(resolver, javaImplementation);
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java
index 646b5db617..2ec09dae7a 100644
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java
+++ b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java
@@ -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.xml;
@@ -35,7 +35,7 @@ import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
/**
* Test writing Java implementations.
- *
+ *
* @version $Rev$ $Date$
*/
public class WriteTestCase extends TestCase {
@@ -43,12 +43,13 @@ public class WriteTestCase extends TestCase {
private StAXArtifactProcessor<Object> staxProcessor;
private XMLInputFactory inputFactory;
private XMLOutputFactory outputFactory;
-
+
@Override
public void setUp() throws Exception {
DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
inputFactory = XMLInputFactory.newInstance();
outputFactory = XMLOutputFactory.newInstance();
+ // outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
}
@@ -59,6 +60,7 @@ public class WriteTestCase extends TestCase {
assertNotNull(composite);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
+ System.out.println(new String(bos.toByteArray()));
}
}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
index a58fa0c072..c6a077ffa6 100644
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
+++ b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
@@ -7,21 +7,21 @@
* 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.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:calc="http://sample.calculator"
requires="cns:tuscanyIntent_1"
targetNamespace="http://sample.calculator"
- xmlns:cns="http://test"
+ xmlns:cns="http://test"
name="Calculator">
<service name="CalculatorService" promote="CalculatorServiceComponent">
@@ -51,16 +51,16 @@
<component name="DivideServiceComponent">
<implementation.java class="calculator.DivideServiceImpl"/>
</component>
-
+
<component name="AnotherCalculatorServiceComponent" requires="cns:tuscanyIntent_4">
<implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_5">
<operation name="add" requires="cns:tuscanyIntent_6"/>
- </implementation.java>
+ </implementation.java>
</component>
-
+
<component name="YetAnotherCalculatorServiceComponent" requires="cns:tuscanyIntent_4">
<implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_6.qualified1">
<operation name="add" requires="cns:tuscanyIntent_6.qualified2" policySets="cns:tuscanyPolicySet_4"/>
- </implementation.java>
+ </implementation.java>
</component>
</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java
index bb66d8f0ca..9059d2da26 100644
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java
+++ b/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java
@@ -304,7 +304,6 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem
public void write(JEEImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
// Write <implementation.jee>
- policyProcessor.writePolicyPrefixes(implementation, writer);
writeStart(writer, IMPLEMENTATION_JEE.getNamespaceURI(), IMPLEMENTATION_JEE.getLocalPart(),
new XAttr("archive", implementation.getArchive()));
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
index 7d99b4ed88..20bf2d0d94 100644
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
+++ b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
@@ -173,7 +173,6 @@ public class SpringImplementationProcessor implements StAXArtifactProcessor<Spri
public void write(SpringImplementation springImplementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
// Write <implementation.spring>
- policyProcessor.writePolicyPrefixes(springImplementation, writer);
writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
policyProcessor.writePolicyAttributes(springImplementation, writer);
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
index fdaaf703bb..2c7297ff86 100644
--- a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
+++ b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
@@ -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.widget;
@@ -41,56 +41,55 @@ import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
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;
-
/**
+ *
* Implements a StAX artifact processor for Widget implementations.
*
* @version $Rev$ $Date$
*/
public class WidgetImplementationProcessor implements StAXArtifactProcessor<WidgetImplementation> {
private static final QName IMPLEMENTATION_WIDGET = new QName(Constants.SCA10_TUSCANY_NS, "implementation.widget");
-
+
private AssemblyFactory assemblyFactory;
private ContributionFactory contributionFactory;
private WidgetImplementationFactory implementationFactory;
private Monitor monitor;
-
+
public WidgetImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- implementationFactory = new WidgetImplementationFactory(modelFactories);
+ implementationFactory = new WidgetImplementationFactory(modelFactories);
this.monitor = monitor;
}
-
+
/**
* Report a exception.
- *
+ *
* @param problems
* @param message
* @param model
*/
private void error(String message, Object model, Exception ex) {
if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-widget-validation-messages", Severity.ERROR, model, message, ex);
+ Problem problem = monitor.createProblem(this.getClass().getName(), "impl-widget-validation-messages", Severity.ERROR, model, message, ex);
monitor.problem(problem);
}
}
-
+
/**
* Report a error.
- *
+ *
* @param problems
* @param message
* @param model
*/
private void error(String message, Object model, Object... messageParameters) {
if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-widget-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ Problem problem = monitor.createProblem(this.getClass().getName(), "impl-widget-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
monitor.problem(problem);
}
- }
+ }
public QName getArtifactType() {
// Returns the QName of the XML element processed by this processor
@@ -111,7 +110,7 @@ public class WidgetImplementationProcessor implements StAXArtifactProcessor<Widg
// Read the location attribute specifying the location of the resources
String location = reader.getAttributeValue(null, "location");
- if (location != null) {
+ if (location != null) {
implementation = implementationFactory.createWidgetImplementation();
implementation.setLocation(location);
implementation.setUnresolved(true);
@@ -131,7 +130,7 @@ public class WidgetImplementationProcessor implements StAXArtifactProcessor<Widg
}
public void resolve(WidgetImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
-
+
if (implementation != null) {
// Resolve the resource directory location
Artifact artifact = contributionFactory.createArtifact();
@@ -139,13 +138,13 @@ public class WidgetImplementationProcessor implements StAXArtifactProcessor<Widg
Artifact resolved = resolver.resolveModel(Artifact.class, artifact);
if (resolved.getLocation() != null) {
try {
- implementation.setLocationURL(new URL(resolved.getLocation()));
-
+ implementation.setLocationURL(new URL(resolved.getLocation()));
+
//introspect implementation
- WidgetImplementationIntrospector widgetIntrospector =
+ WidgetImplementationIntrospector widgetIntrospector =
new WidgetImplementationIntrospector(assemblyFactory, implementation);
widgetIntrospector.introspectImplementation();
-
+
implementation.setUnresolved(false);
} catch (IOException e) {
ContributionResolveException ce = new ContributionResolveException(e);
@@ -154,23 +153,23 @@ public class WidgetImplementationProcessor implements StAXArtifactProcessor<Widg
}
} else {
error("CouldNotResolveLocation", resolver, implementation.getLocation());
- //throw new ContributionResolveException("Could not resolve implementation.widget location: " + implementation.getLocation());
+ //throw new ContributionResolveException("Could not resolve implementation.widget location: " + implementation.getLocation());
}
}
}
public void write(WidgetImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
+
// Write <implementation.widget>
- writer.setPrefix("widget",IMPLEMENTATION_WIDGET.getNamespaceURI());
+ // writer.setPrefix("widget",IMPLEMENTATION_WIDGET.getNamespaceURI());
writer.writeStartElement(IMPLEMENTATION_WIDGET.getNamespaceURI(), IMPLEMENTATION_WIDGET.getLocalPart());
writer.writeNamespace("widget",IMPLEMENTATION_WIDGET.getNamespaceURI());
-
-
+
+
if (implementation.getLocation() != null) {
writer.writeAttribute("location", implementation.getLocation());
}
-
+
writer.writeEndElement();
}
}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java
index 3417bd4936..b454289673 100644
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java
+++ b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
@@ -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.5.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java b/branches/sca-java-1.5.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
index 1a2b5bfe89..61ae9b9553 100644
--- a/branches/sca-java-1.5.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
+++ b/branches/sca-java-1.5.1/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
@@ -91,7 +91,6 @@ public class EchoBindingProcessor implements StAXArtifactProcessor<EchoBinding>
public void write(EchoBinding echoBinding, XMLStreamWriter writer) throws ContributionWriteException,
XMLStreamException {
- policyProcessor.writePolicyPrefixes(echoBinding, writer);
writer.writeStartElement(BINDING_ECHO.getNamespaceURI(), BINDING_ECHO.getLocalPart());
policyProcessor.writePolicyAttributes(echoBinding, writer);
diff --git a/branches/sca-java-1.5.1/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java b/branches/sca-java-1.5.1/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java
index 44a2cc0aa8..36bce82e09 100644
--- a/branches/sca-java-1.5.1/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java
+++ b/branches/sca-java-1.5.1/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java
@@ -161,7 +161,6 @@ public class POJOImplementationProcessor implements StAXArtifactProcessor<POJOIm
public void write(POJOImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
// Write <implementation.pojo> element
- policyProcessor.writePolicyPrefixes(implementation, writer);
writer.writeStartElement(IMPLEMENTATION_POJO.getNamespaceURI(), IMPLEMENTATION_POJO.getLocalPart());
policyProcessor.writePolicyAttributes(implementation, writer);