From d99fac83ac0b02c2e8d1e93c18a25a3c92539726 Mon Sep 17 00:00:00 2001 From: yvesf Date: Mon, 9 May 2011 23:37:38 +0200 Subject: Vor-Ergebnisse Studienarbeit --- .../src/de/dhbw/horb/ksm/model/api/Connection.java | 11 + ksm-model/src/de/dhbw/horb/ksm/model/api/KSM.java | 62 ++++ ksm-model/src/de/dhbw/horb/ksm/model/api/Node.java | 39 +++ .../src/de/dhbw/horb/ksm/model/api/NodeGroup.java | 94 ++++++ .../src/de/dhbw/horb/ksm/model/api/Properties.java | 138 ++++++++ .../horb/ksm/model/generated/ObjectFactory.java | 159 +++++++++ .../dhbw/horb/ksm/model/generated/XConnection.java | 97 ++++++ .../horb/ksm/model/generated/XConnections.java | 74 +++++ .../src/de/dhbw/horb/ksm/model/generated/XKSM.java | 124 +++++++ .../de/dhbw/horb/ksm/model/generated/XNode.java | 124 +++++++ .../dhbw/horb/ksm/model/generated/XNodeGroup.java | 163 ++++++++++ .../dhbw/horb/ksm/model/generated/XProperties.java | 268 ++++++++++++++++ .../horb/ksm/model/generated/XPropertyBase.java | 97 ++++++ .../ksm/model/generated/XPropertyBaseList.java | 75 +++++ .../horb/ksm/model/generated/XPropertyBoolean.java | 88 +++++ .../horb/ksm/model/generated/XPropertyDecimal.java | 97 ++++++ .../ksm/model/generated/XPropertyDecimalList.java | 77 +++++ .../horb/ksm/model/generated/XPropertyInteger.java | 97 ++++++ .../ksm/model/generated/XPropertyIntegerList.java | 77 +++++ .../horb/ksm/model/generated/XPropertyString.java | 96 ++++++ .../ksm/model/generated/XPropertyStringList.java | 76 +++++ .../horb/ksm/model/generated/package-info.java | 9 + .../dhbw/horb/ksm/model/impl/ConnectionImpl.java | 49 +++ .../de/dhbw/horb/ksm/model/impl/KSMFactory.java | 74 +++++ .../src/de/dhbw/horb/ksm/model/impl/KSMImpl.java | 109 +++++++ .../de/dhbw/horb/ksm/model/impl/NodeGroupImpl.java | 153 +++++++++ .../src/de/dhbw/horb/ksm/model/impl/NodeImpl.java | 109 +++++++ .../dhbw/horb/ksm/model/impl/PropertiesImpl.java | 356 +++++++++++++++++++++ .../src/de/dhbw/horb/ksm/model/impl/package.html | 3 + 29 files changed, 2995 insertions(+) create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/api/Connection.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/api/KSM.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/api/Node.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/api/NodeGroup.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/api/Properties.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/ObjectFactory.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XConnection.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XConnections.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XKSM.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XNode.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XNodeGroup.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XProperties.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBase.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBaseList.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBoolean.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyDecimal.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyDecimalList.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyInteger.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyIntegerList.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyString.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyStringList.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/generated/package-info.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/impl/ConnectionImpl.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/impl/KSMFactory.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/impl/KSMImpl.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/impl/NodeGroupImpl.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/impl/NodeImpl.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/impl/PropertiesImpl.java create mode 100644 ksm-model/src/de/dhbw/horb/ksm/model/impl/package.html (limited to 'ksm-model/src/de/dhbw') diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/api/Connection.java b/ksm-model/src/de/dhbw/horb/ksm/model/api/Connection.java new file mode 100644 index 0000000..24da47f --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/api/Connection.java @@ -0,0 +1,11 @@ +package de.dhbw.horb.ksm.model.api; + +import java.beans.PropertyChangeListener; + +public interface Connection { + public String getTo(); + void setTo(String id); + public Properties getProperties(); + void addPropertyChangeListener(PropertyChangeListener listener); + void removePropertyChangeListener(PropertyChangeListener listener); +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/api/KSM.java b/ksm-model/src/de/dhbw/horb/ksm/model/api/KSM.java new file mode 100644 index 0000000..f3665e1 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/api/KSM.java @@ -0,0 +1,62 @@ +package de.dhbw.horb.ksm.model.api; + +import java.util.List; + +public interface KSM { + /** + * Gibt die Wurzel-NodeGroup dieses Modells zurück. + * + * @return + */ + NodeGroup getNodeGroup(); + + /** + * Schlägt das NodeGroup-Objekt mit dieser id nach. + * + * Durchläuft dazu alle NodeGroups im Modell + * + * @param id + * @return gesuchte NodeGroup oder null + */ + NodeGroup lookupNodeGroup(String id); + + /** + * Schlägt das Node-Objekt mit dieser id nach. + * + * Durchläuft dazu alle NodeGroups im Modell + * + * @param id + * @return gesuchte Node oder null + */ + Node lookupNode(String id); + + /** + * Gibt einen Iterator über alle Node Objekte im Model zurück. + * + * @return + */ + Iterable getAllNodes(); + + /** + * gibt alle auf diesen Knoten zeigendenden Verbindungen + * + * @param n + * zu überprüfender Knoten + * @return alle einkommenden Verbindungen. + */ + List getIncomingConnections(Node n); + + /** + * Gibt die mit diesem Modell verknüfpten Eigenschaften + * + * @return eigenschaften als Properites Object + */ + Properties getProperties(); + + /** + * Gibt das version-Attribut + * + * @return version attribut des modells + */ + String getVersion(); +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/api/Node.java b/ksm-model/src/de/dhbw/horb/ksm/model/api/Node.java new file mode 100644 index 0000000..b7589f9 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/api/Node.java @@ -0,0 +1,39 @@ +package de.dhbw.horb.ksm.model.api; + +import java.beans.PropertyChangeListener; +import java.util.List; + +public interface Node { + String getId(); + + Properties getProperties(); + + /** + * Erzeugt eine Neue Verbindung. + * + * Der Aufrufer muss dafür Sorge tragen, dass das Ziel gesetzt wird. + * + * @return neue Verbindung (Connection Object) + */ + Connection createConnection(String to); + + /** + * @see Node#createConnection(String) + */ + Connection createConnection(Node toNode); + + boolean removeConnection(Connection connection); + + /** + * Nur lesbare Liste von Verbindungen + * + * @return + */ + List getConnections(); + + void addPropertyChangeListener(PropertyChangeListener listener); + + void removePropertyChangeListener(PropertyChangeListener listener); + + void addConnection(Connection connection); +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/api/NodeGroup.java b/ksm-model/src/de/dhbw/horb/ksm/model/api/NodeGroup.java new file mode 100644 index 0000000..8473b37 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/api/NodeGroup.java @@ -0,0 +1,94 @@ +package de.dhbw.horb.ksm.model.api; + +import java.beans.PropertyChangeListener; +import java.util.List; + +public interface NodeGroup { + /** + * @return unmodifiable list of all nodes in this NodeGroup + */ + List getNodes(); + + /** + * @return unmodifiable list of all nodegroups in this nodegroup + */ + List getNodeGroups(); + + /** + * Create new Node in this NodeGroup. + * + * fire indexed PropertyChange Event with name "nodes" and index of this new + * node. + */ + Node createNode(); + + /** + * Add a, previously created, Node to this NodeGroup. + * + * + * fire indexed PropertyChange Event with name "nodes" and index of this new + * node. + */ + void addNode(Node node); + + /** + * Create new NodeGroup in this NodeGroup. + * + * fire indexed PropertyChange Event with name "nodegroups" and index of + * this new nodegroup. + */ + NodeGroup createNodeGroup(); + + /** + * Add a, previously created, NodeGroup to this NodeGroup. + * + * + * fire indexed PropertyChange Event with name "nodegroups" and index of this new + * node. + */ + void addNodeGroup(NodeGroup nodeGroup); + + /** + * @return id attribute of this nodegroup + */ + String getId(); + + /** + * All properties of this node-group + */ + Properties getProperties(); + + /** + * Remove node from this nodegroup. + * + * fire indexed propertychangeevent with propertyname nodes + * + * @return true if operation was successful + */ + boolean removeNode(Node node); + + /** + * Remove a sub-{@link NodeGroup} from this {@link NodeGroup}. + * + * fire indexed propertychange event with propertyname nodegroups. + * + * @param nodeGroup + * a nodeGroup reference + */ + boolean removeNodeGroup(NodeGroup nodeGroup); + + /** + * Register new PropertyChangeListener. + * + * @param listener + */ + void addPropertyChangeListener(PropertyChangeListener listener); + + /** + * Remove previously registered PropertyChangeListener + * + * @param listener + */ + void removePropertyChangeListener(PropertyChangeListener listener); + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/api/Properties.java b/ksm-model/src/de/dhbw/horb/ksm/model/api/Properties.java new file mode 100644 index 0000000..a0ef027 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/api/Properties.java @@ -0,0 +1,138 @@ +package de.dhbw.horb.ksm.model.api; + +import java.beans.PropertyChangeListener; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.List; + +public interface Properties { + /** + * Get Simple String Property by Name + */ + String getString(String name); + + /** + * Get Simple Decimal Property by Name + */ + BigDecimal getDecimal(String name); + + /** + * Get Simple Integer Property by Name + */ + BigInteger getInteger(String name); + + /** + * Get simple Boolean Property by name + */ + Boolean getBoolean(String name); + + /** + * Set Simple String Property by Name. + * + * fires PropertyChange Event with name "string:NAME" where NAME is + * Parameter name + */ + void setString(String name, String value); + + /** + * Set Simple Decimal Property by Name + * + * fires PropertyChange Event with name "decimal:NAME" where NAME is + * Parameter name + */ + void setDecimal(String name, BigDecimal value); + + /** + * Set Simple Integer Property by Name + * + * fires PropertyChange Event with name "integer:NAME" where NAME is + * Parameter name + */ + void setInteger(String name, BigInteger value); + + /** + * Set simple Boolean Property by Name + * + * fires PropertyChange Event with name "boolean:NAME" where NAME is + * Parameter name + */ + void setBoolean(String string, Boolean b); + + /** + * get StringList Property by name + */ + List getStringList(String name); + + /** + * get DecimalList Property by name + */ + List getDecimalList(String name); + + /** + * get IntegerList Property by name + */ + List getIntegerList(String name); + + /** + * Create new StringList Property + * + * fires PropertyChange Event with name "stringList:NAME" where NAME is + * parameter name and Index is the Position in the list + */ + List createStringList(String name); + + /** + * Create new DecimalList Property + * + * fires PropertyChange Event with name "decimalList:NAME" where NAME is + * parameter name and Index is the Position in the list + */ + List createDecimalList(String name); + + /** + * Create new IntegerList Property + * + * fires PropertyChange Event with name "integerList:NAME" where NAME is + * parameter name and Index is the Position in the list + */ + List createIntegerList(String name); + + /** + * Remove StringList Property + * + * fire PropertyChange Event with name "stringList:NAME" where NAME is + * the parameter name + */ + boolean removeStringList(String name); + + /** + * Remove DecimalList Property + * + * fire PropertyChange Event with name "decimalList:NAME" where NAME is + * the parameter name + */ + boolean removeDecimalList(String name); + + /** + * Remove IntegerList Property + * + * + * fire PropertyChange Event with name "integerList:NAME" where NAME is + * the parameter name + */ + boolean removeIntegerList(String name); + + /** + * Register new PropertyChangeListener. + * + * @param listener + */ + void addPropertyChangeListener(PropertyChangeListener listener); + + /** + * Remove previously registered PropertyChangeListener + * + * @param listener + */ + void removePropertyChangeListener(PropertyChangeListener listener); +} \ No newline at end of file diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/ObjectFactory.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/ObjectFactory.java new file mode 100644 index 0000000..93f1dd9 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/ObjectFactory.java @@ -0,0 +1,159 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the de.dhbw.horb.ksm.xmlschema.generated package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: de.dhbw.horb.ksm.xmlschema.generated + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link XKSM } + * + */ + public XKSM createXKSM() { + return new XKSM(); + } + + /** + * Create an instance of {@link XNodeGroup } + * + */ + public XNodeGroup createXNodeGroup() { + return new XNodeGroup(); + } + + /** + * Create an instance of {@link XProperties } + * + */ + public XProperties createXProperties() { + return new XProperties(); + } + + /** + * Create an instance of {@link XPropertyDecimal } + * + */ + public XPropertyDecimal createXPropertyDecimal() { + return new XPropertyDecimal(); + } + + /** + * Create an instance of {@link XPropertyBaseList } + * + */ + public XPropertyBaseList createXPropertyBaseList() { + return new XPropertyBaseList(); + } + + /** + * Create an instance of {@link XPropertyStringList } + * + */ + public XPropertyStringList createXPropertyStringList() { + return new XPropertyStringList(); + } + + /** + * Create an instance of {@link XPropertyIntegerList } + * + */ + public XPropertyIntegerList createXPropertyIntegerList() { + return new XPropertyIntegerList(); + } + + /** + * Create an instance of {@link XPropertyBase } + * + */ + public XPropertyBase createXPropertyBase() { + return new XPropertyBase(); + } + + /** + * Create an instance of {@link XPropertyDecimalList } + * + */ + public XPropertyDecimalList createXPropertyDecimalList() { + return new XPropertyDecimalList(); + } + + /** + * Create an instance of {@link XNode } + * + */ + public XNode createXNode() { + return new XNode(); + } + + /** + * Create an instance of {@link XPropertyString } + * + */ + public XPropertyString createXPropertyString() { + return new XPropertyString(); + } + + /** + * Create an instance of {@link XPropertyBoolean } + * + */ + public XPropertyBoolean createXPropertyBoolean() { + return new XPropertyBoolean(); + } + + /** + * Create an instance of {@link XConnections } + * + */ + public XConnections createXConnections() { + return new XConnections(); + } + + /** + * Create an instance of {@link XConnection } + * + */ + public XConnection createXConnection() { + return new XConnection(); + } + + /** + * Create an instance of {@link XPropertyInteger } + * + */ + public XPropertyInteger createXPropertyInteger() { + return new XPropertyInteger(); + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XConnection.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XConnection.java new file mode 100644 index 0000000..7426aae --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XConnection.java @@ -0,0 +1,97 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for CONNECTION_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CONNECTION_TYPE">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="properties" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTIES_TYPE"/>
+ *       </sequence>
+ *       <attribute name="to" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}NODE_ID_TYPE" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CONNECTION_TYPE", propOrder = { + "properties" +}) +public class XConnection { + + @XmlElement(required = true) + protected XProperties properties; + @XmlAttribute(name = "to") + protected String to; + + /** + * Gets the value of the properties property. + * + * @return + * possible object is + * {@link XProperties } + * + */ + public XProperties getProperties() { + return properties; + } + + /** + * Sets the value of the properties property. + * + * @param value + * allowed object is + * {@link XProperties } + * + */ + public void setProperties(XProperties value) { + this.properties = value; + } + + /** + * Gets the value of the to property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTo() { + return to; + } + + /** + * Sets the value of the to property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTo(String value) { + this.to = value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XConnections.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XConnections.java new file mode 100644 index 0000000..317a00d --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XConnections.java @@ -0,0 +1,74 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for CONNECTIONS_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CONNECTIONS_TYPE">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="connection" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}CONNECTION_TYPE" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CONNECTIONS_TYPE", propOrder = { + "connection" +}) +public class XConnections { + + protected List connection; + + /** + * Gets the value of the connection property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the connection property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getConnection().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link XConnection } + * + * + */ + public List getConnection() { + if (connection == null) { + connection = new ArrayList(); + } + return this.connection; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XKSM.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XKSM.java new file mode 100644 index 0000000..027eb3f --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XKSM.java @@ -0,0 +1,124 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="nodegroup" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}NODEGROUP_TYPE"/>
+ *         <element name="properties" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTIES_TYPE" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="version" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "nodegroup", + "properties" +}) +public class XKSM { + + @XmlElement(required = true) + protected XNodeGroup nodegroup; + protected XProperties properties; + @XmlAttribute(name = "version", required = true) + protected String version; + + /** + * Gets the value of the nodegroup property. + * + * @return + * possible object is + * {@link XNodeGroup } + * + */ + public XNodeGroup getNodegroup() { + return nodegroup; + } + + /** + * Sets the value of the nodegroup property. + * + * @param value + * allowed object is + * {@link XNodeGroup } + * + */ + public void setNodegroup(XNodeGroup value) { + this.nodegroup = value; + } + + /** + * Gets the value of the properties property. + * + * @return + * possible object is + * {@link XProperties } + * + */ + public XProperties getProperties() { + return properties; + } + + /** + * Sets the value of the properties property. + * + * @param value + * allowed object is + * {@link XProperties } + * + */ + public void setProperties(XProperties value) { + this.properties = value; + } + + /** + * Gets the value of the version property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersion() { + return version; + } + + /** + * Sets the value of the version property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersion(String value) { + this.version = value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XNode.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XNode.java new file mode 100644 index 0000000..28593d3 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XNode.java @@ -0,0 +1,124 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for NODE_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="NODE_TYPE">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="properties" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTIES_TYPE"/>
+ *         <element name="connections" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}CONNECTIONS_TYPE" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="id" use="required" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}NODE_ID_TYPE" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "NODE_TYPE", propOrder = { + "properties", + "connections" +}) +public class XNode { + + @XmlElement(required = true) + protected XProperties properties; + protected XConnections connections; + @XmlAttribute(name = "id", required = true) + protected String id; + + /** + * Gets the value of the properties property. + * + * @return + * possible object is + * {@link XProperties } + * + */ + public XProperties getProperties() { + return properties; + } + + /** + * Sets the value of the properties property. + * + * @param value + * allowed object is + * {@link XProperties } + * + */ + public void setProperties(XProperties value) { + this.properties = value; + } + + /** + * Gets the value of the connections property. + * + * @return + * possible object is + * {@link XConnections } + * + */ + public XConnections getConnections() { + return connections; + } + + /** + * Sets the value of the connections property. + * + * @param value + * allowed object is + * {@link XConnections } + * + */ + public void setConnections(XConnections value) { + this.connections = value; + } + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XNodeGroup.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XNodeGroup.java new file mode 100644 index 0000000..6040e94 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XNodeGroup.java @@ -0,0 +1,163 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for NODEGROUP_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="NODEGROUP_TYPE">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="node" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}NODE_TYPE" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="nodegroup" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}NODEGROUP_TYPE" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="properties" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTIES_TYPE"/>
+ *       </sequence>
+ *       <attribute name="id" use="required" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}NODE_ID_TYPE" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "NODEGROUP_TYPE", propOrder = { + "node", + "nodegroup", + "properties" +}) +public class XNodeGroup { + + protected List node; + protected List nodegroup; + @XmlElement(required = true) + protected XProperties properties; + @XmlAttribute(name = "id", required = true) + protected String id; + + /** + * Gets the value of the node property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the node property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getNode().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link XNode } + * + * + */ + public List getNode() { + if (node == null) { + node = new ArrayList(); + } + return this.node; + } + + /** + * Gets the value of the nodegroup property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the nodegroup property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getNodegroup().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link XNodeGroup } + * + * + */ + public List getNodegroup() { + if (nodegroup == null) { + nodegroup = new ArrayList(); + } + return this.nodegroup; + } + + /** + * Gets the value of the properties property. + * + * @return + * possible object is + * {@link XProperties } + * + */ + public XProperties getProperties() { + return properties; + } + + /** + * Sets the value of the properties property. + * + * @param value + * allowed object is + * {@link XProperties } + * + */ + public void setProperties(XProperties value) { + this.properties = value; + } + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XProperties.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XProperties.java new file mode 100644 index 0000000..67febaa --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XProperties.java @@ -0,0 +1,268 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for PROPERTIES_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PROPERTIES_TYPE">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="string" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTY_STRING_TYPE" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="decimal" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTY_DECIMAL_TYPE" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="integer" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTY_INTEGER_TYPE" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="boolean" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTY_BOOLEAN_TYPE" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="stringList" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTY_STRING_LIST_TYPE" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="decimalList" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTY_DECIMAL_LIST_TYPE" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="integerList" type="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTY_INTEGER_LIST_TYPE" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PROPERTIES_TYPE", propOrder = { + "string", + "decimal", + "integer", + "_boolean", + "stringList", + "decimalList", + "integerList" +}) +public class XProperties { + + protected List string; + protected List decimal; + protected List integer; + @XmlElement(name = "boolean") + protected List _boolean; + protected List stringList; + protected List decimalList; + protected List integerList; + + /** + * Gets the value of the string property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the string property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getString().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link XPropertyString } + * + * + */ + public List getString() { + if (string == null) { + string = new ArrayList(); + } + return this.string; + } + + /** + * Gets the value of the decimal property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the decimal property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getDecimal().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link XPropertyDecimal } + * + * + */ + public List getDecimal() { + if (decimal == null) { + decimal = new ArrayList(); + } + return this.decimal; + } + + /** + * Gets the value of the integer property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the integer property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getInteger().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link XPropertyInteger } + * + * + */ + public List getInteger() { + if (integer == null) { + integer = new ArrayList(); + } + return this.integer; + } + + /** + * Gets the value of the boolean property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the boolean property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getBoolean().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link XPropertyBoolean } + * + * + */ + public List getBoolean() { + if (_boolean == null) { + _boolean = new ArrayList(); + } + return this._boolean; + } + + /** + * Gets the value of the stringList property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the stringList property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getStringList().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link XPropertyStringList } + * + * + */ + public List getStringList() { + if (stringList == null) { + stringList = new ArrayList(); + } + return this.stringList; + } + + /** + * Gets the value of the decimalList property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the decimalList property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getDecimalList().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link XPropertyDecimalList } + * + * + */ + public List getDecimalList() { + if (decimalList == null) { + decimalList = new ArrayList(); + } + return this.decimalList; + } + + /** + * Gets the value of the integerList property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the integerList property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getIntegerList().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link XPropertyIntegerList } + * + * + */ + public List getIntegerList() { + if (integerList == null) { + integerList = new ArrayList(); + } + return this.integerList; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBase.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBase.java new file mode 100644 index 0000000..aca1cd6 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBase.java @@ -0,0 +1,97 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; + + +/** + *

Java class for PROPERTY_BASE_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PROPERTY_BASE_TYPE">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>anySimpleType">
+ *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PROPERTY_BASE_TYPE", propOrder = { + "value" +}) +public class XPropertyBase { + + @XmlValue + @XmlSchemaType(name = "anySimpleType") + protected Object value; + @XmlAttribute(name = "name", required = true) + @XmlSchemaType(name = "anySimpleType") + protected String name; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link Object } + * + */ + public Object getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link Object } + * + */ + public void setValue(Object value) { + this.value = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBaseList.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBaseList.java new file mode 100644 index 0000000..fef8e2f --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBaseList.java @@ -0,0 +1,75 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for PROPERTY_LIST_BASE_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PROPERTY_LIST_BASE_TYPE">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PROPERTY_LIST_BASE_TYPE") +@XmlSeeAlso({ + XPropertyStringList.class, + XPropertyIntegerList.class, + XPropertyDecimalList.class +}) +public class XPropertyBaseList { + + @XmlAttribute(name = "name", required = true) + @XmlSchemaType(name = "anySimpleType") + protected String name; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBoolean.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBoolean.java new file mode 100644 index 0000000..ba8d519 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyBoolean.java @@ -0,0 +1,88 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; + + +/** + *

Java class for PROPERTY_BOOLEAN_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PROPERTY_BOOLEAN_TYPE">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>boolean">
+ *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PROPERTY_BOOLEAN_TYPE", propOrder = { + "value" +}) +public class XPropertyBoolean { + + @XmlValue + protected boolean value; + @XmlAttribute(name = "name", required = true) + @XmlSchemaType(name = "anySimpleType") + protected String name; + + /** + * Gets the value of the value property. + * + */ + public boolean isValue() { + return value; + } + + /** + * Sets the value of the value property. + * + */ + public void setValue(boolean value) { + this.value = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyDecimal.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyDecimal.java new file mode 100644 index 0000000..105552b --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyDecimal.java @@ -0,0 +1,97 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import java.math.BigDecimal; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; + + +/** + *

Java class for PROPERTY_DECIMAL_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PROPERTY_DECIMAL_TYPE">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>decimal">
+ *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PROPERTY_DECIMAL_TYPE", propOrder = { + "value" +}) +public class XPropertyDecimal { + + @XmlValue + protected BigDecimal value; + @XmlAttribute(name = "name", required = true) + @XmlSchemaType(name = "anySimpleType") + protected String name; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link BigDecimal } + * + */ + public BigDecimal getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link BigDecimal } + * + */ + public void setValue(BigDecimal value) { + this.value = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyDecimalList.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyDecimalList.java new file mode 100644 index 0000000..9078b5c --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyDecimalList.java @@ -0,0 +1,77 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for PROPERTY_DECIMAL_LIST_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PROPERTY_DECIMAL_LIST_TYPE">
+ *   <complexContent>
+ *     <extension base="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTY_LIST_BASE_TYPE">
+ *       <sequence>
+ *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}decimal" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PROPERTY_DECIMAL_LIST_TYPE", propOrder = { + "value" +}) +public class XPropertyDecimalList + extends XPropertyBaseList +{ + + protected List value; + + /** + * Gets the value of the value property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the value property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getValue().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link BigDecimal } + * + * + */ + public List getValue() { + if (value == null) { + value = new ArrayList(); + } + return this.value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyInteger.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyInteger.java new file mode 100644 index 0000000..2fe2d51 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyInteger.java @@ -0,0 +1,97 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import java.math.BigInteger; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; + + +/** + *

Java class for PROPERTY_INTEGER_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PROPERTY_INTEGER_TYPE">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>integer">
+ *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PROPERTY_INTEGER_TYPE", propOrder = { + "value" +}) +public class XPropertyInteger { + + @XmlValue + protected BigInteger value; + @XmlAttribute(name = "name", required = true) + @XmlSchemaType(name = "anySimpleType") + protected String name; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setValue(BigInteger value) { + this.value = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyIntegerList.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyIntegerList.java new file mode 100644 index 0000000..c6ee73d --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyIntegerList.java @@ -0,0 +1,77 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for PROPERTY_INTEGER_LIST_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PROPERTY_INTEGER_LIST_TYPE">
+ *   <complexContent>
+ *     <extension base="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTY_LIST_BASE_TYPE">
+ *       <sequence>
+ *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}integer" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PROPERTY_INTEGER_LIST_TYPE", propOrder = { + "value" +}) +public class XPropertyIntegerList + extends XPropertyBaseList +{ + + protected List value; + + /** + * Gets the value of the value property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the value property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getValue().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link BigInteger } + * + * + */ + public List getValue() { + if (value == null) { + value = new ArrayList(); + } + return this.value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyString.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyString.java new file mode 100644 index 0000000..df2bf36 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyString.java @@ -0,0 +1,96 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; + + +/** + *

Java class for PROPERTY_STRING_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PROPERTY_STRING_TYPE">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>string">
+ *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PROPERTY_STRING_TYPE", propOrder = { + "value" +}) +public class XPropertyString { + + @XmlValue + protected String value; + @XmlAttribute(name = "name", required = true) + @XmlSchemaType(name = "anySimpleType") + protected String name; + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyStringList.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyStringList.java new file mode 100644 index 0000000..ffddcbb --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/XPropertyStringList.java @@ -0,0 +1,76 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + + +package de.dhbw.horb.ksm.model.generated; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for PROPERTY_STRING_LIST_TYPE complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="PROPERTY_STRING_LIST_TYPE">
+ *   <complexContent>
+ *     <extension base="{http://www.ba-horb.de/~ksm/xml/ksm-1}PROPERTY_LIST_BASE_TYPE">
+ *       <sequence>
+ *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "PROPERTY_STRING_LIST_TYPE", propOrder = { + "value" +}) +public class XPropertyStringList + extends XPropertyBaseList +{ + + protected List value; + + /** + * Gets the value of the value property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the value property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getValue().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getValue() { + if (value == null) { + value = new ArrayList(); + } + return this.value; + } + +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/generated/package-info.java b/ksm-model/src/de/dhbw/horb/ksm/model/generated/package-info.java new file mode 100644 index 0000000..1cb8266 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/generated/package-info.java @@ -0,0 +1,9 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3- +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2011.04.27 at 01:09:52 PM MESZ +// + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.ba-horb.de/~ksm/xml/ksm-1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package de.dhbw.horb.ksm.model.generated; diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/impl/ConnectionImpl.java b/ksm-model/src/de/dhbw/horb/ksm/model/impl/ConnectionImpl.java new file mode 100644 index 0000000..7acb87d --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/impl/ConnectionImpl.java @@ -0,0 +1,49 @@ +package de.dhbw.horb.ksm.model.impl; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +import de.dhbw.horb.ksm.model.api.Connection; +import de.dhbw.horb.ksm.model.api.Properties; +import de.dhbw.horb.ksm.model.generated.XConnection; + +class ConnectionImpl implements Connection { + final XConnection xconn; + private final Properties properties; + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + @Override + public void addPropertyChangeListener(PropertyChangeListener listener) { + pcs.addPropertyChangeListener(listener); + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener listener) { + pcs.removePropertyChangeListener(listener); + } + + public ConnectionImpl(XConnection xconn) { + this.xconn = xconn; + if (xconn.getProperties() == null) { + xconn.setProperties(KSMFactory.objectFactory.createXProperties()); + } + this.properties = new PropertiesImpl(xconn.getProperties()); + } + + @Override + public String getTo() { + return xconn.getTo(); + } + + @Override + public void setTo(String id) { + String oldValue = getTo(); + xconn.setTo(id); + pcs.firePropertyChange("to", oldValue, getTo()); + } + + @Override + public Properties getProperties() { + return properties; + } +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/impl/KSMFactory.java b/ksm-model/src/de/dhbw/horb/ksm/model/impl/KSMFactory.java new file mode 100644 index 0000000..9a33684 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/impl/KSMFactory.java @@ -0,0 +1,74 @@ +package de.dhbw.horb.ksm.model.impl; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.namespace.QName; +import javax.xml.transform.sax.SAXSource; + +import org.xml.sax.InputSource; + +import de.dhbw.horb.ksm.model.api.KSM; +import de.dhbw.horb.ksm.model.generated.ObjectFactory; +import de.dhbw.horb.ksm.model.generated.XKSM; + +public class KSMFactory { + private static JAXBContext jc = null; + static ObjectFactory objectFactory = new ObjectFactory(); + + static { + try { + jc = JAXBContext.newInstance(XKSM.class); + } catch (JAXBException e) { + throw new RuntimeException(e); + } + } + + public static KSM loadKSM(File file) throws FileNotFoundException, + JAXBException { + return loadKSM(new FileInputStream(file)); + } + + public static KSM loadKSM(InputStream is) throws JAXBException { + Unmarshaller u = jc.createUnmarshaller(); + + JAXBElement xksm = u.unmarshal(new SAXSource(new InputSource(is)), XKSM.class); + + return new KSMImpl(xksm.getValue()); + } + + public static KSM createEmptyKSM() { + ObjectFactory of = new ObjectFactory(); + XKSM xksm = of.createXKSM(); + KSMImpl ksm = new KSMImpl(xksm); + return ksm; + } + + public static void saveKSM(KSM ksm, File file) + throws FileNotFoundException, JAXBException { + saveKSM(ksm, new FileOutputStream(file)); + } + + public static void saveKSM(KSM ksm, OutputStream os) throws JAXBException { + if (ksm instanceof KSMImpl) { + KSMImpl ksmimpl = (KSMImpl) ksm; + JAXBElement x = new JAXBElement(new QName("ksm"), + XKSM.class, ksmimpl.getXksm()); + Marshaller m = jc.createMarshaller(); + + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + m.marshal(x, os); + } else { + throw new JAXBException("Illegal KSM Object type"); + } + } +} diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/impl/KSMImpl.java b/ksm-model/src/de/dhbw/horb/ksm/model/impl/KSMImpl.java new file mode 100644 index 0000000..1980e1e --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/impl/KSMImpl.java @@ -0,0 +1,109 @@ +package de.dhbw.horb.ksm.model.impl; + +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import de.dhbw.horb.ksm.model.api.Connection; +import de.dhbw.horb.ksm.model.api.KSM; +import de.dhbw.horb.ksm.model.api.Node; +import de.dhbw.horb.ksm.model.api.NodeGroup; +import de.dhbw.horb.ksm.model.generated.XKSM; +import de.dhbw.horb.ksm.model.generated.XNodeGroup; + +class KSMImpl implements KSM { + private final XKSM xksm; + private NodeGroupImpl nodeGroup; + private PropertiesImpl properties; + + public KSMImpl(XKSM xksm) { + this.xksm = xksm; + if (xksm.getNodegroup() == null) { + XNodeGroup xNodeGroup = KSMFactory.objectFactory.createXNodeGroup(); + xNodeGroup.setId(UUID.randomUUID().toString()); + xksm.setNodegroup(xNodeGroup); + } + this.nodeGroup = new NodeGroupImpl(xksm.getNodegroup()); + if (xksm.getProperties() == null) { + xksm.setProperties(KSMFactory.objectFactory.createXProperties()); + } + this.properties = new PropertiesImpl(xksm.getProperties()); + } + + XKSM getXksm() { + return xksm; + } + + @Override + public NodeGroup getNodeGroup() { + return nodeGroup; + } + + @Override + public PropertiesImpl getProperties() { + return properties; + } + + @Override + public String getVersion() { + return xksm.getVersion(); + } + + @Override + public NodeGroup lookupNodeGroup(String id) { + if (id == null) + return null; + + ArrayDeque queue = new ArrayDeque(); + queue.add(getNodeGroup()); + while (!queue.isEmpty()) { + NodeGroup group = queue.pop(); + if (group.getId().equals(id)) { + return group; + } else { + queue.addAll(group.getNodeGroups()); + } + } + return null; + } + + @Override + public Node lookupNode(String id) { + if (id == null) + return null; + + for (Node node : getAllNodes()) { + if (id.equals(node.getId())) { + return node; + } + } + return null; + } + + @Override + public Iterable getAllNodes() { + List nodes = new ArrayList(); + ArrayDeque queue = new ArrayDeque(); + queue.add(getNodeGroup()); + while (!queue.isEmpty()) { + NodeGroup group = queue.pop(); + nodes.addAll(group.getNodes()); + queue.addAll(group.getNodeGroups()); + } + return nodes; + } + + @Override + public List getIncomingConnections(Node node) { + List nodes = new ArrayList(); + for (Node otherNode : getAllNodes()) { + for (Connection connection : otherNode.getConnections()) { + if (connection.getTo().equals(node.getId())) { + nodes.add(otherNode); + } + } + } + return nodes; + } +} \ No newline at end of file diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/impl/NodeGroupImpl.java b/ksm-model/src/de/dhbw/horb/ksm/model/impl/NodeGroupImpl.java new file mode 100644 index 0000000..6457c78 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/impl/NodeGroupImpl.java @@ -0,0 +1,153 @@ +package de.dhbw.horb.ksm.model.impl; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import de.dhbw.horb.ksm.model.api.Node; +import de.dhbw.horb.ksm.model.api.NodeGroup; +import de.dhbw.horb.ksm.model.generated.XNode; +import de.dhbw.horb.ksm.model.generated.XNodeGroup; + +class NodeGroupImpl implements NodeGroup { + + private final XNodeGroup xnodegroup; + private final List nodes = new ArrayList(); + private final List nodeGroups = new ArrayList(); + private final PropertiesImpl properties; + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + @Override + public void addPropertyChangeListener(PropertyChangeListener listener) { + pcs.addPropertyChangeListener(listener); + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener listener) { + pcs.removePropertyChangeListener(listener); + } + + public NodeGroupImpl(XNodeGroup xnodegroup) { + this.xnodegroup = xnodegroup; + if (xnodegroup.getProperties() == null) { + xnodegroup.setProperties(KSMFactory.objectFactory + .createXProperties()); + } + this.properties = new PropertiesImpl(xnodegroup.getProperties()); + for (XNode xnode : xnodegroup.getNode()) { + nodes.add(new NodeImpl(xnode)); + } + for (XNodeGroup xOtherNodeGroup : xnodegroup.getNodegroup()) { + nodeGroups.add(new NodeGroupImpl(xOtherNodeGroup)); + } + } + + @Override + public List getNodes() { + return Collections.unmodifiableList(nodes); + } + + @Override + public List getNodeGroups() { + return Collections.unmodifiableList(nodeGroups); + } + + @Override + public Node createNode() { + XNode xNode = KSMFactory.objectFactory.createXNode(); + xNode.setId(UUID.randomUUID().toString()); + NodeImpl node = new NodeImpl(xNode); + addNode(node); + return node; + } + + @Override + public void addNode(Node node) { + if (node instanceof NodeImpl) { + NodeImpl nodeImpl = (NodeImpl) node; + xnodegroup.getNode().add(nodeImpl.xnode); + nodes.add(nodeImpl); + pcs.fireIndexedPropertyChange("nodes", nodes.indexOf(nodeImpl), + null, node); + } else { + throw new IllegalArgumentException( + "The node Object must be of type NodeImpl"); + } + } + + @Override + public void addNodeGroup(NodeGroup nodeGroup) { + if (nodeGroup instanceof NodeGroupImpl) { + NodeGroupImpl nodeGruopImpl = (NodeGroupImpl) nodeGroup; + xnodegroup.getNodegroup().add(nodeGruopImpl.xnodegroup); + nodeGroups.add(nodeGruopImpl); + pcs.fireIndexedPropertyChange("nodegroups", + nodes.indexOf(nodeGruopImpl), null, nodeGroup); + } else { + throw new IllegalArgumentException( + "The nodeGroup Object must be of type NodeGroupImpl"); + } + } + + @Override + public boolean removeNode(Node node) { + if (node instanceof NodeImpl) { + NodeImpl nodeImpl = (NodeImpl) node; + int index = nodes.indexOf(node); + boolean success = nodes.remove(node) + && xnodegroup.getNode().remove(nodeImpl.xnode); + if (success) { + pcs.fireIndexedPropertyChange("nodes", index, node, null); + return true; + } else { + return false; + } + } else { + return false; + } + } + + @Override + public NodeGroup createNodeGroup() { + XNodeGroup subXNodeGroup = KSMFactory.objectFactory.createXNodeGroup(); + subXNodeGroup.setId(UUID.randomUUID().toString()); + + NodeGroup nodeGroup = new NodeGroupImpl(subXNodeGroup); + addNodeGroup(nodeGroup); + return nodeGroup; + } + + @Override + public boolean removeNodeGroup(NodeGroup nodeGroup) { + if (nodeGroup instanceof NodeGroupImpl) { + NodeGroupImpl nodeGroupImpl = (NodeGroupImpl) nodeGroup; + int index = nodeGroups.indexOf(nodeGroupImpl); + boolean success = nodeGroups.remove(nodeGroupImpl); + success &= xnodegroup.getNodegroup().remove( + nodeGroupImpl.xnodegroup); + if (success) { + pcs.fireIndexedPropertyChange("nodegroups", index, nodeGroup, + null); + return true; + } else { + return false; + } + } else { + throw new IllegalArgumentException( + "The nodeGroup Object must be of type NodeGroupImpl"); + } + } + + @Override + public String getId() { + return xnodegroup.getId(); + } + + @Override + public PropertiesImpl getProperties() { + return properties; + } +} \ No newline at end of file diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/impl/NodeImpl.java b/ksm-model/src/de/dhbw/horb/ksm/model/impl/NodeImpl.java new file mode 100644 index 0000000..9cd47cd --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/impl/NodeImpl.java @@ -0,0 +1,109 @@ +package de.dhbw.horb.ksm.model.impl; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import de.dhbw.horb.ksm.model.api.Connection; +import de.dhbw.horb.ksm.model.api.Node; +import de.dhbw.horb.ksm.model.api.Properties; +import de.dhbw.horb.ksm.model.generated.XConnection; +import de.dhbw.horb.ksm.model.generated.XNode; + +class NodeImpl implements Node { + private static final String PROPERTY_CONNECTIONS = "connections"; + final XNode xnode; + private final Properties properties; + private List connections = new ArrayList(); + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + public NodeImpl(XNode xnode) { + this.xnode = xnode; + if (xnode.getConnections() == null) { + xnode.setConnections(KSMFactory.objectFactory.createXConnections()); + } + for (XConnection xconn : xnode.getConnections().getConnection()) { + connections.add(new ConnectionImpl(xconn)); + } + if (xnode.getProperties() == null) { + xnode.setProperties(KSMFactory.objectFactory.createXProperties()); + } + this.properties = new PropertiesImpl(xnode.getProperties()); + } + + @Override + public void addPropertyChangeListener(PropertyChangeListener listener) { + pcs.addPropertyChangeListener(listener); + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener listener) { + pcs.removePropertyChangeListener(listener); + } + + @Override + public List getConnections() { + return Collections.unmodifiableList(connections); + } + + @Override + public String getId() { + return xnode.getId(); + } + + @Override + public Properties getProperties() { + return properties; + } + + @Override + public Connection createConnection(String to) { + XConnection xConnection = KSMFactory.objectFactory.createXConnection(); + Connection connection = new ConnectionImpl(xConnection); + connection.setTo(to); + + addConnection(connection); + return connection; + } + + @Override + public Connection createConnection(Node toNode) { + return createConnection(toNode.getId()); + } + + @Override + public void addConnection(Connection connection) { + if (connection instanceof ConnectionImpl) { + ConnectionImpl c = (ConnectionImpl) connection; + xnode.getConnections().getConnection().add(c.xconn); + connections.add(connection); + + pcs.fireIndexedPropertyChange(PROPERTY_CONNECTIONS, + connections.indexOf(connection), null, connection); + } else { + throw new IllegalArgumentException("Argument connection must be of type ConnectionImpl"); + } + } + + @Override + public boolean removeConnection(Connection connection) { + if (connection instanceof ConnectionImpl) { + int index = connections.indexOf(connection); + ConnectionImpl c = (ConnectionImpl) connection; + + boolean ret = connections.remove(connection) + && xnode.getConnections().getConnection().remove(c.xconn); + if (ret) { + pcs.fireIndexedPropertyChange(PROPERTY_CONNECTIONS, index, + connection, null); + return true; + } else { + return false; + } + } else { + throw new IllegalArgumentException("Argument connection must be of type ConnectionImpl"); + } + } +} \ No newline at end of file diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/impl/PropertiesImpl.java b/ksm-model/src/de/dhbw/horb/ksm/model/impl/PropertiesImpl.java new file mode 100644 index 0000000..80639d5 --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/impl/PropertiesImpl.java @@ -0,0 +1,356 @@ +package de.dhbw.horb.ksm.model.impl; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.List; + +import de.dhbw.horb.ksm.model.api.Properties; +import de.dhbw.horb.ksm.model.generated.XProperties; +import de.dhbw.horb.ksm.model.generated.XPropertyBoolean; +import de.dhbw.horb.ksm.model.generated.XPropertyDecimal; +import de.dhbw.horb.ksm.model.generated.XPropertyDecimalList; +import de.dhbw.horb.ksm.model.generated.XPropertyInteger; +import de.dhbw.horb.ksm.model.generated.XPropertyIntegerList; +import de.dhbw.horb.ksm.model.generated.XPropertyString; +import de.dhbw.horb.ksm.model.generated.XPropertyStringList; + +class PropertiesImpl implements Properties { + + private final XProperties xproperties; + + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + public PropertiesImpl(XProperties properties) { + this.xproperties = properties; + } + + @Override + public void addPropertyChangeListener(PropertyChangeListener listener) { + pcs.addPropertyChangeListener(listener); + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener listener) { + pcs.removePropertyChangeListener(listener); + } + + private XPropertyString getStringXProperty(String name) { + if (name == null) + return null; + if (xproperties.getString() == null) + return null; + for (XPropertyString x : xproperties.getString()) { + if (name.equals(x.getName())) { + return x; + } + } + return null; + } + + private XPropertyDecimal getDecimalXProperty(String name) { + if (name == null) + return null; + if (xproperties.getDecimal() == null) + return null; + for (XPropertyDecimal x : xproperties.getDecimal()) { + if (name.equals(x.getName())) { + return x; + } + } + return null; + } + + private XPropertyInteger getIntegerXProperty(String name) { + if (name == null) + return null; + if (xproperties.getInteger() == null) + return null; + for (XPropertyInteger x : xproperties.getInteger()) { + if (name.equals(x.getName())) { + return x; + } + } + return null; + } + + private XPropertyBoolean getBooleanXProperty(String name) { + if (name == null) + return null; + if (xproperties.getBoolean() == null) + return null; + for (XPropertyBoolean x : xproperties.getBoolean()) { + if (name.equals(x.getName())) { + return x; + } + } + return null; + } + + @Override + public String getString(String name) { + XPropertyString stringProperty = getStringXProperty(name); + if (stringProperty == null) { + return null; + } else { + return (String) stringProperty.getValue(); + } + } + + @Override + public BigDecimal getDecimal(String name) { + XPropertyDecimal decimalProperty = getDecimalXProperty(name); + if (decimalProperty == null) { + return null; + } else { + return (BigDecimal) decimalProperty.getValue(); + } + } + + @Override + public BigInteger getInteger(String name) { + XPropertyInteger integerProperty = getIntegerXProperty(name); + if (integerProperty == null) { + return null; + } else { + return integerProperty.getValue(); + } + } + + @Override + public Boolean getBoolean(String name) { + XPropertyBoolean booleanProperty = getBooleanXProperty(name); + if (booleanProperty == null) { + return null; + } else { + return booleanProperty.isValue(); + } + } + + private XPropertyDecimalList getDecimalListXProperty(String name) { + if (name == null) + return null; + for (XPropertyDecimalList x : xproperties.getDecimalList()) { + if (name.equals(x.getName())) { + return x; + } + } + return null; + } + + @Override + public List getDecimalList(String name) { + XPropertyDecimalList xDecimalList = getDecimalListXProperty(name); + if (xDecimalList == null) + return null; + else + return xDecimalList.getValue(); + } + + @Override + public void setString(final String name, final String value) { + XPropertyString stringProperty = getStringXProperty(name); + if (stringProperty == null) { + stringProperty = KSMFactory.objectFactory.createXPropertyString(); + stringProperty.setName(name); + xproperties.getString().add(stringProperty); + stringProperty.setValue(value); + pcs.firePropertyChange("string:" + name, null, value); + } else { + Object oldValue = stringProperty.getValue(); + stringProperty.setValue(value); + pcs.firePropertyChange("string:" + name, oldValue, value); + } + } + + @Override + public void setDecimal(final String name, final BigDecimal value) { + XPropertyDecimal property = getDecimalXProperty(name); + if (property == null) { + property = KSMFactory.objectFactory.createXPropertyDecimal(); + property.setName(name); + xproperties.getDecimal().add(property); + property.setValue(value); + pcs.firePropertyChange("decimal:" + name, null, value); + } else { + BigDecimal oldValue = property.getValue(); + property.setValue(value); + pcs.firePropertyChange("decimal:" + name, oldValue, value); + } + } + + @Override + public void setInteger(String name, BigInteger value) { + XPropertyInteger property = getIntegerXProperty(name); + if (property == null) { + property = KSMFactory.objectFactory.createXPropertyInteger(); + property.setName(name); + xproperties.getInteger().add(property); + property.setValue(value); + pcs.firePropertyChange("integer:" + name, null, value); + } else { + BigInteger oldValue = property.getValue(); + property.setValue(value); + pcs.firePropertyChange("integer:" + name, oldValue, value); + } + + } + + @Override + public void setBoolean(String name, Boolean value) { + XPropertyBoolean property = getBooleanXProperty(name); + if (property == null) { + property = KSMFactory.objectFactory.createXPropertyBoolean(); + property.setName(name); + xproperties.getBoolean().add(property); + property.setValue(value); + pcs.firePropertyChange("boolean:" + name, null, value); + } else { + Boolean oldValue = property.isValue(); + property.setValue(value); + pcs.firePropertyChange("boolean:" + name, oldValue, value); + } + + } + + private XPropertyStringList getStringListXProperty(String name) { + if (name == null) + return null; + for (XPropertyStringList x : xproperties.getStringList()) { + if (name.equals(x.getName())) { + return x; + } + } + return null; + } + + public XPropertyIntegerList getIntegerListXProperty(String name) { + if (name == null) + return null; + for (XPropertyIntegerList x : xproperties.getIntegerList()) { + if (name.equals(x.getName())) { + return x; + } + } + return null; + } + + @Override + public List getIntegerList(String name) { + XPropertyIntegerList xIntegerList = getIntegerListXProperty(name); + if (xIntegerList == null) + return null; + else + return xIntegerList.getValue(); + } + + @Override + public List getStringList(String name) { + XPropertyStringList xStringList = getStringListXProperty(name); + if (xStringList == null) + return null; + else + return xStringList.getValue(); + } + + /** + * + * @return null if name==null or property already exists + */ + @Override + public List createStringList(String name) { + if (name == null) + return null; + if (getStringList(name) != null) { + return null; + } + XPropertyStringList list = KSMFactory.objectFactory + .createXPropertyStringList(); + list.setName(name); + xproperties.getStringList().add(list); + pcs.fireIndexedPropertyChange("stringList" + name, xproperties + .getStringList().indexOf(list), null, list.getValue()); + return list.getValue(); + } + + /** + * + * @return null if name==null or property already exists + */ + @Override + public List createDecimalList(String name) { + if (name == null) + return null; + if (getDecimalList(name) != null) { + return null; + } + XPropertyDecimalList list = KSMFactory.objectFactory + .createXPropertyDecimalList(); + list.setName(name); + xproperties.getDecimalList().add(list); + pcs.fireIndexedPropertyChange("decimalList" + name, xproperties + .getDecimalList().indexOf(list), null, list.getValue()); + return list.getValue(); + } + + /** + * + * @return null if name==null or property already exists + */ + @Override + public List createIntegerList(String name) { + if (name == null) + return null; + if (getIntegerList(name) != null) { + return null; + } + XPropertyIntegerList list = KSMFactory.objectFactory + .createXPropertyIntegerList(); + list.setName(name); + xproperties.getIntegerList().add(list); + pcs.fireIndexedPropertyChange("integerList" + name, xproperties + .getIntegerList().indexOf(list), null, list.getValue()); + return list.getValue(); + } + + @Override + public boolean removeStringList(String name) { + XPropertyStringList oldValue = getStringListXProperty(name); + int index = xproperties.getStringList().indexOf(oldValue); + boolean ret = xproperties.getStringList().remove(oldValue); + if (ret) { + pcs.fireIndexedPropertyChange("stringList" + name, index, oldValue, + null); + return true; + } else { + return false; + } + } + + @Override + public boolean removeDecimalList(String name) { + XPropertyDecimalList oldValue = getDecimalListXProperty(name); + int index = xproperties.getDecimalList().indexOf(oldValue); + boolean ret = xproperties.getDecimalList().remove(oldValue); + if (ret) { + pcs.fireIndexedPropertyChange("decimalList", index, oldValue, null); + return true; + } else { + return false; + } + } + + @Override + public boolean removeIntegerList(String name) { + XPropertyIntegerList oldValue = getIntegerListXProperty(name); + int index = xproperties.getDecimalList().indexOf(oldValue); + boolean ret = xproperties.getDecimalList().remove(oldValue); + if (ret) { + pcs.fireIndexedPropertyChange("integerList", index, oldValue, null); + return true; + } else { + return false; + } + } +} \ No newline at end of file diff --git a/ksm-model/src/de/dhbw/horb/ksm/model/impl/package.html b/ksm-model/src/de/dhbw/horb/ksm/model/impl/package.html new file mode 100644 index 0000000..f1c8aee --- /dev/null +++ b/ksm-model/src/de/dhbw/horb/ksm/model/impl/package.html @@ -0,0 +1,3 @@ +Diese Package enthält die Implementierung des entsprechenden .api Packages. +
+Nach aussen ist nur die Klasse KSMFactory sichtbar \ No newline at end of file -- cgit v1.2.1