summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller')
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/AbstractMarshallerExtension.java72
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/DefaultModelMarshallerRegistry.java97
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java97
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalOperationDefinitionMarshaller.java72
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalWireDefinitionMarshaller.java99
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractExtensibleMarshallerExtension.java61
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalComponentDefinitionMarshaller.java110
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalReferenceDefinitionMarshaller.java84
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalServiceDefinitionMarshaller.java84
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalComponentDefinitionMarshaller.java157
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalReferenceDefinitionMarshaller.java93
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalServiceDefinitionMarshaller.java93
12 files changed, 1119 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/AbstractMarshallerExtension.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/AbstractMarshallerExtension.java
new file mode 100644
index 0000000000..16bf6ea178
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/AbstractMarshallerExtension.java
@@ -0,0 +1,72 @@
+/*
+ * 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.marshaller;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.marshaller.ModelMarshaller;
+import org.apache.tuscany.spi.marshaller.ModelMarshallerRegistry;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * Abstract marshaller that supports marshaller registry.
+ *
+ * @version $Revision$ $Date: 2007-03-03 12:17:30 +0000 (Sat, 03 Mar
+ * 2007) $
+ * @param <MD>
+ */
+public abstract class AbstractMarshallerExtension<MD extends ModelObject> implements ModelMarshaller<MD> {
+
+ // Private Model marshaller registry
+ protected ModelMarshallerRegistry registry;
+
+ /**
+ * Injects the model marshaller registry.
+ *
+ * @param registry Model marshaller registry.
+ */
+ @Reference
+ public final void setRegistry(ModelMarshallerRegistry registry) {
+
+ this.registry = registry;
+
+ Class<MD> marshallerType = getModelObjectType();
+ QName marshallerQName = getModelObjectQName();
+
+ registry.registerMarshaller(marshallerType, marshallerQName, this);
+
+ }
+
+ /**
+ * Gets the qualified name of the XML fragment for the marshalled model
+ * object.
+ *
+ * @return Qualified name of the XML fragment.
+ */
+ protected abstract QName getModelObjectQName();
+
+ /**
+ * Retursn the type of the model object.
+ *
+ * @return Model object type.
+ */
+ protected abstract Class<MD> getModelObjectType();
+
+}
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/DefaultModelMarshallerRegistry.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/DefaultModelMarshallerRegistry.java
new file mode 100644
index 0000000000..6b502eac59
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/DefaultModelMarshallerRegistry.java
@@ -0,0 +1,97 @@
+/*
+ * 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.marshaller;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.marshaller.ModelMarshaller;
+import org.apache.tuscany.spi.marshaller.ModelMarshallerRegistry;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Default map-based implementation of the model marshaller registry.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultModelMarshallerRegistry implements ModelMarshallerRegistry {
+
+ // Marshaller registry
+ private final Map<Class<? extends ModelObject>, ModelMarshaller> marshallerRegistry =
+ new ConcurrentHashMap<Class<? extends ModelObject>, ModelMarshaller>();
+
+ // Unmarshaller registry
+ private final Map<QName, ModelMarshaller> unmarshallerRegistry = new ConcurrentHashMap<QName, ModelMarshaller>();
+
+ /**
+ * Registers a model object marshaller.
+ *
+ * @param <MD> Model object type.
+ * @param modelClass Model obejct class.
+ * @param qname Qualified name of the root element of the marshalled XML.
+ * @param marshaller Model object marshaller.
+ */
+ public <MD extends ModelObject> void registerMarshaller(Class<MD> modelClass,
+ QName qname,
+ ModelMarshaller<MD> marshaller) {
+ marshallerRegistry.put(modelClass, marshaller);
+ unmarshallerRegistry.put(qname, marshaller);
+ }
+
+ /**
+ * Marshalls a model object.
+ *
+ * @param modelObject Model object to be marshalled.
+ * @param writer Writer to which marshalled information is written.
+ */
+ @SuppressWarnings("unchecked")
+ public void marshall(ModelObject modelObject, XMLStreamWriter writer) throws MarshallException {
+
+ ModelMarshaller marshaller = marshallerRegistry.get(modelObject.getClass());
+ if (marshaller == null) {
+ throw new MarshallException("No marshaller defined for " + modelObject.getClass());
+ }
+ marshaller.marshall(modelObject, writer);
+
+ }
+
+ /**
+ * Unmarshalls an XML stream to a model object.
+ *
+ * @param reader Reader from which marshalled information is read.
+ * @return Model object from the marshalled stream.
+ */
+ public ModelObject unmarshall(XMLStreamReader reader) throws MarshallException {
+
+ QName qname = reader.getName();
+
+ ModelMarshaller marshaller = unmarshallerRegistry.get(qname);
+ if (marshaller == null) {
+ throw new MarshallException("No marshaller defined for " + qname);
+ }
+ return marshaller.unmarshall(reader);
+
+ }
+
+}
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java
new file mode 100644
index 0000000000..e10a06b004
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java
@@ -0,0 +1,97 @@
+/*
+ * 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.marshaller;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.END_DOCUMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.physical.PhysicalChangeSet;
+import org.apache.tuscany.spi.model.physical.PhysicalComponentDefinition;
+import org.apache.tuscany.spi.model.physical.PhysicalWireDefinition;
+
+/**
+ * Marshaller for physical changeset.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public class PhysicalChangeSetMarshaller extends AbstractMarshallerExtension<PhysicalChangeSet> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName("http://tuscany.apache.org/xmlns/marshaller/1.0-SNAPSHOT", "changeSet");
+
+ // Local part for wire
+ private static final String WIRE = "wire";
+
+ // Local part for component
+ private static final String COMPONENT = "component";
+
+ /**
+ * Marshalls a physical change set to the xml writer.
+ */
+ public void marshall(PhysicalChangeSet modelObject, XMLStreamWriter writer) throws MarshallException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Unmarshalls a physical change set from the xml reader.
+ */
+ public PhysicalChangeSet unmarshall(XMLStreamReader reader) throws MarshallException {
+
+ try {
+ PhysicalChangeSet changeSet = new PhysicalChangeSet();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ String name = reader.getName().getLocalPart();
+ ModelObject modelObject = registry.unmarshall(reader);
+ if (COMPONENT.equals(name)) {
+ changeSet.addComponentDefinition((PhysicalComponentDefinition)modelObject);
+ } else if (WIRE.equals(name)) {
+ changeSet.addWireDefinition((PhysicalWireDefinition)modelObject);
+ }
+ break;
+ case END_DOCUMENT:
+ return changeSet;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new MarshallException(ex);
+ }
+
+ }
+
+ @Override
+ protected QName getModelObjectQName() {
+ return QNAME;
+ }
+
+ @Override
+ protected Class<PhysicalChangeSet> getModelObjectType() {
+ return PhysicalChangeSet.class;
+ }
+
+}
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalOperationDefinitionMarshaller.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalOperationDefinitionMarshaller.java
new file mode 100644
index 0000000000..4fe35e11ee
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalOperationDefinitionMarshaller.java
@@ -0,0 +1,72 @@
+/*
+ * 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.marshaller;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+
+/**
+ * Marshaller for physical operation definition.
+ *
+ * @version $Revision$ $Date: 2007-03-03 11:36:03 +0000 (Sat, 03 Mar
+ * 2007) $
+ */
+public class PhysicalOperationDefinitionMarshaller extends AbstractMarshallerExtension<PhysicalOperationDefinition> {
+
+ // Source name attribute
+ private static final String NAME = "name";
+
+ // QName for the root element
+ private static final QName QNAME =
+ new QName("http://tuscany.apache.org/xmlns/marshaller/1.0-SNAPSHOT", "operation");
+
+ /**
+ * Marshalls a physical operation to the xml writer.
+ */
+ public void marshall(PhysicalOperationDefinition modelObject, XMLStreamWriter writer) throws MarshallException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Unmarshalls a physical operation from the xml reader.
+ */
+ public PhysicalOperationDefinition unmarshall(XMLStreamReader reader) throws MarshallException {
+
+ PhysicalOperationDefinition operation = new PhysicalOperationDefinition();
+ operation.setName(reader.getAttributeValue(null, NAME));
+ operation.setCallback(Boolean.valueOf(reader.getAttributeValue(null, NAME)));
+ return operation;
+
+ }
+
+ @Override
+ protected QName getModelObjectQName() {
+ return QNAME;
+ }
+
+ @Override
+ protected Class<PhysicalOperationDefinition> getModelObjectType() {
+ return PhysicalOperationDefinition.class;
+ }
+
+}
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalWireDefinitionMarshaller.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalWireDefinitionMarshaller.java
new file mode 100644
index 0000000000..c8dfd37fac
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalWireDefinitionMarshaller.java
@@ -0,0 +1,99 @@
+/*
+ * 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.marshaller;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+import org.apache.tuscany.spi.model.physical.PhysicalWireDefinition;
+
+/**
+ * Marshaller for physical wire definition.
+ *
+ * @version $Revision$ $Date: 2007-03-03 11:36:03 +0000 (Sat, 03 Mar
+ * 2007) $
+ */
+public class PhysicalWireDefinitionMarshaller extends AbstractMarshallerExtension<PhysicalWireDefinition> {
+
+ // Source URI attribute
+ private static final String SOURCE_URI = "sourceUri";
+
+ // Source URI attribute
+ private static final String TARGET_URI = "targetUri";
+
+ // QName for the root element
+ private static final QName QNAME = new QName("http://tuscany.apache.org/xmlns/marshaller/1.0-SNAPSHOT", "wire");
+
+ /**
+ * Marshalls a physical wire to the xml writer.
+ */
+ public void marshall(PhysicalWireDefinition modelObject, XMLStreamWriter writer) throws MarshallException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Unmarshalls a physical wire from the xml reader.
+ */
+ public PhysicalWireDefinition unmarshall(XMLStreamReader reader) throws MarshallException {
+
+ try {
+ PhysicalWireDefinition wireDefinition = new PhysicalWireDefinition();
+ wireDefinition.setSourceUri(new URI(reader.getAttributeValue(null, SOURCE_URI)));
+ wireDefinition.setTargetUri(new URI(reader.getAttributeValue(null, TARGET_URI)));
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ ModelObject modelObject = registry.unmarshall(reader);
+ wireDefinition.addOperation((PhysicalOperationDefinition)modelObject);
+ break;
+ case END_ELEMENT:
+ return wireDefinition;
+
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new MarshallException(ex);
+ } catch (URISyntaxException ex) {
+ throw new MarshallException(ex);
+ }
+
+ }
+
+ @Override
+ protected QName getModelObjectQName() {
+ return QNAME;
+ }
+
+ @Override
+ protected Class<PhysicalWireDefinition> getModelObjectType() {
+ return PhysicalWireDefinition.class;
+ }
+
+}
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractExtensibleMarshallerExtension.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractExtensibleMarshallerExtension.java
new file mode 100644
index 0000000000..090797e349
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractExtensibleMarshallerExtension.java
@@ -0,0 +1,61 @@
+/*
+ * 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.marshaller.extensions;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.core.marshaller.AbstractMarshallerExtension;
+import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Abstract marshaller that supports extensible model objects.
+ *
+ * @version $Revision$ $Date: 2007-03-04 18:23:24 +0000 (Sun, 04 Mar
+ * 2007) $
+ * @param <MD>
+ */
+public abstract class AbstractExtensibleMarshallerExtension<MD extends ModelObject> extends
+ AbstractMarshallerExtension<MD> {
+
+ /**
+ * Create the concrete model object.
+ *
+ * @return Concrete model object.
+ */
+ protected abstract MD getConcreteModelObject();
+
+ /**
+ * Handles extensions for unmarshalling.
+ *
+ * @param modelObject Concrete model object.
+ * @param reader Reader from which marshalled data is read.
+ */
+ protected abstract void handleExtension(MD modelObject, XMLStreamReader reader) throws MarshallException;
+
+ /**
+ * Handles extensions for marshalling.
+ *
+ * @param modelObject Concrete model object.
+ * @param reader Writer to which marshalled data is written.
+ */
+ protected abstract void handleExtension(MD modelObject, XMLStreamWriter writer) throws MarshallException;
+
+}
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalComponentDefinitionMarshaller.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalComponentDefinitionMarshaller.java
new file mode 100644
index 0000000000..bcf868ad1e
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalComponentDefinitionMarshaller.java
@@ -0,0 +1,110 @@
+/*
+ * 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.marshaller.extensions;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.model.physical.PhysicalComponentDefinition;
+
+/**
+ * Abstract super class for all PCD marshallers.
+ *
+ * @version $Revision$ $Date: 2007-03-03 16:41:22 +0000 (Sat, 03 Mar
+ * 2007) $
+ */
+public abstract class AbstractPhysicalComponentDefinitionMarshaller<PCD extends PhysicalComponentDefinition<?, ?>>
+ extends AbstractExtensibleMarshallerExtension<PCD> {
+
+ // Component id attribute
+ private static final String COMPONENT_ID = "componentId";
+
+ // Reference
+ private static final String REFERENCE = "reference";
+
+ // Service
+ private static final String SERVICE = "service";
+
+ /**
+ * Marshalls a physical change set to the xml writer.
+ */
+ public final void marshall(PCD modelObject, XMLStreamWriter writer) throws MarshallException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Unmarshalls a physical change set from the xml reader.
+ */
+ public final PCD unmarshall(XMLStreamReader reader) throws MarshallException {
+
+ try {
+ PCD componentDefinition = getConcreteModelObject();
+ componentDefinition.setComponentId(new URI(reader.getAttributeValue(null, COMPONENT_ID)));
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ String name = reader.getName().getLocalPart();
+ if (REFERENCE.equals(name)) {
+ handleReference(componentDefinition, reader);
+ } else if (SERVICE.equals(name)) {
+ handleService(componentDefinition, reader);
+ } else {
+ handleExtension(componentDefinition, reader);
+ }
+ break;
+ case END_ELEMENT:
+ if (getModelObjectQName().equals(reader.getName())) {
+ return componentDefinition;
+ }
+
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new MarshallException(ex);
+ } catch (URISyntaxException ex) {
+ throw new MarshallException(ex);
+ }
+
+ }
+
+ /**
+ * Handles a reference.
+ *
+ * @param componentDefinition Component definition.
+ * @param reader XML stream.
+ */
+ protected abstract void handleReference(PCD componentDefinition, XMLStreamReader reader) throws MarshallException;
+
+ /**
+ * Handles a reference.
+ *
+ * @param componentDefinition Component definition.
+ * @param reader XML stream.
+ */
+ protected abstract void handleService(PCD componentDefinition, XMLStreamReader reader) throws MarshallException;
+
+}
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalReferenceDefinitionMarshaller.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalReferenceDefinitionMarshaller.java
new file mode 100644
index 0000000000..f8b7d9e9e7
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalReferenceDefinitionMarshaller.java
@@ -0,0 +1,84 @@
+/*
+ * 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.marshaller.extensions;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+import org.apache.tuscany.spi.model.physical.PhysicalReferenceDefinition;
+
+/**
+ * Marshaller for java physical reference definition.
+ *
+ * @version $Revision$ $Date$
+ */
+public abstract class AbstractPhysicalReferenceDefinitionMarshaller<PRD extends PhysicalReferenceDefinition> extends
+ AbstractExtensibleMarshallerExtension<PRD> {
+
+ // Local part for operation
+ private static final String OPERATION = "operation";
+
+ // Source name attribute
+ private static final String NAME = "name";
+
+ /**
+ * Marshalls a physical java reference definition to the xml writer.
+ */
+ public void marshall(PRD modelObject, XMLStreamWriter writer) throws MarshallException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Unmarshalls a java physical reference definition from the xml reader.
+ */
+ public PRD unmarshall(XMLStreamReader reader) throws MarshallException {
+
+ try {
+ PRD referenceDefinition = getConcreteModelObject();
+ referenceDefinition.setName(reader.getAttributeValue(null, NAME));
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ ModelObject modelObject = registry.unmarshall(reader);
+ String name = reader.getName().getLocalPart();
+ if (OPERATION.equals(name)) {
+ referenceDefinition.addOperation((PhysicalOperationDefinition)modelObject);
+ } else {
+ handleExtension(referenceDefinition, reader);
+ }
+ break;
+ case END_ELEMENT:
+ return referenceDefinition;
+
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new MarshallException(ex);
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalServiceDefinitionMarshaller.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalServiceDefinitionMarshaller.java
new file mode 100644
index 0000000000..7adb3f7ae2
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/AbstractPhysicalServiceDefinitionMarshaller.java
@@ -0,0 +1,84 @@
+/*
+ * 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.marshaller.extensions;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+import org.apache.tuscany.spi.model.physical.PhysicalServiceDefinition;
+
+/**
+ * Marshaller for java physical service definition.
+ *
+ * @version $Revision$ $Date$
+ */
+public abstract class AbstractPhysicalServiceDefinitionMarshaller<PSD extends PhysicalServiceDefinition> extends
+ AbstractExtensibleMarshallerExtension<PSD> {
+
+ // Local part for operation
+ private static final String OPERATION = "operation";
+
+ // Source name attribute
+ private static final String NAME = "name";
+
+ /**
+ * Marshalls a physical java reference definition to the xml writer.
+ */
+ public void marshall(PSD modelObject, XMLStreamWriter writer) throws MarshallException {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Unmarshalls a java physical reference definition from the xml reader.
+ */
+ public PSD unmarshall(XMLStreamReader reader) throws MarshallException {
+
+ try {
+ PSD serviceDefinition = getConcreteModelObject();
+ serviceDefinition.setName(reader.getAttributeValue(null, NAME));
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ ModelObject modelObject = registry.unmarshall(reader);
+ String name = reader.getName().getLocalPart();
+ if (OPERATION.equals(name)) {
+ serviceDefinition.addOperation((PhysicalOperationDefinition)modelObject);
+ } else {
+ handleExtension(serviceDefinition, reader);
+ }
+ break;
+ case END_ELEMENT:
+ return serviceDefinition;
+
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new MarshallException(ex);
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalComponentDefinitionMarshaller.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalComponentDefinitionMarshaller.java
new file mode 100644
index 0000000000..08ed890da7
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalComponentDefinitionMarshaller.java
@@ -0,0 +1,157 @@
+/*
+ * 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.marshaller.extensions.java;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.tuscany.core.marshaller.extensions.AbstractPhysicalComponentDefinitionMarshaller;
+import org.apache.tuscany.core.model.physical.java.JavaPhysicalComponentDefinition;
+import org.apache.tuscany.core.model.physical.java.JavaPhysicalReferenceDefinition;
+import org.apache.tuscany.core.model.physical.java.JavaPhysicalServiceDefinition;
+import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.model.Scope;
+
+/**
+ * Marshaller for Java physical component definitions.
+ *
+ * @version $Revision$ $Date: 2007-03-03 16:41:22 +0000 (Sat, 03 Mar
+ * 2007) $
+ */
+public class JavaPhysicalComponentDefinitionMarshaller extends
+ AbstractPhysicalComponentDefinitionMarshaller<JavaPhysicalComponentDefinition> {
+
+ // Instance factory
+ private static final String INSTANCE_FACTORY = "instanceFactory";
+
+ // Scope
+ private static final String SCOPE = "scope";
+
+ // Classloader id
+ private static final String CLASSLOADER_ID = "classLoaderId";
+
+ // QName for the root element
+ private static final QName QNAME =
+ new QName("http://tuscany.apache.org/xmlns/marshaller/java/1.0-SNAPSHOT", "component");
+
+ /**
+ * Gets the qualified name of the XML fragment for the marshalled model
+ * object.
+ *
+ * @return {"http://tuscany.apache.org/xmlns/marshaller/component/java/1.0-SNAPSHOT",
+ * "component"}
+ */
+ @Override
+ protected QName getModelObjectQName() {
+ return QNAME;
+ }
+
+ /**
+ * Retursn the type of the model object.
+ *
+ * @return <code>JavaPhysicalComponentDefinition.class</code>.
+ */
+ @Override
+ protected Class<JavaPhysicalComponentDefinition> getModelObjectType() {
+ return JavaPhysicalComponentDefinition.class;
+ }
+
+ /**
+ * Create the concrete PCD.
+ *
+ * @return An instance of<code>JavaPhysicalComponentDefinition</code>.
+ */
+ @Override
+ protected JavaPhysicalComponentDefinition getConcreteModelObject() {
+ return new JavaPhysicalComponentDefinition();
+ }
+
+ /**
+ * Handles extensions for unmarshalling Java physical component definitions
+ * including the marshalling of base64 encoded instance factory byte code.
+ *
+ * @param componentDefinition Physical component definition.
+ * @param reader Reader from which marshalled data is read.
+ */
+ @Override
+ protected void handleExtension(JavaPhysicalComponentDefinition componentDefinition, XMLStreamReader reader)
+ throws MarshallException {
+
+ try {
+ String name = reader.getName().getLocalPart();
+ reader.next();
+ if (INSTANCE_FACTORY.equals(name)) {
+ byte[] base64ByteCode = reader.getText().getBytes();
+ byte[] byteCode = Base64.decodeBase64(base64ByteCode);
+ componentDefinition.setInstanceFactoryByteCode(byteCode);
+ } else if (SCOPE.equals(name)) {
+ componentDefinition.setScope(new Scope(reader.getText()));
+ } else if (CLASSLOADER_ID.equals(name)) {
+ componentDefinition.setClassLoaderId(new URI(reader.getText()));
+ }
+ } catch (XMLStreamException ex) {
+ throw new MarshallException(ex);
+ } catch (URISyntaxException ex) {
+ throw new MarshallException(ex);
+ }
+
+ }
+
+ /**
+ * Handles a reference.
+ *
+ * @param componentDefinition Component definition.
+ * @param reader XML stream.
+ */
+ protected void handleReference(JavaPhysicalComponentDefinition componentDefinition, XMLStreamReader reader)
+ throws MarshallException {
+ JavaPhysicalReferenceDefinition reference = (JavaPhysicalReferenceDefinition)registry.unmarshall(reader);
+ componentDefinition.addReference(reference);
+ }
+
+ /**
+ * Handles a reference.
+ *
+ * @param componentDefinition Component definition.
+ * @param reader XML stream.
+ */
+ protected void handleService(JavaPhysicalComponentDefinition componentDefinition, XMLStreamReader reader)
+ throws MarshallException {
+ JavaPhysicalServiceDefinition service = (JavaPhysicalServiceDefinition)registry.unmarshall(reader);
+ componentDefinition.addService(service);
+ }
+
+ /**
+ * Handles extensions for marshalling Java physical component definitions
+ * including the marshalling of base64 encoded instance factory byte code.
+ *
+ * @param componentDefinition Physical component definition.
+ * @param reader Writer to which marshalled data is written.
+ */
+ @Override
+ protected void handleExtension(JavaPhysicalComponentDefinition componentDefinition, XMLStreamWriter writer) {
+ }
+
+}
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalReferenceDefinitionMarshaller.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalReferenceDefinitionMarshaller.java
new file mode 100644
index 0000000000..3b4a37e903
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalReferenceDefinitionMarshaller.java
@@ -0,0 +1,93 @@
+/*
+ * 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.marshaller.extensions.java;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.core.marshaller.extensions.AbstractPhysicalReferenceDefinitionMarshaller;
+import org.apache.tuscany.core.model.physical.java.JavaPhysicalReferenceDefinition;
+
+/**
+ * Marshaller for java physical reference definition.
+ *
+ * @version $Revision$ $Date: 2007-03-03 16:41:22 +0000 (Sat, 03 Mar
+ * 2007) $
+ */
+public class JavaPhysicalReferenceDefinitionMarshaller extends
+ AbstractPhysicalReferenceDefinitionMarshaller<JavaPhysicalReferenceDefinition> {
+
+ // QName for the root element
+ private static final QName QNAME =
+ new QName("http://tuscany.apache.org/xmlns/marshaller/java/1.0-SNAPSHOT", "reference");
+
+ /**
+ * Gets the qualified name of the XML fragment for the marshalled model
+ * object.
+ *
+ * @return {"http://tuscany.apache.org/xmlns/marshaller/reference/java/1.0-SNAPSHOT",
+ * "service"}.
+ */
+ @Override
+ protected QName getModelObjectQName() {
+ return QNAME;
+ }
+
+ /**
+ * Retursn the type of the model object.
+ *
+ * @return <code>JavaPhysicalReferenceDefinition.class</code>.
+ */
+ @Override
+ protected Class<JavaPhysicalReferenceDefinition> getModelObjectType() {
+ return JavaPhysicalReferenceDefinition.class;
+ }
+
+ /**
+ * Create the concrete model object.
+ *
+ * @return An instance of <code>JavaPhysicalReferenceDefinition</code>.
+ */
+ @Override
+ protected JavaPhysicalReferenceDefinition getConcreteModelObject() {
+ return new JavaPhysicalReferenceDefinition();
+ }
+
+ /**
+ * Handles extensions for unmarshalling Java physical references.
+ *
+ * @param modelObject Concrete model object.
+ * @param reader Reader from which marshalled data is read.
+ */
+ @Override
+ protected void handleExtension(JavaPhysicalReferenceDefinition modelObject, XMLStreamReader reader) {
+ }
+
+ /**
+ * Handles extensions for marshalling Java physical references.
+ *
+ * @param modelObject Concrete model object.
+ * @param reader Writer to which marshalled data is written.
+ */
+ @Override
+ protected void handleExtension(JavaPhysicalReferenceDefinition modelObject, XMLStreamWriter writer) {
+ }
+
+}
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalServiceDefinitionMarshaller.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalServiceDefinitionMarshaller.java
new file mode 100644
index 0000000000..ade4d3fd5e
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/main/java/org/apache/tuscany/core/marshaller/extensions/java/JavaPhysicalServiceDefinitionMarshaller.java
@@ -0,0 +1,93 @@
+/*
+ * 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.marshaller.extensions.java;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.core.marshaller.extensions.AbstractPhysicalServiceDefinitionMarshaller;
+import org.apache.tuscany.core.model.physical.java.JavaPhysicalServiceDefinition;
+
+/**
+ * Marshaller for java physical service definition.
+ *
+ * @version $Revision$ $Date: 2007-03-03 16:41:22 +0000 (Sat, 03 Mar
+ * 2007) $
+ */
+public class JavaPhysicalServiceDefinitionMarshaller extends
+ AbstractPhysicalServiceDefinitionMarshaller<JavaPhysicalServiceDefinition> {
+
+ // QName for the root element
+ private static final QName QNAME =
+ new QName("http://tuscany.apache.org/xmlns/marshaller/java/1.0-SNAPSHOT", "service");
+
+ /**
+ * Gets the qualified name of the XML fragment for the marshalled model
+ * object.
+ *
+ * @return {"http://tuscany.apache.org/xmlns/marshaller/reference/java/1.0-SNAPSHOT",
+ * "service"}.
+ */
+ @Override
+ protected QName getModelObjectQName() {
+ return QNAME;
+ }
+
+ /**
+ * Returns the type of the model object.
+ *
+ * @return <code>JavaPhysicalServiceDefinition.class</code>.
+ */
+ @Override
+ protected Class<JavaPhysicalServiceDefinition> getModelObjectType() {
+ return JavaPhysicalServiceDefinition.class;
+ }
+
+ /**
+ * Create the concrete model object.
+ *
+ * @return An instance of <code>JavaPhysicalServiceDefinition</code>.
+ */
+ @Override
+ protected JavaPhysicalServiceDefinition getConcreteModelObject() {
+ return new JavaPhysicalServiceDefinition();
+ }
+
+ /**
+ * Handles extensions for unmarshalling Java service definitions.
+ *
+ * @param modelObject Concrete model object.
+ * @param reader Reader from which marshalled data is read.
+ */
+ @Override
+ protected void handleExtension(JavaPhysicalServiceDefinition modelObject, XMLStreamReader reader) {
+ }
+
+ /**
+ * Handles extensions for marshalling Java service definitions.
+ *
+ * @param modelObject Concrete model object.
+ * @param reader Writer to which marshalled data is written.
+ */
+ @Override
+ protected void handleExtension(JavaPhysicalServiceDefinition modelObject, XMLStreamWriter writer) {
+ }
+
+}