diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-16 07:48:18 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-16 07:48:18 +0000 |
commit | 83eb6de8bfa94a374d30a60dc95b608c13d710f7 (patch) | |
tree | bbad402ccf491b3aa2c1d1e387bb61af14ccdd64 /sca-java-2.x/trunk | |
parent | 8d862e6cc818a2dc820b912e9a67339cae24eb32 (diff) |
Add a method to Deployer to load a model from XML and validate the Monitor results
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1103639 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
2 files changed, 20 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java index e8750cf0ca..f85bab06f4 100644 --- a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java +++ b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java @@ -44,6 +44,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.LifeCycleListener; import org.apache.tuscany.sca.definitions.Definitions; import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.ValidationException; /** * A utility that provides system functions to handle Tuscany SCA application deployment @@ -128,6 +129,16 @@ public interface Deployer extends LifeCycleListener { /** * @param <T> + * @param reader + * @return + * @throws XMLStreamException + * @throws ContributionReadException + * @throws ValidationException + */ + <T> T loadXMLDocument(Reader reader) throws XMLStreamException, ContributionReadException, ValidationException; + + /** + * @param <T> * @param location * @param monitor * @return diff --git a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java index 1d4de5192d..890e95ccff 100644 --- a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java +++ b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java @@ -86,9 +86,10 @@ import org.apache.tuscany.sca.definitions.xml.DefinitionsExtensionPoint; import org.apache.tuscany.sca.deployment.Deployer; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.monitor.ValidationException; import org.apache.tuscany.sca.runtime.BaseDomainRegistry; -import org.apache.tuscany.sca.runtime.EndpointReferenceBinder; import org.apache.tuscany.sca.runtime.DomainRegistry; +import org.apache.tuscany.sca.runtime.EndpointReferenceBinder; import org.apache.tuscany.sca.runtime.InstalledContribution; import org.apache.tuscany.sca.xsd.XSDFactory; import org.apache.tuscany.sca.xsd.XSDefinition; @@ -699,6 +700,13 @@ public class DeployerImpl implements Deployer { return staxProcessor.read(reader, new ProcessorContext(monitor)); } + public Object loadXMLDocument(Reader document) throws XMLStreamException, ContributionReadException, ValidationException { + Monitor monitor = createMonitor(); + Object model = loadXMLDocument(document, monitor); + monitor.analyzeProblems(); + return model; + } + public Object loadXMLDocument(Reader document, Monitor monitor) throws XMLStreamException, ContributionReadException { init(); XMLStreamReader reader = staxHelper.createXMLStreamReader(document); |