Skip to content
Snippets Groups Projects
Commit c01fbaba authored by Constantin Jucovschi's avatar Constantin Jucovschi
Browse files

before pom editing

parent 45a825b6
No related branches found
No related tags found
No related merge requests found
Showing
with 524 additions and 65 deletions
package info.kwarc.sally4.mathhubworker.routes;
import info.kwarc.sally.comm.CommUtils;
import info.kwarc.sally.comm.planetaryclient.GetSessionIDRequest;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.spi.DataFormat;
public class MathHubRoute extends RouteBuilder {
public MathHubRoute() {
}
@Override
public void configure() throws Exception {
DataFormat planetaryClient = CommUtils.getDataFormat("planetaryclient", getClass().getClassLoader());
from("direct:start")
.multicast().to("direct:requestSessionID");
from("direct:requestSessionID")
.setBody(constant(new GetSessionIDRequest()))
.marshal(planetaryClient)
.inOut("alex:requestSessionID")
.unmarshal(planetaryClient);
}
}
...@@ -54,6 +54,12 @@ ...@@ -54,6 +54,12 @@
<version>2.12.3</version> <version>2.12.3</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<version>2.12.3</version>
</dependency>
<dependency> <dependency>
<groupId>info.kwarc.sally4</groupId> <groupId>info.kwarc.sally4</groupId>
<artifactId>core</artifactId> <artifactId>core</artifactId>
...@@ -65,6 +71,13 @@ ...@@ -65,6 +71,13 @@
<artifactId>slf4j-simple</artifactId> <artifactId>slf4j-simple</artifactId>
<version>1.7.7</version> <version>1.7.7</version>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
...@@ -76,7 +89,7 @@ ...@@ -76,7 +89,7 @@
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<instructions> <instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName> <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Private-Package>info.kwarc.sally4.docmanager.impl</Private-Package> <Private-Package>info.kwarc.sally4.docmanager.impl</Private-Package>
<Import-Package>*;</Import-Package> <Import-Package>*;</Import-Package>
<Export-Package>info.kwarc.sally4.docmanager*</Export-Package> <Export-Package>info.kwarc.sally4.docmanager*</Export-Package>
......
package info.kwarc.sally4.docmanager; package info.kwarc.sally4.docmanager;
public interface AlexRoute { public interface AlexRoute {
public String getAlexStateQueue(); public String getAlexStateQueue();
public String getAlexQueue(); public String getAlexQueue();
public void addOnStopHandler(Runnable r); public void addOnStopHandler(Runnable r);
public void stop();
} }
package info.kwarc.sally4.docmanager;
import org.apache.camel.Exchange;
public interface IDocWorkflow {
String [] getInterfaceRequirements();
String [] getHandlingNamespaces();
boolean handleMessage(String namespace, String type, Exchange exchange);
void onNewDocument(AlexRoute route);
}
package info.kwarc.sally4.docmanager; package info.kwarc.sally4.docmanager;
import info.kwarc.sally.comm.BodyHasType;
import info.kwarc.sally.comm.CommUtils; import info.kwarc.sally.comm.CommUtils;
import info.kwarc.sally.comm.core.Onsallyframe; import info.kwarc.sally.comm.core.Heartbeatrequest;
import info.kwarc.sally.comm.core.Heartbeatresponse;
import info.kwarc.sally.comm.core.Registerdocument; import info.kwarc.sally.comm.core.Registerdocument;
import info.kwarc.sally.comm.core.Registerdocumentresponse; import info.kwarc.sally.comm.core.Registerdocumentresponse;
import info.kwarc.sally4.docmanager.routes.SallyRegisterRoute; import info.kwarc.sally4.docmanager.routes.SallyRegisterRoute;
...@@ -46,34 +48,25 @@ public class TestMain extends RouteBuilder { ...@@ -46,34 +48,25 @@ public class TestMain extends RouteBuilder {
Registerdocument reg = new Registerdocument(); Registerdocument reg = new Registerdocument();
reg.setDocumentqueue("client123"); reg.setDocumentqueue("client123");
reg.setTheoqueue("theo"); reg.setTheoqueue("theo");
reg.getInterfaces().add("test"); reg.getInterfaces().add("planetaryclient");
temp.sendBody("direct:client-register", reg); temp.sendBody("direct:client-register", reg);
} }
@Override @Override
public void configure() throws Exception { public void configure() throws Exception {
DataFormat core = CommUtils.getDataFormat("core"); DataFormat core = CommUtils.getDataFormat("core");
Heartbeatresponse response = new Heartbeatresponse();
from("direct:client-register") from("direct:client-register")
.marshal(core) .marshal(core)
.to("log:too")
.inOut("activemq:queue:"+SallyRegisterRoute.sallyRegisterQueue) .inOut("activemq:queue:"+SallyRegisterRoute.sallyRegisterQueue)
.to("log:msg")
.unmarshal(core) .unmarshal(core)
.process(new Processor() { .process(new Processor() {
public void process(Exchange exchange) throws Exception { public void process(Exchange exchange) throws Exception {
Registerdocumentresponse resp = exchange.getIn().getBody(Registerdocumentresponse.class); Registerdocumentresponse resp = exchange.getIn().getBody(Registerdocumentresponse.class);
sally_queue = resp.getSallyqueue(); sally_queue = resp.getSallyqueue();
} }
})
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
ProducerTemplate temp = exchange.getContext().createProducerTemplate();
Onsallyframe onSallyFrame = new Onsallyframe();
onSallyFrame.setPosx(100);
onSallyFrame.setPosy(100);
temp.sendBody("direct:send_sally_doc", onSallyFrame);
}
}); });
from("direct:send_sally_doc").marshal(core).inOut("activemq:queue:sally_doc_client123").to("log:asd"); from("direct:send_sally_doc").marshal(core).inOut("activemq:queue:sally_doc_client123").to("log:asd");
...@@ -81,12 +74,10 @@ public class TestMain extends RouteBuilder { ...@@ -81,12 +74,10 @@ public class TestMain extends RouteBuilder {
from("activemq:queue:client123") from("activemq:queue:client123")
.to("log:test") .to("log:test")
.unmarshal(core) .unmarshal(core)
.process(new Processor() { .choice()
.when(new BodyHasType(Heartbeatrequest.class))
public void process(Exchange exchange) throws Exception { .setBody(constant(response))
System.out.println(exchange.getIn().getBody()); .endChoice();
}
});
} }
......
package info.kwarc.sally4.docmanager.impl; package info.kwarc.sally4.docmanager.impl;
import info.kwarc.sally4.docmanager.AlexRoute; import info.kwarc.sally4.docmanager.AlexRoute;
import info.kwarc.sally4.docmanager.IDocWorkflow;
import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Queue;
import org.apache.camel.Exchange;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AlexRouteImpl implements AlexRoute { public class AlexRouteImpl implements AlexRoute {
...@@ -15,6 +23,10 @@ public class AlexRouteImpl implements AlexRoute { ...@@ -15,6 +23,10 @@ public class AlexRouteImpl implements AlexRoute {
HashSet<String> interfaces; HashSet<String> interfaces;
List<Runnable> stopHandlers; List<Runnable> stopHandlers;
Queue<IDocWorkflow> workflows;
Logger log;
String alexStateQueue; String alexStateQueue;
String generateUUID(String doc_queue) { String generateUUID(String doc_queue) {
...@@ -22,12 +34,37 @@ public class AlexRouteImpl implements AlexRoute { ...@@ -22,12 +34,37 @@ public class AlexRouteImpl implements AlexRoute {
return "sally_doc_"+doc_queue; return "sally_doc_"+doc_queue;
} }
protected void forwardMessage(String namespace, String msgType, Exchange e) {
Iterator<IDocWorkflow> iter = workflows.iterator();
while (iter.hasNext()) {
IDocWorkflow work = iter.next();
for (String s : work.getHandlingNamespaces()) {
if (s.equals(namespace)) {
if (work.handleMessage(namespace, msgType, e)) {
return;
}
}
}
}
}
public AlexRouteImpl(String alexQueue, String theoQueue, Collection<String> interfaces) { public AlexRouteImpl(String alexQueue, String theoQueue, Collection<String> interfaces) {
log = LoggerFactory.getLogger(getClass());
this.alexQueue = alexQueue; this.alexQueue = alexQueue;
this.theoQueue = theoQueue; this.theoQueue = theoQueue;
this.interfaces = new HashSet<String>(interfaces); this.interfaces = new HashSet<String>(interfaces);
this.alexStateQueue = generateUUID(alexQueue); this.alexStateQueue = generateUUID(alexQueue);
stopHandlers = new ArrayList<Runnable>(); stopHandlers = new ArrayList<Runnable>();
workflows = new ArrayDeque<IDocWorkflow>();
}
public void addDocumentWorkflow(IDocWorkflow workflow) {
workflows.add(workflow);
workflow.onNewDocument(this);
}
public void removeDocumentWorkflow(IDocWorkflow workflow) {
workflows.remove(workflow);
} }
public String getAlexStateQueue() { public String getAlexStateQueue() {
...@@ -42,6 +79,10 @@ public class AlexRouteImpl implements AlexRoute { ...@@ -42,6 +79,10 @@ public class AlexRouteImpl implements AlexRoute {
stopHandlers.add(stopHandler); stopHandlers.add(stopHandler);
} }
public HashSet<String> getInterfaces() {
return interfaces;
}
public void stop() { public void stop() {
for (Runnable r : stopHandlers) { for (Runnable r : stopHandlers) {
try { try {
......
package info.kwarc.sally4.docmanager.impl;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AlexRouteMessageProcessor implements Processor {
AlexRouteImpl route;
Logger log;
Pattern xmlNamespace = Pattern.compile("<(\\w+)\\s+xmlns=\"([\\w/:.]+)\"/>");
public AlexRouteMessageProcessor(AlexRouteImpl route) {
this.route = route;
log = LoggerFactory.getLogger(getClass());
}
public void process(Exchange exchange) throws Exception {
Matcher m = xmlNamespace.matcher(exchange.getIn().getBody(String.class));
if (m.find()) {
String msgType = m.group(1);
String namespace = m.group(2);
route.forwardMessage(namespace, msgType, exchange);
} else {
exchange.setException(new Exception("Could not detect namespace in incoming message"));
}
}
}
...@@ -5,18 +5,23 @@ import info.kwarc.sally4.activemq.ActiveMQService; ...@@ -5,18 +5,23 @@ import info.kwarc.sally4.activemq.ActiveMQService;
import info.kwarc.sally4.core.CamelContextProvider; import info.kwarc.sally4.core.CamelContextProvider;
import info.kwarc.sally4.docmanager.AlexRoute; import info.kwarc.sally4.docmanager.AlexRoute;
import info.kwarc.sally4.docmanager.DocumentManager; import info.kwarc.sally4.docmanager.DocumentManager;
import info.kwarc.sally4.docmanager.IDocWorkflow;
import info.kwarc.sally4.docmanager.routes.SallyRegisterRoute; import info.kwarc.sally4.docmanager.routes.SallyRegisterRoute;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map; import java.util.Map;
import org.apache.camel.CamelContext; import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.impl.DefaultCamelContext;
import org.apache.felix.ipojo.annotations.Bind;
import org.apache.felix.ipojo.annotations.Component; import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Instantiate; import org.apache.felix.ipojo.annotations.Instantiate;
import org.apache.felix.ipojo.annotations.Invalidate; import org.apache.felix.ipojo.annotations.Invalidate;
import org.apache.felix.ipojo.annotations.Provides; import org.apache.felix.ipojo.annotations.Provides;
import org.apache.felix.ipojo.annotations.Requires; import org.apache.felix.ipojo.annotations.Requires;
import org.apache.felix.ipojo.annotations.Unbind;
import org.apache.felix.ipojo.annotations.Validate; import org.apache.felix.ipojo.annotations.Validate;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -26,12 +31,8 @@ import org.slf4j.LoggerFactory; ...@@ -26,12 +31,8 @@ import org.slf4j.LoggerFactory;
@Provides @Provides
public class DocumentManagerImpl implements DocumentManager { public class DocumentManagerImpl implements DocumentManager {
Map<String, AlexRoute> docs; @Requires
SallyRegisterRoute registerRoute; IDocWorkflow[] workflows;
CamelContext camelContext;
Logger log;
@Requires @Requires
ActiveMQService activeMQ; ActiveMQService activeMQ;
...@@ -39,8 +40,16 @@ public class DocumentManagerImpl implements DocumentManager { ...@@ -39,8 +40,16 @@ public class DocumentManagerImpl implements DocumentManager {
@Requires @Requires
CamelContextProvider camelContextProvider; CamelContextProvider camelContextProvider;
Map<String, AlexRouteImpl> docs;
SallyRegisterRoute registerRoute;
CamelContext camelContext;
Logger log;
public DocumentManagerImpl() { public DocumentManagerImpl() {
docs = new HashMap<String, AlexRoute>(); docs = new HashMap<String, AlexRouteImpl>();
registerRoute = new SallyRegisterRoute(this); registerRoute = new SallyRegisterRoute(this);
log = LoggerFactory.getLogger(getClass()); log = LoggerFactory.getLogger(getClass());
} }
...@@ -52,13 +61,41 @@ public class DocumentManagerImpl implements DocumentManager { ...@@ -52,13 +61,41 @@ public class DocumentManagerImpl implements DocumentManager {
AlexRouteImpl route = new AlexRouteImpl(doc.getDocumentqueue(), doc.getTheoqueue(), doc.getInterfaces()); AlexRouteImpl route = new AlexRouteImpl(doc.getDocumentqueue(), doc.getTheoqueue(), doc.getInterfaces());
docs.put(doc.getDocumentqueue(), route); docs.put(doc.getDocumentqueue(), route);
for (IDocWorkflow workflow : workflows) {
HashSet<String> required = new HashSet<String>(Arrays.asList(workflow.getInterfaceRequirements()));
if (route.getInterfaces().containsAll(required)) {
route.addDocumentWorkflow(workflow);
}
}
return route; return route;
} }
@Bind(aggregate=true)
private void bindWorkflow(IDocWorkflow workflow)
{
HashSet<String> required = new HashSet<String>(Arrays.asList(workflow.getInterfaceRequirements()));
for (AlexRouteImpl route : docs.values()) {
if (route.getInterfaces().containsAll(required)) {
route.addDocumentWorkflow(workflow);
}
}
}
@Unbind
private void unbindWorkflow(IDocWorkflow workflow)
{
for (AlexRouteImpl route : docs.values()) {
route.removeDocumentWorkflow(workflow);
}
}
@Validate @Validate
public void start() { public void start() {
try { try {
log.info(camelContextProvider.getName());
camelContext = new DefaultCamelContext(); camelContext = new DefaultCamelContext();
camelContext.addComponent("activemq", camelContextProvider.getComponent("activemq")); camelContext.addComponent("activemq", camelContextProvider.getComponent("activemq"));
camelContext.addRoutes(registerRoute); camelContext.addRoutes(registerRoute);
...@@ -74,7 +111,7 @@ public class DocumentManagerImpl implements DocumentManager { ...@@ -74,7 +111,7 @@ public class DocumentManagerImpl implements DocumentManager {
public void stop() { public void stop() {
try { try {
camelContext.stop(); camelContext.stop();
for (AlexRoute route : docs.values()) { for (AlexRouteImpl route : docs.values()) {
route.stop(); route.stop();
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -2,7 +2,8 @@ package info.kwarc.sally4.docmanager.routes; ...@@ -2,7 +2,8 @@ package info.kwarc.sally4.docmanager.routes;
import info.kwarc.sally.comm.CommUtils; import info.kwarc.sally.comm.CommUtils;
import info.kwarc.sally.comm.core.Heartbeatrequest; import info.kwarc.sally.comm.core.Heartbeatrequest;
import info.kwarc.sally4.docmanager.AlexRoute; import info.kwarc.sally4.docmanager.impl.AlexRouteImpl;
import info.kwarc.sally4.docmanager.impl.AlexRouteMessageProcessor;
import org.apache.camel.ExchangeTimedOutException; import org.apache.camel.ExchangeTimedOutException;
import org.apache.camel.builder.RouteBuilder; import org.apache.camel.builder.RouteBuilder;
...@@ -13,7 +14,7 @@ import org.slf4j.LoggerFactory; ...@@ -13,7 +14,7 @@ import org.slf4j.LoggerFactory;
public class SallyAlexRoute extends RouteBuilder { public class SallyAlexRoute extends RouteBuilder {
Logger log; Logger log;
AlexRoute route; AlexRouteImpl route;
public Heartbeatrequest generateHeartbeat() { public Heartbeatrequest generateHeartbeat() {
return new Heartbeatrequest(); return new Heartbeatrequest();
...@@ -23,7 +24,7 @@ public class SallyAlexRoute extends RouteBuilder { ...@@ -23,7 +24,7 @@ public class SallyAlexRoute extends RouteBuilder {
route.stop(); route.stop();
} }
SallyAlexRoute(AlexRoute route) { SallyAlexRoute(AlexRouteImpl route) {
log = LoggerFactory.getLogger(getClass()); log = LoggerFactory.getLogger(getClass());
this.route = route; this.route = route;
} }
...@@ -32,6 +33,9 @@ public class SallyAlexRoute extends RouteBuilder { ...@@ -32,6 +33,9 @@ public class SallyAlexRoute extends RouteBuilder {
public void configure() throws Exception { public void configure() throws Exception {
DataFormat core = CommUtils.getDataFormat("core"); DataFormat core = CommUtils.getDataFormat("core");
/**
* Sends a Heartbeat message to the Alex. if it does not respond after 20sec, this route will shutdown.
*/
from("timer://foo?fixedRate=true&period=60000") from("timer://foo?fixedRate=true&period=60000")
.bean(method(this, "generateHeartbeat")) .bean(method(this, "generateHeartbeat"))
.marshal(core) .marshal(core)
...@@ -40,9 +44,13 @@ public class SallyAlexRoute extends RouteBuilder { ...@@ -40,9 +44,13 @@ public class SallyAlexRoute extends RouteBuilder {
.doCatch(ExchangeTimedOutException.class) .doCatch(ExchangeTimedOutException.class)
.bean(method(this, "stopSallyRoute")); .bean(method(this, "stopSallyRoute"));
from("alex:default") /**
.to("log:test") *
.to("alex:default"); */
from("alex:defaultin")
.convertBodyTo(String.class)
.process(new AlexRouteMessageProcessor(route))
.to("alex:defaultout");
} }
} }
...@@ -2,8 +2,8 @@ package info.kwarc.sally4.docmanager.routes; ...@@ -2,8 +2,8 @@ package info.kwarc.sally4.docmanager.routes;
import info.kwarc.sally.comm.CommUtils; import info.kwarc.sally.comm.CommUtils;
import info.kwarc.sally.comm.core.Registerdocumentresponse; import info.kwarc.sally.comm.core.Registerdocumentresponse;
import info.kwarc.sally4.docmanager.AlexRoute;
import info.kwarc.sally4.docmanager.component.AlexComponent; import info.kwarc.sally4.docmanager.component.AlexComponent;
import info.kwarc.sally4.docmanager.impl.AlexRouteImpl;
import info.kwarc.sally4.docmanager.impl.DocumentManagerImpl; import info.kwarc.sally4.docmanager.impl.DocumentManagerImpl;
import org.apache.camel.CamelContext; import org.apache.camel.CamelContext;
...@@ -23,12 +23,12 @@ public class SallyRegisterRoute extends RouteBuilder { ...@@ -23,12 +23,12 @@ public class SallyRegisterRoute extends RouteBuilder {
this.docManager = docManager; this.docManager = docManager;
} }
public Registerdocumentresponse createRouteContext(AlexRoute route) throws Exception { public Registerdocumentresponse createRouteContext(AlexRouteImpl route) throws Exception {
final CamelContext alexRouteContext = new DefaultCamelContext(); final CamelContext alexRouteContext = new DefaultCamelContext();
alexRouteContext.addComponent("activemq", getContext().getComponent("activemq")); alexRouteContext.addComponent("activemq", getContext().getComponent("activemq"));
alexRouteContext.addComponent("alex", new AlexComponent(route)); alexRouteContext.addComponent("alex", new AlexComponent(route));
alexRouteContext.addRoutes(new SallyAlexRoute(route)); alexRouteContext.addRoutes(new SallyAlexRoute(route));
alexRouteContext.getShutdownStrategy().setTimeout(1); alexRouteContext.getShutdownStrategy().setTimeout(10);
alexRouteContext.start(); alexRouteContext.start();
route.addOnStopHandler(new Runnable() { route.addOnStopHandler(new Runnable() {
......
package info.kwarc.sally4.docmanager.routes;
import info.kwarc.sally4.docmanager.impl.AlexRouteImpl;
import java.util.Arrays;
import org.apache.camel.EndpointInject;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.direct.DirectComponent;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class SallyAlexRouteTest extends CamelTestSupport {
SallyAlexRoute route;
@EndpointInject(uri="mock:result")
MockEndpoint result;
@Test
public void ValidMessage() throws InterruptedException {
ProducerTemplate temp = context.createProducerTemplate();
temp.sendBody("alex:defaultin", " <GetServices xmlns=\"http://kwarc.info/sally/comm/planetaryclient\"/> ");
result.expectedMessageCount(1);
result.assertIsSatisfied();
}
@Test
public void InvalidMessage() throws InterruptedException {
ProducerTemplate temp = context.createProducerTemplate();
try {
temp.sendBody("alex:defaultin", " <GetServices/> ");
fail();
} catch (Exception e) {
}
result.expectedMessageCount(0);
result.assertIsSatisfied();
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
route = new SallyAlexRoute(new AlexRouteImpl("a", "b", Arrays.asList(new String[]{"asd"})));
route.from("alex:defaultout").to("mock:result");
context.addComponent("alex", new DirectComponent());
return route;
}
}
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<dependency> <dependency>
<groupId>info.kwarc.sally4</groupId> <groupId>info.kwarc.sally4</groupId>
<artifactId>core</artifactId> <artifactId>core</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.2-SNAPSHOT</version>
</dependency> </dependency>
...@@ -78,10 +78,10 @@ ...@@ -78,10 +78,10 @@
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<instructions> <instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName> <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Private-Package>info.kwarc.sally4.planetary.impl</Private-Package> <Private-Package>info.kwarc.sally4.planetary.impl</Private-Package>
<Import-Package>*;com.mysql.jdbc</Import-Package> <Import-Package>*;com.mysql.jdbc</Import-Package>
<Export-Package>info.kwarc.sally4.planetary*</Export-Package> <Export-Package>info.kwarc.sally4.planetary*;info.kwarc.sally.comm*</Export-Package>
</instructions> </instructions>
</configuration> </configuration>
</plugin> </plugin>
......
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.14 at 11:27:21 PM CEST
//
package info.kwarc.sally.comm.planetaryclient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "GetServices")
public class GetServices {
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.14 at 11:27:21 PM CEST
//
package info.kwarc.sally.comm.planetaryclient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "GetSessionIDRequest")
public class GetSessionIDRequest {
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.14 at 11:27:21 PM CEST
//
package info.kwarc.sally.comm.planetaryclient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="sessionid" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"sessionid"
})
@XmlRootElement(name = "GetSessionIDResponse")
public class GetSessionIDResponse {
@XmlElement(required = true)
protected String sessionid;
/**
* Gets the value of the sessionid property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSessionid() {
return sessionid;
}
/**
* Sets the value of the sessionid property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSessionid(String value) {
this.sessionid = value;
}
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.14 at 11:27:21 PM CEST
//
package info.kwarc.sally.comm.planetaryclient;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the info.kwarc.sally.comm.planetaryclient package.
* <p>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: info.kwarc.sally.comm.planetaryclient
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link GetSessionIDResponse }
*
*/
public GetSessionIDResponse createGetSessionIDResponse() {
return new GetSessionIDResponse();
}
/**
* Create an instance of {@link GetSessionIDRequest }
*
*/
public GetSessionIDRequest createGetSessionIDRequest() {
return new GetSessionIDRequest();
}
/**
* Create an instance of {@link GetServices }
*
*/
public GetServices createGetServices() {
return new GetServices();
}
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.14 at 11:27:21 PM CEST
//
@javax.xml.bind.annotation.XmlSchema(namespace = "http://kwarc.info/sally/comm/planetaryclient", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package info.kwarc.sally.comm.planetaryclient;
...@@ -20,12 +20,10 @@ import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; ...@@ -20,12 +20,10 @@ import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
public class PlanetaryConnectionImpl implements PlanetaryConnection { public class PlanetaryConnectionImpl implements PlanetaryConnection {
@Requires @Requires
CamelContextProvider camelContextProvider; CamelContextProvider camelContextProvider;
CamelContext context ;
MysqlDataSource mysqlDataSource; MysqlDataSource mysqlDataSource;
@Validate @Validate
public void start() { public void start() {
context = camelContextProvider.getSallyCamelContext();
SqlComponent sqlComponent = new SqlComponent(); SqlComponent sqlComponent = new SqlComponent();
mysqlDataSource = new MysqlDataSource(); mysqlDataSource = new MysqlDataSource();
mysqlDataSource.setUser("root"); mysqlDataSource.setUser("root");
...@@ -34,13 +32,12 @@ public class PlanetaryConnectionImpl implements PlanetaryConnection { ...@@ -34,13 +32,12 @@ public class PlanetaryConnectionImpl implements PlanetaryConnection {
mysqlDataSource.setDatabaseName("planetmmt1"); mysqlDataSource.setDatabaseName("planetmmt1");
sqlComponent.setDataSource(mysqlDataSource); sqlComponent.setDataSource(mysqlDataSource);
context.addComponent("planetary", sqlComponent); camelContextProvider.registerGlobalComponent("planetary", sqlComponent);
} }
@Invalidate @Invalidate
public void stop() { public void stop() {
context.removeComponent("planetary"); camelContextProvider.unregisterGlobalComponent("planetary");
} }
......
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://kwarc.info/sally/comm/planetaryclient" elementFormDefault="qualified">
<xs:element name="GetSessionIDRequest">
<xs:complexType>
<xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetSessionIDResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="sessionid" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetServices">
<xs:complexType>
</xs:complexType>
</xs:element>
</xs:schema>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment