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

adding activemq

parent 77291ecc
No related branches found
No related tags found
No related merge requests found
Showing
with 307 additions and 5 deletions
package info.kwarc.sally4.servlet;
public interface ServletEndpointProvider {
String getServletEndpoint(String localPath);
}
File moved
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>activemq</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with this
work for additional information regarding copyright ownership. The ASF licenses
this file to You under the Apache License, Version 2.0 (the "License"); you
may not use this file except in compliance with the License. You may obtain
a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the License. -->
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<groupId>info.kwarc.sally4</groupId>
<artifactId>activemq</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<maven-bundle-plugin.version>2.4.0</maven-bundle-plugin.version>
<osgi.version>5.0.0</osgi.version>
<camel.version>2.12.3</camel.version>
</properties>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>${osgi.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>${osgi.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-servlet</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
<version>5.9.1</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.annotations</artifactId>
<version>1.11.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>info.kwarc.sally4</groupId>
<artifactId>core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- BND Maven Plugin Configuration -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Private-Package>info.kwarc.sally4.activemq.impl</Private-Package>
<Import-Package>*;</Import-Package>
<Export-Package>info.kwarc.sally4.activemq*</Export-Package>
</instructions>
</configuration>
</plugin>
<!-- iPOJO Maven Plugin Configuration : nothing to do -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>ipojo-bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package info.kwarc.sally4.activemq;
public interface ActiveMQService {
}
package info.kwarc.sally4.activemq.impl;
import info.kwarc.sally4.activemq.ActiveMQService;
import info.kwarc.sally4.core.CamelContextProvider;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.camel.component.ActiveMQComponent;
import org.apache.activemq.camel.component.ActiveMQConfiguration;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Instantiate;
import org.apache.felix.ipojo.annotations.Invalidate;
import org.apache.felix.ipojo.annotations.Provides;
import org.apache.felix.ipojo.annotations.Requires;
import org.apache.felix.ipojo.annotations.Validate;
import org.osgi.framework.BundleContext;
@Component
@Provides
@Instantiate
public class ActiveMQServiceImpl implements ActiveMQService {
@Requires
CamelContextProvider camelContextProvider;
@Requires
BundleContext bundleContext;
boolean ownConnection = false;
@Validate
public void start() {
if (camelContextProvider.getComponent("activemq") == null)
return;
ownConnection = true;
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
connectionFactory.setUserName("webclient");
connectionFactory.setPassword("webclient");
ActiveMQConfiguration config = new ActiveMQConfiguration();
config.setConnectionFactory(connectionFactory);
ActiveMQComponent comp = new ActiveMQComponent(config);
camelContextProvider.registerGlobalComponent("activemq", comp);
}
@Invalidate
public void stop() {
if (ownConnection) {
camelContextProvider.unregisterGlobalComponent("activemq");
ownConnection = false;
}
}
}
mvn clean package install -DskipTests
\ No newline at end of file
package info.kwarc.sally4.docmanager;
public interface AlexRoute {
}
package info.kwarc.sally4.docmanager.impl;
import info.kwarc.sally4.docmanager.AlexRoute;
import java.util.Collection;
import java.util.HashSet;
public class AlexRouteImpl implements AlexRoute {
String alexQueue;
String theoQueue;
HashSet<String> interfaces;
String alexStateRoute;
String generateUUID(String doc_queue) {
//"/queue/sally_doc_"+UUID.randomUUID().toString()
return "sally_doc_"+doc_queue;
}
public AlexRouteImpl(String alexQueue, String theoQueue, Collection<String> interfaces) {
this.alexQueue = alexQueue;
this.theoQueue = theoQueue;
this.interfaces = new HashSet<String>(this.interfaces);
this.alexStateRoute = generateUUID(alexQueue);
}
public String getAlexStateRoute() {
return alexStateRoute;
}
}
pom.xml 0 → 100644
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>info.kwarc.sally</groupId>
<artifactId>sally</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>Sally Project</name>
<modules>
<module>core</module>
<module>docmanager</module>
<module>planetary</module>
<module>servlet</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
File moved
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment