Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting model #1

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,37 +60,12 @@
<version>2.4.0</version>
</dependency>

<!-- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency> -->

<!-- <dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency> -->

<!-- <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.7</version>
</dependency> -->

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>

<!-- <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.0</version>
</dependency> -->

<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-runtime</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

import java.net.URL;

/**
* @author alagane
alagane marked this conversation as resolved.
Show resolved Hide resolved
*/
public class RuntimeComponent {
private final String id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

import org.ow2.petals.deployer.runtimemodel.RuntimeModel.RuntimeModelException;

/**
* @author alagane
*/
public class RuntimeContainer {

private final String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
import java.util.HashMap;
import java.util.Map;

/**
* @author alagane
*/
public class RuntimeModel {

private Map<String, RuntimeContainer> containers = new HashMap<String, RuntimeContainer>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

import java.net.URL;

/**
* @author alagane
*/
public class RuntimeServiceUnit {

private final String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@
import org.ow2.petals.deployer.runtimemodel.RuntimeModel.RuntimeModelException;
import org.ow2.petals.deployer.runtimemodel.RuntimeServiceUnit;

/**
* @author alagane
*/
public class ModelConverter {
public RuntimeModel convertModelToRuntimeModel(Model model) throws MalformedURLException, RuntimeModelException {
public static RuntimeModel convertModelToRuntimeModel(Model model)
throws MalformedURLException, RuntimeModelException {
RuntimeModel runtimeModel = new RuntimeModel();

TopologyModel topoModel = model.getTopologyModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
import org.ow2.petals.deployer.runtimemodel.RuntimeModel.RuntimeModelException;
import org.ow2.petals.jbi.descriptor.JBIDescriptorException;

/**
* @author alagane
*/
public class ModelDeployer {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

package org.ow2.petals.deployer.utils;

/**
* @author alagane
*/
public class ModelDeployerException extends Exception {

private static final long serialVersionUID = 7599724111843987402L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@
import org.ow2.petals.deployer.runtimemodel.RuntimeModel;
import org.ow2.petals.deployer.runtimemodel.RuntimeServiceUnit;

/**
* @author alagane
*/
public class RuntimeModelComparator {
public boolean compareRuntimeModels(final RuntimeModel m1, final RuntimeModel m2) {
public static boolean compareRuntimeModels(final RuntimeModel m1, final RuntimeModel m2) {
alagane marked this conversation as resolved.
Show resolved Hide resolved
return compareRuntimeContainerMaps(m1, m2);
}

private boolean compareRuntimeComponentMaps(RuntimeContainer cont1, RuntimeContainer cont2) {
private static boolean compareRuntimeComponentMaps(RuntimeContainer cont1, RuntimeContainer cont2) {
Collection<RuntimeComponent> compList1 = cont1.getComponents();
Collection<RuntimeComponent> compList2 = cont2.getComponents();

Expand All @@ -50,7 +53,7 @@ private boolean compareRuntimeComponentMaps(RuntimeContainer cont1, RuntimeConta
return true;
}

private boolean compareRuntimeContainerMaps(RuntimeModel m1, RuntimeModel m2) {
private static boolean compareRuntimeContainerMaps(RuntimeModel m1, RuntimeModel m2) {
Collection<RuntimeContainer> contList1 = m1.getContainers();
Collection<RuntimeContainer> contList2 = m2.getContainers();

Expand All @@ -70,14 +73,14 @@ private boolean compareRuntimeContainerMaps(RuntimeModel m1, RuntimeModel m2) {
return true;
}

private boolean compareRuntimeContainers(RuntimeContainer cont1, RuntimeContainer cont2) {
private static boolean compareRuntimeContainers(RuntimeContainer cont1, RuntimeContainer cont2) {
return cont1.getId().equals(cont2.getId()) && cont1.getPort() == cont2.getPort()
&& cont1.getUser().equals(cont2.getUser()) && cont1.getPassword().equals(cont2.getPassword())
&& cont1.getHostname().equals(cont2.getHostname()) && compareRuntimeServiceUnitMaps(cont1, cont2)
&& compareRuntimeComponentMaps(cont1, cont2);
}

private boolean compareRuntimeServiceUnitMaps(RuntimeContainer cont1, RuntimeContainer cont2) {
private static boolean compareRuntimeServiceUnitMaps(RuntimeContainer cont1, RuntimeContainer cont2) {
Collection<RuntimeServiceUnit> suList1 = cont1.getServiceUnits();
Collection<RuntimeServiceUnit> suList2 = cont2.getServiceUnits();

Expand All @@ -97,11 +100,11 @@ private boolean compareRuntimeServiceUnitMaps(RuntimeContainer cont1, RuntimeCon
return true;
}

private boolean compareRuntimeServiceUnits(RuntimeServiceUnit su1, RuntimeServiceUnit su2) {
private static boolean compareRuntimeServiceUnits(RuntimeServiceUnit su1, RuntimeServiceUnit su2) {
return su1.getId().equals(su2.getId());
alagane marked this conversation as resolved.
Show resolved Hide resolved
}

private boolean compareRuntimeComponents(RuntimeComponent comp1, RuntimeComponent comp2) {
private static boolean compareRuntimeComponents(RuntimeComponent comp1, RuntimeComponent comp2) {
return comp1.getId().equals(comp2.getId());
alagane marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
import org.ow2.petals.jbi.descriptor.original.generated.Jbi;
import org.ow2.petals.jbi.descriptor.original.generated.ServiceAssembly;

/**
* @author alagane
*/
alagane marked this conversation as resolved.
Show resolved Hide resolved
public class RuntimeModelDeployer {

private static final Logger LOG = Logger.getLogger(RuntimeModelDeployer.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

package org.ow2.petals.deployer.utils;

/**
* @author alagane
*/
alagane marked this conversation as resolved.
Show resolved Hide resolved
public class RuntimeModelDeployerException extends Exception {

private static final long serialVersionUID = -3352449083809006549L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
import org.ow2.petals.deployer.runtimemodel.RuntimeServiceUnit;
import org.ow2.petals.jbi.descriptor.JBIDescriptorException;

/**
* @author alagane
*/
alagane marked this conversation as resolved.
Show resolved Hide resolved
public class RuntimeModelExporter {

private static final Logger LOG = Logger.getLogger(RuntimeModelExporter.class.getName());
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/binding.xjb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
-->
<jaxb:bindings version="2.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jaxb:bindings schemaLocation="component-repository.xsd"/>
<jaxb:bindings schemaLocation="component-repository.xsd" />
<jaxb:bindings schemaLocation="service-unit-model.xsd" />
<jaxb:bindings schemaLocation="topology-model.xsd" />
<jaxb:bindings schemaLocation="bus-model.xsd" />
Expand Down
123 changes: 108 additions & 15 deletions src/main/resources/bus-model.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -27,50 +27,143 @@

<complexType name="busModel">
<sequence>
<element name="machine" type="bm:machine" maxOccurs="unbounded" />
<element name="bus" type="bm:bus" maxOccurs="unbounded" />
<element name="machine" type="bm:machine" maxOccurs="unbounded">
<annotation>
<documentation>
The machines on which parts of a Petals ESB bus will be running.
</documentation>
</annotation>
</element>
<element name="bus" type="bm:bus" maxOccurs="unbounded">
<annotation>
<documentation>
The list of Petals ESB busses to deploy.
</documentation>
</annotation>
</element>
</sequence>
</complexType>

<complexType name="bus">
<sequence>
<element name="container-instance" type="bm:containerInstance" maxOccurs="unbounded" />
<element name="container-instance" type="bm:containerInstance" maxOccurs="unbounded">
<annotation>
<documentation>
The instances of Petals ESB containers forming the Petals ESB bus.
</documentation>
</annotation>
</element>
</sequence>
<attribute name="topology-ref" type="string" use="required" />
<attribute name="topology-ref" type="string" use="required">
<annotation>
<documentation>
The reference topology from the topology model.
</documentation>
</annotation>
</attribute>
</complexType>

<complexType name="containerInstance">
<sequence>
<element name="component-instance" type="bm:componentInstance" maxOccurs="unbounded" />
<element name="service-unit-instance" type="bm:serviceUnitInstance" maxOccurs="unbounded" />
<element name="component-instance" type="bm:componentInstance" maxOccurs="unbounded">
<annotation>
<documentation>
The component instances required by service units.
</documentation>
</annotation>
</element>
<element name="service-unit-instance" type="bm:serviceUnitInstance" maxOccurs="unbounded">
<annotation>
<documentation>
The service unit instances to deploy on the container.
</documentation>
</annotation>
</element>
</sequence>
<attribute name="ref" type="string" use="optional" />
<attribute name="jmx-port" type="int" />
<attribute name="jmx-user" type="string" />
<attribute name="jmx-password" type="string" />
<attribute name="machine-ref" type="string" use="required" />
<attribute name="ref" type="string" use="optional">
<annotation>
<documentation>
Reference to a container from the topology model.
</documentation>
</annotation>
</attribute>
<attribute name="jmx-port" type="int">
<annotation>
<documentation>
JMX port of the current Petals ESB container. A deployment property can be used. Each
container (from topology model) without a default JMX port must have one defined in this model.
</documentation>
</annotation>
</attribute>
<attribute name="jmx-user" type="string">
<annotation>
<documentation>
JMX username of the current Petals ESB container. A deployment property can be used. Each
container (from topology model) without a default JMX username must have one defined in this model.
</documentation>
</annotation>
</attribute>
<attribute name="jmx-password" type="string">
<annotation>
<documentation>
JMX password of the current Petals ESB container. A deployment property can be used. Each
container (from topology model) without a default JMX password must have one defined in this model.
</documentation>
</annotation>
</attribute>
<attribute name="machine-ref" type="string" use="required">
<annotation>
<documentation>
The reference of the machine on which the container is running.
</documentation>
</annotation>
</attribute>
</complexType>

<complexType name="componentInstance">
<attribute name="ref" type="string" use="required" />
<attribute name="ref" type="string" use="required">
<annotation>
<documentation>
Reference to a component from a component repository.
</documentation>
</annotation>
</attribute>
</complexType>

<complexType name="serviceUnitInstance">
<attribute name="ref" type="string" use="required" />
<attribute name="ref" type="string" use="required">
<annotation>
<documentation>
Reference to a service unit from a service unit model.
</documentation>
</annotation>
</attribute>
</complexType>

<complexType name="provisionedMachine">
<complexContent>
<extension base="bm:machine">
<sequence>
<element name="hostname" type="string" />
<element name="hostname" type="string">
<annotation>
<documentation>
Hostname, IP address or deployment property name of the provisioned machine.
</documentation>
</annotation>
</element>
</sequence>
</extension>
</complexContent>
</complexType>

<complexType name="machine" abstract="true">
<sequence />
<attribute name="id" type="string" use="required" />
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
Identifier of the machine. It must be unique in the model.
</documentation>
</annotation>
</attribute>
</complexType>
</schema>
Loading