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

test

parent fcb8fb05
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
......
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.7
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<parent> <parent>
<groupId>info.kwarc.sally4</groupId> <groupId>info.kwarc.sally4</groupId>
<artifactId>sally4</artifactId> <artifactId>sally4</artifactId>
<version>0.0.4</version> <version>0.0.5</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>
......
...@@ -3,7 +3,7 @@ package info.kwarc.sally4.client.impl; ...@@ -3,7 +3,7 @@ package info.kwarc.sally4.client.impl;
import info.kwarc.sally.comm.core.RegisterClientRequest; import info.kwarc.sally.comm.core.RegisterClientRequest;
import info.kwarc.sally.comm.core.RegisterClientResponse; import info.kwarc.sally.comm.core.RegisterClientResponse;
import info.kwarc.sally4.client.SallyClient; import info.kwarc.sally4.client.SallyClient;
import info.kwarc.sally4.components.ProducerConsumerSplitterComponent; import info.kwarc.sally4.client.utils.ProducerConsumerSplitterComponent;
import java.util.Arrays; import java.util.Arrays;
import java.util.UUID; import java.util.UUID;
...@@ -100,7 +100,7 @@ public class SallyClientImpl extends RouteBuilder implements SallyClient { ...@@ -100,7 +100,7 @@ public class SallyClientImpl extends RouteBuilder implements SallyClient {
@Override @Override
public void configure() throws Exception { public void configure() throws Exception {
JAXBContext context = JAXBContext.newInstance("info.kwarc.sally.comm.core"); JAXBContext context = JAXBContext.newInstance("info.kwarc.sally.comm.core", getClass().getClassLoader());
DataFormat core = new JaxbDataFormat(context); DataFormat core = new JaxbDataFormat(context);
......
package info.kwarc.sally4.client.utils;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import org.apache.camel.converter.jaxb.JaxbDataFormat;
import org.apache.camel.spi.DataFormat;
public class CommUtils {
public final static String iFacePrefix = "info.kwarc.sally.comm.";
public final static String xmlFacePrefix = "http://kwarc.info/sally/comm/";
public static DataFormat getDataFormat(String iFace) {
try {
JAXBContext context = JAXBContext.newInstance(iFacePrefix+iFace, CommUtils.class.getClassLoader());
return new JaxbDataFormat(context);
} catch (JAXBException e) {
return null;
}
}
public static DataFormat getDataFormat(String iFace, ClassLoader loader) {
try {
JAXBContext context = JAXBContext.newInstance(iFacePrefix+iFace, loader);
return new JaxbDataFormat(context);
} catch (JAXBException e) {
return null;
}
}
public static String SerializeToQuery(Map<String, String> props) {
StringBuilder builder = new StringBuilder();
boolean first = true;
for (String key : props.keySet()) {
if (first) {
first = false;
} else {
builder.append("&");
}
builder.append(key);
builder.append("=");
try {
builder.append(URLEncoder.encode(props.get(key), "UTF-8"));
} catch (UnsupportedEncodingException e) {
}
}
return builder.toString();
}
}
package info.kwarc.sally4.components; package info.kwarc.sally4.client.utils;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
......
package info.kwarc.sally4.components; package info.kwarc.sally4.client.utils;
public class ProducerConsumerSplitterComponentConfiguration { public class ProducerConsumerSplitterComponentConfiguration {
......
package info.kwarc.sally4.components; package info.kwarc.sally4.client.utils;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
......
package info.kwarc.sally4.client.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.camel.Exchange;
import org.apache.camel.Predicate;
public class XMLMessageType implements Predicate {
String msgName;
public final static Pattern xmlNamespace = Pattern.compile("<((\\w+):)?(\\w+)\\s+xmlns(:(\\w+))?=\"([\\w/:.]+)\"/?>");
public XMLMessageType(String msgName) {
this.msgName = msgName;
}
public boolean matches(String body) {
Matcher m = xmlNamespace.matcher(body);
if (m.find()) {
String msgType = m.group(3);
return msgName.equals(msgType);
}
return false;
}
public boolean matches(Exchange exchange) {
String msg = exchange.getIn().getBody(String.class);
return matches(msg);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment