You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by me...@apache.org on 2007/02/04 15:57:57 UTC
svn commit: r503420 - in /incubator/tuscany/java/sca/kernel:
core/src/main/java/org/apache/tuscany/core/component/
core/src/main/java/org/apache/tuscany/core/component/scope/
core/src/main/java/org/apache/tuscany/core/deployer/federation/
core/src/main...
Author: meerajk
Date: Sun Feb 4 06:57:56 2007
New Revision: 503420
URL: http://svn.apache.org/viewvc?view=rev&rev=503420
Log:
First cut of the new builder framework
Added:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/InstanceFactory.java (with props)
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/JavaPhysicalComponentDefinition.java (with props)
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/JavaPhysicalComponentDefinitionMarshaller.java
- copied, changed from r503407, incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/ComponentDefinitionMarshaller.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilder.java (with props)
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilderRegistry.java (with props)
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshallerRegistry.java (with props)
Removed:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/ComponentDefinitionMarshaller.java
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapper.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshaller.java
Added: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/InstanceFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/InstanceFactory.java?view=auto&rev=503420
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/InstanceFactory.java (added)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/InstanceFactory.java Sun Feb 4 06:57:56 2007
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.component;
+
+import org.apache.tuscany.core.component.scope.InstanceWrapper;
+
+/**
+ * Interface for the instance factory used for creating Java component
+ * instances. The implementation for this class may be generated
+ * dynamically by the naster runtime during deployment. The instnace
+ * factory is expected to be used by the physical component builder
+ * framework for creating component instances.
+ *
+ * @version $Rev$ $Date$
+ *
+ * @param <T> Type of the instance generated by the factory.
+ */
+public interface InstanceFactory<T> {
+
+ /**
+ * Creates a new instance of the component. The implementations are
+ * expected to wire the component using the necessary object factories.
+ * Teh expected convention is for the implementations to accept the
+ * factories in the constructor as a typed array.
+ *
+ * @return A wrapper for the created component instance.
+ */
+ InstanceWrapper<T> newInstance();
+}
Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/InstanceFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/InstanceFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/JavaPhysicalComponentDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/JavaPhysicalComponentDefinition.java?view=auto&rev=503420
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/JavaPhysicalComponentDefinition.java (added)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/JavaPhysicalComponentDefinition.java Sun Feb 4 06:57:56 2007
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.component;
+
+import org.apache.tuscany.spi.model.physical.PhysicalComponentDefinition;
+
+/**
+ * Represents the physical component definition for a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class JavaPhysicalComponentDefinition extends PhysicalComponentDefinition {
+
+ // The byte code for the instance factory
+ private byte[] instanceFactoryByteCode;
+
+ /**
+ * Gets the byte code for the instance factory.
+ * @return Byte code for the instance factory.
+ */
+ public byte[] getInstanceFactoryByteCode() {
+ return instanceFactoryByteCode;
+ }
+
+ /**
+ * Sets the byte code for the instance factory.
+ * @param instanceFactoryByteCode Byte code for the instance factory.
+ */
+ public void setInstanceFactoryByteCode(byte[] instanceFactoryByteCode) {
+ this.instanceFactoryByteCode = instanceFactoryByteCode;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/JavaPhysicalComponentDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/JavaPhysicalComponentDefinition.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapper.java?view=diff&rev=503420&r1=503419&r2=503420
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapper.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapper.java Sun Feb 4 06:57:56 2007
@@ -28,9 +28,9 @@
*
* @version $Rev$ $Date$
*/
-public interface InstanceWrapper {
+public interface InstanceWrapper<T> {
- Object getInstance();
+ T getInstance();
boolean isStarted();
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java?view=diff&rev=503420&r1=503419&r2=503420
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java Sun Feb 4 06:57:56 2007
@@ -19,23 +19,25 @@
package org.apache.tuscany.core.deployer.federation;
import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
import org.apache.tuscany.core.deployer.DeployerImpl;
-import org.apache.tuscany.core.deployer.RootDeploymentContext;
import org.apache.tuscany.spi.annotation.Autowire;
import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.builder.PhysicalComponentBuilder;
+import org.apache.tuscany.spi.builder.PhysicalComponentBuilderRegistry;
import org.apache.tuscany.spi.component.Component;
-import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.component.PrepareException;
import org.apache.tuscany.spi.component.ScopeContainer;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
import org.apache.tuscany.spi.marshaller.MarshalException;
import org.apache.tuscany.spi.marshaller.ModelMarshaller;
-import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.marshaller.ModelMarshallerRegistry;
+import org.apache.tuscany.spi.model.physical.PhysicalComponentDefinition;
import org.apache.tuscany.spi.services.discovery.DiscoveryService;
import org.apache.tuscany.spi.services.discovery.RequestListener;
+import org.apache.tuscany.spi.util.stax.StaxUtil;
/**
* Federated deployer that deploys components in response to asynchronous
@@ -49,8 +51,11 @@
/** QName of the message. */
private static final QName MESSAGE_TYPE = new QName("http://www.osoa.org/xmlns/sca/1.0", "composite");
- /** Marshaller. */
- private ModelMarshaller<ComponentDefinition<?>> marshaller;
+ /** Marshaller registry. */
+ private ModelMarshallerRegistry marshallerRegistry;
+
+ /** Physical component builder registry. */
+ private PhysicalComponentBuilderRegistry builderRegistry;
/**
* Deploys the component.
@@ -59,26 +64,30 @@
*
* TODO Handle response messages.
*/
+ @SuppressWarnings("unchecked")
public XMLStreamReader onRequest(XMLStreamReader content) {
- // TODO get this from somewhere
- final CompositeComponent parent = null;
-
final ScopeContainer scopeContainer = new CompositeScopeContainer(monitor);
scopeContainer.start();
- final DeploymentContext deploymentContext = new RootDeploymentContext(null, xmlFactory, scopeContainer, null);
-
try {
- final ComponentDefinition<?> definition = marshaller.unmarshall(content, false);
- final Component component = (Component) builder.build(parent, definition, deploymentContext);
+ // TODO This should be changed
+ final String xml = StaxUtil.serialize(content);
+ final QName qualifiedName = StaxUtil.getDocumentElementQName(xml);
+ final XMLStreamReader newReader = StaxUtil.createReader(xml);
+ final ModelMarshaller<PhysicalComponentDefinition> marshaller = marshallerRegistry.getMarshaller(qualifiedName);
+ final PhysicalComponentDefinition definition = marshaller.unmarshall(newReader);
+
+ final PhysicalComponentBuilder builder = builderRegistry.getBuilder(definition.getClass());
+ final Component component = builder.build(definition);
component.prepare();
- component.start();
} catch (MarshalException ex) {
return null;
+ } catch (XMLStreamException ex) {
+ return null;
} catch (BuilderException ex) {
return null;
} catch (PrepareException ex) {
@@ -98,12 +107,21 @@
}
/**
- * Injects the model marshaller.
- * @param marshaller Marshaller.
+ * Injects the model marshaller registry.
+ * @param marshallerRegistry Marshaller registry.
+ */
+ @Autowire
+ public void setMarshallerRegistry(ModelMarshallerRegistry marshallerRegistry) {
+ this.marshallerRegistry = marshallerRegistry;
+ }
+
+ /**
+ * Injects the builder registry.
+ * @param builderRegistry Builder registry.
*/
@Autowire
- public void setMarshaller(ModelMarshaller<ComponentDefinition<?>> marshaller) {
- this.marshaller = marshaller;
+ public void setBuilderRegistry(PhysicalComponentBuilderRegistry builderRegistry) {
+ this.builderRegistry = builderRegistry;
}
}
Copied: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/JavaPhysicalComponentDefinitionMarshaller.java (from r503407, incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/ComponentDefinitionMarshaller.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/JavaPhysicalComponentDefinitionMarshaller.java?view=diff&rev=503420&p1=incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/ComponentDefinitionMarshaller.java&r1=503407&p2=incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/JavaPhysicalComponentDefinitionMarshaller.java&r2=503420
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/ComponentDefinitionMarshaller.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/JavaPhysicalComponentDefinitionMarshaller.java Sun Feb 4 06:57:56 2007
@@ -24,9 +24,9 @@
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
+import org.apache.tuscany.core.component.JavaPhysicalComponentDefinition;
import org.apache.tuscany.spi.marshaller.MarshalException;
import org.apache.tuscany.spi.marshaller.ModelMarshaller;
-import org.apache.tuscany.spi.model.ComponentDefinition;
/**
* Marshaller used for marshalling and unmarshalling component definition.
@@ -34,7 +34,7 @@
* @version $Rev$ $Date$
*
*/
-public class ComponentDefinitionMarshaller implements ModelMarshaller<ComponentDefinition<?>> {
+public class JavaPhysicalComponentDefinitionMarshaller implements ModelMarshaller<JavaPhysicalComponentDefinition> {
/**
* Marshalls the component definition object to the specified stream writer.
@@ -43,30 +43,28 @@
* @param writer Stream writer to which the infoset is serialized.
* @throws MarshalException In case of any marshalling error.
*/
- public void marshall(ComponentDefinition<?> modelObject, XMLStreamWriter writer) throws MarshalException {
-
+ public void marshall(JavaPhysicalComponentDefinition modelObject, XMLStreamWriter writer) throws MarshalException {
+
try {
writer.writeStartDocument();
writer.writeEndDocument();
} catch (XMLStreamException ex) {
throw new MarshalException(ex);
}
-
+
}
/**
* Unmarshalls the component definition object from an XML stream.
*
* @param reader XML stream from where the marshalled XML is read.
- * @param upconvert Whether to upconvert the object is the current runtime
- * supports a higher version of the model object.
* @return Hydrated component definition object.
* @throws MarshalException In case of any unmarshalling error.
*/
- public ComponentDefinition<?> unmarshall(XMLStreamReader reader, boolean upconvert) throws MarshalException {
+ public JavaPhysicalComponentDefinition unmarshall(XMLStreamReader reader) throws MarshalException {
try {
while (true) {
- ComponentDefinition<?> definition = null;
+ JavaPhysicalComponentDefinition definition = new JavaPhysicalComponentDefinition();
switch (reader.next()) {
case END_DOCUMENT:
return definition;
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilder.java?view=auto&rev=503420
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilder.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilder.java Sun Feb 4 06:57:56 2007
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.builder;
+
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.model.physical.PhysicalComponentDefinition;
+
+/**
+ * Interface for building components from physical component definitions.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public interface PhysicalComponentBuilder<PCD extends PhysicalComponentDefinition> {
+
+ /**
+ * Builds a component from its physical component definition.
+ *
+ * @param componentDefinition Physical component definition of the component to be built.
+ * @return A component instance that is ready to go live.
+ * @throws BuilderException If unable to build the component.
+ */
+ Component build(PCD componentDefinition) throws BuilderException;
+
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilder.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilderRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilderRegistry.java?view=auto&rev=503420
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilderRegistry.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilderRegistry.java Sun Feb 4 06:57:56 2007
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.builder;
+
+import org.apache.tuscany.spi.model.physical.PhysicalComponentDefinition;
+
+/**
+ * A registry of physical component builders.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PhysicalComponentBuilderRegistry {
+
+ /**
+ * Registers a physical component builder.
+ *
+ * @param <PCD> Type of the physical component definition.
+ * @param definitionClass Class of the physical component definition.
+ * @param builder Builder for the physical component definition.
+ */
+ <PCD extends PhysicalComponentDefinition> void register(Class<PCD> definitionClass,
+ PhysicalComponentBuilder<PCD> builder);
+
+ /**
+ * Gets a builder for the specified physical component builder.
+ *
+ * @param <PCD> Type of the physical component definition.
+ * @param definitionClass Class of the physical component definition.
+ * @return Builder for the physical component definition.
+ */
+ PhysicalComponentBuilder getBuilder(Class definitionClass);
+
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilderRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PhysicalComponentBuilderRegistry.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshaller.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshaller.java?view=diff&rev=503420&r1=503419&r2=503420
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshaller.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshaller.java Sun Feb 4 06:57:56 2007
@@ -21,34 +21,32 @@
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
-import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.physical.PhysicalComponentDefinition;
/**
- * Interface for marshalling/unmarshalling internal model objects.
+ * Interface for marshalling/unmarshalling internal physical component definitions.
*
* @version $Rev$ $Date$
*
*/
-public interface ModelMarshaller<MD extends ModelObject> {
+public interface ModelMarshaller<PCD extends PhysicalComponentDefinition> {
/**
- * Marshalls the model object to the specified stream writer.
+ * Marshalls the physical component definition to the specified stream writer.
*
- * @param modelObject Model object to be serialized.
+ * @param modelObject Physical component definition to be serialized.
* @param writer Stream writer to which the infoset is serialized.
* @throws MarshalException In case of any marshalling error.
*/
- void marshall(MD modelObject, XMLStreamWriter writer) throws MarshalException;
+ void marshall(PCD modelObject, XMLStreamWriter writer) throws MarshalException;
/**
* Unmarshalls an XML stream to a model object.
*
* @param reader XML stream from where the marshalled XML is read.
- * @param upconvert Whether to upconvert the object is the current runtime
- * supports a higher version of the model object.
- * @return Hydrated model object.
+ * @return Physical component definition.
* @throws MarshalException In case of any unmarshalling error.
*/
- MD unmarshall(XMLStreamReader reader, boolean upconvert) throws MarshalException;
+ PCD unmarshall(XMLStreamReader reader) throws MarshalException;
}
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshallerRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshallerRegistry.java?view=auto&rev=503420
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshallerRegistry.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshallerRegistry.java Sun Feb 4 06:57:56 2007
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.marshaller;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.physical.PhysicalComponentDefinition;
+
+/**
+ * A registry for physical component definition marshallers.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModelMarshallerRegistry {
+
+ /**
+ * Registers a physical component definition marshaller.
+ *
+ * @param <PCD> Physical component definition.
+ * @param modelClass Physical component definition class.
+ * @param qualifiedName Qualified name of the marshalled XML stream.
+ * @param marshaller Marshaller responsible for marshalling.
+ */
+ <PCD extends PhysicalComponentDefinition> void registerMarshaller(Class<PCD> modelClass,
+ QName qualifiedName,
+ ModelMarshaller<PCD> marshaller);
+
+ /**
+ * Gets a marshaller for marshalling the registered type.
+ *
+ * @param <PCD> Physical component definition.
+ * @param modelClass Type of the physical model definition that needs to be marshalled.
+ * @return Marshaller capable for marshalling the specified type.
+ */
+ <PCD extends PhysicalComponentDefinition> ModelMarshaller<PCD> getMarshaller(Class<PCD> modelClass);
+
+
+ /**
+ * Gets a marshaller for unmarshalling XML with the specified qualified name.
+ *
+ * @param <PCD> Physical component definition.
+ * @param qualifiedName Qualified name of the document element of the marshaleld data.
+ * @return Marshaller capable for unmarshalling the document type.
+ */
+ <PCD extends PhysicalComponentDefinition> ModelMarshaller<PCD> getMarshaller(QName qualifiedName);
+
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshallerRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshallerRegistry.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org