You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by le...@apache.org on 2013/01/16 19:46:26 UTC
svn commit: r1434103 - in /incubator/streams/trunk: streams-eip-routes/
streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/
streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/
streams-eip-routes/src/main/java/or...
Author: letourneau
Date: Wed Jan 16 18:46:24 2013
New Revision: 1434103
URL: http://svn.apache.org/viewvc?rev=1434103&view=rev
Log:
added activity consumer osgi bundle, dynamic route setup for registering publishers, and publishing url for push consumers routing dynamically
Added:
incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityPublisherProcessor.java
- copied, changed from r1433602, incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityRegistrationProcessor.java
incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/impl/ActivityConsumerRouter.java
incubator/streams/trunk/streams-osgi-components/activity-consumer/
incubator/streams/trunk/streams-osgi-components/activity-consumer/osgi.bnd
incubator/streams/trunk/streams-osgi-components/activity-consumer/pom.xml
- copied, changed from r1433602, incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/pom.xml
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/ActivityConsumer.java
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/ActivityConsumerWarehouse.java
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/impl/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/impl/ActivityConsumerWarehouseImpl.java
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/impl/PushActivityConsumer.java
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/DEPENDENCIES
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/DISCLAIMER
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/LICENSE
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/NOTICE
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/spring/
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/spring/activity-consumer-context.xml
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/spring/activity-consumer-osgi.xml
incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/readme.txt
Removed:
incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/impl/ActivityRouterImpl.java
Modified:
incubator/streams/trunk/streams-eip-routes/pom.xml
incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityRegistrationProcessor.java
incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/ActivityRouter.java
incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/rules/RoutingRule.java
incubator/streams/trunk/streams-eip-routes/src/main/resources/META-INF/spring/camelContext.xml
incubator/streams/trunk/streams-eip-routes/src/main/resources/META-INF/spring/osgi-component-import.xml
incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/pom.xml
incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/src/main/java/org/apache/streams/osgi/components/impl/ActivityPublisherRegistrationImpl.java
incubator/streams/trunk/streams-osgi-components/pom.xml
Modified: incubator/streams/trunk/streams-eip-routes/pom.xml
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-eip-routes/pom.xml?rev=1434103&r1=1434102&r2=1434103&view=diff
==============================================================================
--- incubator/streams/trunk/streams-eip-routes/pom.xml (original)
+++ incubator/streams/trunk/streams-eip-routes/pom.xml Wed Jan 16 18:46:24 2013
@@ -71,7 +71,7 @@
<Bundle-Version>${pom.version}</Bundle-Version>
<Export-Package>${bundle.namespace};version="${pom.version}",org.apache.streams.messaging.routers,org.apache.streams.messaging.rules,org.apache.streams.messaging.processors</Export-Package>
<Private-Package>${bundle.namespace}.messaging.routers.impl.*,${bundle.namespace}.messaging.rules.impl.*</Private-Package>
- <Import-Package>org.apache.camel.*;version="2.8.5",org.springframework.*;version="3.0.6.RELEASE",org.apache.commons.logging,org.apache.streams.*,org.apache.streams.osgi.components,org.apache.streams.messaging.processors</Import-Package>
+ <Import-Package>org.apache.camel.*;version="2.8.5",org.springframework.*;version="3.0.6.RELEASE",org.apache.commons.logging,org.apache.streams.*,org.apache.streams.osgi.components,org.apache.streams.osgi.components.activityconsumer,org.apache.streams.messaging.processors</Import-Package>
<Include-Resource>src/main/resources</Include-Resource>
</instructions>
</configuration>
@@ -95,7 +95,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
- <version>2.0.5</version>
+ <version>3.0.6.RELEASE</version>
</dependency>
<dependency>
@@ -120,6 +120,12 @@
<artifactId>activity-publisher-registration</artifactId>
<version>${pom.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.streams.osgi.components</groupId>
+ <artifactId>activity-consumer</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Copied: incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityPublisherProcessor.java (from r1433602, incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityRegistrationProcessor.java)
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityPublisherProcessor.java?p2=incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityPublisherProcessor.java&p1=incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityRegistrationProcessor.java&r1=1433602&r2=1434103&rev=1434103&view=diff
==============================================================================
--- incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityRegistrationProcessor.java (original)
+++ incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityPublisherProcessor.java Wed Jan 16 18:46:24 2013
@@ -1,18 +1,17 @@
package org.apache.streams.messaging.processors;
+
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-
+import java.net.URI;
+import java.net.URISyntaxException;
-public class ActivityRegistrationProcessor implements Processor{
+public class ActivityPublisherProcessor implements Processor {
public void process(Exchange exchange){
- //add the necessary headers to the message so that the activity registration component
- //can do a lookup to either make a new processor and endpoint, or pass the message to the right one
+ //add the necessary headers to the message so that the router can send to the right activityconsumer
+
String httpMethod = exchange.getIn().getHeader("CamelHttpMethod").toString();
if (!httpMethod.equals("POST")){
@@ -21,20 +20,22 @@ public class ActivityRegistrationProcess
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE,405);
} else {
- //for now...just expect a post with a uri in the body...should have some checking here with http response codes
+ //for now...just expect a post with a uri in the body...should have some checking here with http response codes
+ // authentication, all that good stuff...
String body = exchange.getIn().getBody(String.class);
try{
- URL publisherUrl = new URL(body);
- exchange.getOut().setHeader("activityPublisherUri",body);
- exchange.getOut().setBody(body);
- }catch(MalformedURLException e){
+ URI publisherUrl = new URI(body);
+ exchange.getOut().setHeader("SRC",body);
+ exchange.getOut().setBody("got some message from a registered publisher.");
+ }catch(URISyntaxException e){
exchange.getOut().setFault(true);
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE,400);
- exchange.getOut().setBody("POST should only contain a valid URI that is registering as an Activity Publisher.");
+ exchange.getOut().setBody("POST needs to include the URI that was registered as a publisher.");
}
}
+
}
}
Modified: incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityRegistrationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityRegistrationProcessor.java?rev=1434103&r1=1434102&r2=1434103&view=diff
==============================================================================
--- incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityRegistrationProcessor.java (original)
+++ incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/processors/ActivityRegistrationProcessor.java Wed Jan 16 18:46:24 2013
@@ -4,8 +4,8 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import java.net.MalformedURLException;
-import java.net.URL;
-
+import java.net.URI;
+import java.net.URISyntaxException;
public class ActivityRegistrationProcessor implements Processor{
@@ -22,13 +22,14 @@ public class ActivityRegistrationProcess
} else {
//for now...just expect a post with a uri in the body...should have some checking here with http response codes
+ // authentication, all that good stuff...
String body = exchange.getIn().getBody(String.class);
try{
- URL publisherUrl = new URL(body);
+ URI publisherUrl = new URI(body);
exchange.getOut().setHeader("activityPublisherUri",body);
exchange.getOut().setBody(body);
- }catch(MalformedURLException e){
+ }catch(URISyntaxException e){
exchange.getOut().setFault(true);
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE,400);
exchange.getOut().setBody("POST should only contain a valid URI that is registering as an Activity Publisher.");
@@ -36,5 +37,6 @@ public class ActivityRegistrationProcess
}
+
}
}
Modified: incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/ActivityRouter.java
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/ActivityRouter.java?rev=1434103&r1=1434102&r2=1434103&view=diff
==============================================================================
--- incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/ActivityRouter.java (original)
+++ incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/ActivityRouter.java Wed Jan 16 18:46:24 2013
@@ -9,17 +9,12 @@ import org.apache.camel.Exchange;
import org.apache.camel.Header;
import org.apache.camel.Properties;
import org.apache.streams.messaging.rules.RoutingRule;
+import org.apache.streams.osgi.components.activityconsumer.ActivityConsumer;
public interface ActivityRouter {
- /*
- * Use this method to compute dynamic where we should route next.
- *
- * @param body the message body
- * @return endpoints to go, or <tt>null</tt> to indicate the end
- */
- String slip(String body,@Header(Exchange.SLIP_ENDPOINT) String previous);
- void addRoutingRules(ArrayList<RoutingRule> rules);
+ String slip(Exchange exchange, String body,@Header("SRC") String src);
+ void createNewRouteForConsumer(ActivityConsumer activityConsumer);
}
Added: incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/impl/ActivityConsumerRouter.java
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/impl/ActivityConsumerRouter.java?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/impl/ActivityConsumerRouter.java (added)
+++ incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/routers/impl/ActivityConsumerRouter.java Wed Jan 16 18:46:24 2013
@@ -0,0 +1,95 @@
+package org.apache.streams.messaging.routers.impl;
+
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.streams.messaging.routers.ActivityRouter;
+
+import org.apache.streams.messaging.rules.impl.SimpleRoutingRule;
+import org.apache.camel.DynamicRouter;
+import org.apache.streams.osgi.components.activityconsumer.ActivityConsumerWarehouse;
+import org.apache.streams.osgi.components.activityconsumer.ActivityConsumer;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.camel.Header;
+import org.apache.camel.Exchange;
+import org.apache.camel.CamelContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+
+public class ActivityConsumerRouter extends RouteBuilder implements ActivityRouter {
+ private static final transient Log LOG = LogFactory.getLog(ActivityConsumerRouter.class);
+
+
+ protected CamelContext camelContext;
+
+ private ActivityConsumerWarehouse activityConsumerWarehouse;
+
+ public void setCamelContext(CamelContext camelContext) {
+ this.camelContext = camelContext;
+ }
+
+ public void setActivityConsumerWarehouse(ActivityConsumerWarehouse activityConsumerWarehouse) {
+ this.activityConsumerWarehouse = activityConsumerWarehouse;
+ }
+
+
+ public void createNewRouteForConsumer(ActivityConsumer activityConsumer){
+
+ //todo: understand if direct protocol is what we want...might need to be configurable
+ activityConsumer.setInRoute("direct:" + activityConsumer.getSrc());
+ activityConsumerWarehouse.register(activityConsumer);
+
+ try{
+ //setup a message queue for this consumer.getInRoute()
+ camelContext.addRoutes(new DynamcConsumerRouteBuilder(camelContext, activityConsumer.getInRoute(), activityConsumer));
+
+ LOG.info("all messages sent from " + activityConsumer.getSrc() + " will go to " + activityConsumer.getInRoute());
+ }catch (Exception e){
+ LOG.error("error creating route: " + e);
+ }
+
+ }
+
+ @DynamicRouter
+ public String slip(Exchange exchange, String body, @Header("SRC") String src){
+ //if not sent from a SRC, kill the routing chain
+ if (src==null){
+ return src;
+ }
+
+ //lookup the route to the activityconsumer registered to receive messages from SRC
+ String outRoute = activityConsumerWarehouse.findConsumerBySrc(src).getInRoute();
+ //for now, just one route out...set SRC to null
+ exchange.getOut().setHeader("SRC", null);
+ return outRoute;
+
+ }
+
+ public void configure() throws java.lang.Exception{
+ //nothing...set the context?
+
+ }
+
+ /**
+ * This route builder is a skeleton to add new routes at runtime
+ */
+ private static final class DynamcConsumerRouteBuilder extends RouteBuilder {
+ private final String from;
+ private ActivityConsumer activityConsumer;
+
+ private DynamcConsumerRouteBuilder(CamelContext context, String from, ActivityConsumer activityConsumer) {
+ super(context);
+ this.from = from;
+ this.activityConsumer = activityConsumer;
+ }
+
+ @Override
+ public void configure() throws Exception {
+ from(from).bean(activityConsumer, "receive");
+ }
+ }
+
+}
Modified: incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/rules/RoutingRule.java
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/rules/RoutingRule.java?rev=1434103&r1=1434102&r2=1434103&view=diff
==============================================================================
--- incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/rules/RoutingRule.java (original)
+++ incubator/streams/trunk/streams-eip-routes/src/main/java/org/apache/streams/messaging/rules/RoutingRule.java Wed Jan 16 18:46:24 2013
@@ -5,7 +5,7 @@ public interface RoutingRule {
void setSource(String source);
String getSource();
- void setDestination(String destination);
+
String getDestination();
boolean isMessageRoutable(String body);
}
Modified: incubator/streams/trunk/streams-eip-routes/src/main/resources/META-INF/spring/camelContext.xml
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-eip-routes/src/main/resources/META-INF/spring/camelContext.xml?rev=1434103&r1=1434102&r2=1434103&view=diff
==============================================================================
--- incubator/streams/trunk/streams-eip-routes/src/main/resources/META-INF/spring/camelContext.xml (original)
+++ incubator/streams/trunk/streams-eip-routes/src/main/resources/META-INF/spring/camelContext.xml Wed Jan 16 18:46:24 2013
@@ -13,25 +13,37 @@
- <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <camelContext id="context" xmlns="http://camel.apache.org/schema/spring">
<!--registration route setup -->
<route>
<from uri="jetty:http://localhost:8000/streams/register"/>
- <bean ref="activityPublisherProcessor" />
+ <bean ref="activityRegistrationProcessor" />
<to uri="direct:register"/>
</route>
<route>
<from uri="direct:register"/>
- <bean ref="activityPublisherRegistration" method="register"/>
- <to uri="log:ExampleRouter"/>
+ <bean ref="activityPublisherRegistration" method="register"/>
+ <to uri="direct:add-route"/>
+ </route>
+
+ <route>
+ <from uri="direct:add-route"/>
+ <bean ref="activityRouter" method="createNewRouteForConsumer"/>
+ <to uri="log:ExampleLog"/>
</route>
<!--publishing route setup -->
<route>
<from uri="jetty:http://localhost:8000/streams/publish"/>
+ <bean ref="activityPublisherProcessor"/>
+ <to uri="direct:dynamic-route"/>
+ </route>
+
+ <route>
+ <from uri="direct:dynamic-route"/>
<dynamicRouter>
<method ref="activityRouter" method="slip"/>
</dynamicRouter>
Modified: incubator/streams/trunk/streams-eip-routes/src/main/resources/META-INF/spring/osgi-component-import.xml
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-eip-routes/src/main/resources/META-INF/spring/osgi-component-import.xml?rev=1434103&r1=1434102&r2=1434103&view=diff
==============================================================================
--- incubator/streams/trunk/streams-eip-routes/src/main/resources/META-INF/spring/osgi-component-import.xml (original)
+++ incubator/streams/trunk/streams-eip-routes/src/main/resources/META-INF/spring/osgi-component-import.xml Wed Jan 16 18:46:24 2013
@@ -10,18 +10,19 @@
<osgi:reference id="activityPublisherRegistration" interface="org.apache.streams.osgi.components.ActivityPublisherRegistration" />
- <bean id="activityPublisherProcessor" class="org.apache.streams.messaging.processors.ActivityRegistrationProcessor"/>
+ <osgi:reference id="activityConsumerWarehouse" interface="org.apache.streams.osgi.components.activityconsumer.ActivityConsumerWarehouse" />
- <bean id="activityRouter" class="org.apache.streams.messaging.routers.impl.ActivityRouterImpl">
- <constructor-arg>
- <list>
- <bean class="org.apache.streams.messaging.rules.impl.SimpleRoutingRule">
- <property name="source" value="http://localhost:8000/streams/register"/>
- <property name="destination" value="direct:register"/>
- </bean>
- </list>
- </constructor-arg>
+
+ <bean id="activityRegistrationProcessor" class="org.apache.streams.messaging.processors.ActivityRegistrationProcessor"/>
+ <bean id="activityPublisherProcessor" class="org.apache.streams.messaging.processors.ActivityPublisherProcessor"/>
+
+ <bean id="activityRouter" class="org.apache.streams.messaging.routers.impl.ActivityConsumerRouter">
+ <property name="activityConsumerWarehouse" ref="activityConsumerWarehouse"/>
+ <property name="camelContext" ref="context"/>
</bean>
+
+
+
</beans>
\ No newline at end of file
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/osgi.bnd
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/osgi.bnd?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/osgi.bnd (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/osgi.bnd Wed Jan 16 18:46:24 2013
@@ -0,0 +1,5 @@
+#-----------------------------------------------------------------
+# Use this file to add customized Bnd instructions for the bundle
+#-----------------------------------------------------------------
+
+
Copied: incubator/streams/trunk/streams-osgi-components/activity-consumer/pom.xml (from r1433602, incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/pom.xml)
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/pom.xml?p2=incubator/streams/trunk/streams-osgi-components/activity-consumer/pom.xml&p1=incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/pom.xml&r1=1433602&r2=1434103&rev=1434103&view=diff
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/pom.xml (original)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/pom.xml Wed Jan 16 18:46:24 2013
@@ -4,14 +4,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<properties>
- <bundle.symbolicName>activity-publisher-registration-bundle</bundle.symbolicName>
- <bundle.namespace>org.apache.streams.osgi.components</bundle.namespace>
+ <bundle.symbolicName>activity-consumer-bundle</bundle.symbolicName>
+ <bundle.namespace>org.apache.streams.osgi.components.activityconsumer</bundle.namespace>
<commons.log>1.1</commons.log>
</properties>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.streams.osgi.components</groupId>
- <artifactId>activity-publisher-registration</artifactId>
+ <artifactId>activity-consumer</artifactId>
<version>0.1-SNAPSHOT</version>
<name>${bundle.symbolicName} [${bundle.namespace}]</name>
@@ -37,6 +37,16 @@
</resources>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
<groupId>org.ops4j</groupId>
<artifactId>maven-pax-plugin</artifactId>
<version>1.5</version>
@@ -58,8 +68,9 @@
<instructions>
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
<Bundle-Version>${pom.version}</Bundle-Version>
- <Export-Package>${bundle.namespace};version="${pom.version}"</Export-Package>
+ <Export-Package>${bundle.namespace};version="${pom.version}",org.apache.streams.osgi.components.activityconsumer.impl</Export-Package>
<Private-Package>${bundle.namespace}.impl.*</Private-Package>
+ <Import-Package>org.apache.streams.osgi.components.activityconsumer,org.apache.commons.logging</Import-Package>
<Include-Resource>src/main/resources</Include-Resource>
</instructions>
</configuration>
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/ActivityConsumer.java
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/ActivityConsumer.java?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/ActivityConsumer.java (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/ActivityConsumer.java Wed Jan 16 18:46:24 2013
@@ -0,0 +1,10 @@
+package org.apache.streams.osgi.components.activityconsumer;
+
+
+public interface ActivityConsumer {
+ public void receive(Object activity);
+ public void init();
+ public String getSrc();
+ public void setInRoute(String route);
+ public String getInRoute();
+}
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/ActivityConsumerWarehouse.java
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/ActivityConsumerWarehouse.java?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/ActivityConsumerWarehouse.java (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/ActivityConsumerWarehouse.java Wed Jan 16 18:46:24 2013
@@ -0,0 +1,12 @@
+package org.apache.streams.osgi.components.activityconsumer;
+
+/**
+ * Public API representing an example OSGi service
+ */
+public interface ActivityConsumerWarehouse {
+
+ public void register(ActivityConsumer activityConsumer);
+ public ActivityConsumer findConsumerBySrc(String src);
+
+}
+
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/impl/ActivityConsumerWarehouseImpl.java
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/impl/ActivityConsumerWarehouseImpl.java?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/impl/ActivityConsumerWarehouseImpl.java (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/impl/ActivityConsumerWarehouseImpl.java Wed Jan 16 18:46:24 2013
@@ -0,0 +1,35 @@
+package org.apache.streams.osgi.components.activityconsumer.impl;
+
+import java.util.Date;
+import java.util.HashMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.streams.osgi.components.activityconsumer.ActivityConsumerWarehouse;
+import org.apache.streams.osgi.components.activityconsumer.ActivityConsumer;
+
+public class ActivityConsumerWarehouseImpl implements ActivityConsumerWarehouse {
+ private static final transient Log LOG = LogFactory.getLog(ActivityConsumerWarehouseImpl.class);
+
+ private HashMap<String,ActivityConsumer> consumers;
+
+ public ActivityConsumerWarehouseImpl(){
+ consumers = new HashMap<String, ActivityConsumer>();
+ }
+
+ public void register(ActivityConsumer activityConsumer) {
+
+ //key in warehouse is the activity publisher URI source
+ consumers.put(activityConsumer.getSrc(), activityConsumer);
+ activityConsumer.init();
+
+
+ }
+
+ public ActivityConsumer findConsumerBySrc(String src){
+ return consumers.get(src);
+ }
+
+
+
+}
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/impl/PushActivityConsumer.java
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/impl/PushActivityConsumer.java?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/impl/PushActivityConsumer.java (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/java/org/apache/streams/osgi/components/activityconsumer/impl/PushActivityConsumer.java Wed Jan 16 18:46:24 2013
@@ -0,0 +1,46 @@
+package org.apache.streams.osgi.components.activityconsumer.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.streams.osgi.components.activityconsumer.ActivityConsumer;
+
+public class PushActivityConsumer implements ActivityConsumer {
+
+ private static final transient Log LOG = LogFactory.getLog(PushActivityConsumer.class);
+
+ private String src;
+
+
+ private String inRoute;
+
+ public PushActivityConsumer(String src){
+ this.setSrc(src);
+ }
+
+ public String getSrc() {
+ return src;
+ }
+
+ public void setSrc(String src) {
+ this.src = src;
+ }
+
+ public void receive (Object activity){
+ //receive activity...do anything that is necessary
+ LOG.info("got a message i subscribed to: " + activity);
+ //pass off to activity splitter ?
+ }
+
+ public void init(){
+ //any initialization...
+ }
+
+ public String getInRoute() {
+ return inRoute;
+ }
+
+ public void setInRoute(String inRoute) {
+ this.inRoute = inRoute;
+ }
+
+}
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/DEPENDENCIES
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/DEPENDENCIES?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/DEPENDENCIES (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/DEPENDENCIES Wed Jan 16 18:46:24 2013
@@ -0,0 +1,17 @@
+// ------------------------------------------------------------------
+// Transitive dependencies of this project determined from the
+// maven pom organized by organization.
+// ------------------------------------------------------------------
+
+Activity Publisher Registration
+
+
+From: 'an unknown organization'
+ - OSGi R4 compendium (http://www.osgi.org) org.osgi:osgi_R4_compendium:jar:1.0
+
+ - OSGi R4 core (http://www.osgi.org) org.osgi:osgi_R4_core:jar:1.0
+
+
+
+
+
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/DISCLAIMER?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/DISCLAIMER (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/DISCLAIMER Wed Jan 16 18:46:24 2013
@@ -0,0 +1,10 @@
+Activity Publisher Registration is an effort undergoing incubation at the Apache Software
+Foundation (ASF), sponsored by the Apache Incubator PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness
+or stability of the code, it does indicate that the project has yet to be
+fully endorsed by the ASF.
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/LICENSE?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/LICENSE (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/LICENSE Wed Jan 16 18:46:24 2013
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/NOTICE?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/NOTICE (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/NOTICE Wed Jan 16 18:46:24 2013
@@ -0,0 +1,8 @@
+
+Activity Publisher Registration
+Copyright 2012-2013 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/spring/activity-consumer-context.xml
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/spring/activity-consumer-context.xml?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/spring/activity-consumer-context.xml (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/spring/activity-consumer-context.xml Wed Jan 16 18:46:24 2013
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <!-- regular spring configuration file defining the beans for this
+bundle. The configuration of OSGi definitions is kept in a separate
+configuration file so that this file can easily be used
+for integration testing outside of an OSGi environment -->
+ <bean id="activityConsumerWarehouse" class="org.apache.streams.osgi.components.activityconsumer.impl.ActivityConsumerWarehouseImpl"/>
+</beans>
\ No newline at end of file
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/spring/activity-consumer-osgi.xml
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/spring/activity-consumer-osgi.xml?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/spring/activity-consumer-osgi.xml (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/META-INF/spring/activity-consumer-osgi.xml Wed Jan 16 18:46:24 2013
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+ <osgi:service ref="activityConsumerWarehouse" interface="org.apache.streams.osgi.components.activityconsumer.ActivityConsumerWarehouse"/>
+
+</beans>
\ No newline at end of file
Added: incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/readme.txt
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/readme.txt?rev=1434103&view=auto
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/readme.txt (added)
+++ incubator/streams/trunk/streams-osgi-components/activity-consumer/src/main/resources/readme.txt Wed Jan 16 18:46:24 2013
@@ -0,0 +1 @@
+Bundle resources go here
Modified: incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/pom.xml
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/pom.xml?rev=1434103&r1=1434102&r2=1434103&view=diff
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/pom.xml (original)
+++ incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/pom.xml Wed Jan 16 18:46:24 2013
@@ -60,6 +60,7 @@
<Bundle-Version>${pom.version}</Bundle-Version>
<Export-Package>${bundle.namespace};version="${pom.version}"</Export-Package>
<Private-Package>${bundle.namespace}.impl.*</Private-Package>
+ <Import-Package>org.apache.streams.osgi.components.activityconsumer.impl,org.apache.commons.logging</Import-Package>
<Include-Resource>src/main/resources</Include-Resource>
</instructions>
</configuration>
@@ -88,6 +89,11 @@
<version>${commons.log}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.streams.osgi.components</groupId>
+ <artifactId>activity-consumer</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/src/main/java/org/apache/streams/osgi/components/impl/ActivityPublisherRegistrationImpl.java
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/src/main/java/org/apache/streams/osgi/components/impl/ActivityPublisherRegistrationImpl.java?rev=1434103&r1=1434102&r2=1434103&view=diff
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/src/main/java/org/apache/streams/osgi/components/impl/ActivityPublisherRegistrationImpl.java (original)
+++ incubator/streams/trunk/streams-osgi-components/activity-publisher-registration/src/main/java/org/apache/streams/osgi/components/impl/ActivityPublisherRegistrationImpl.java Wed Jan 16 18:46:24 2013
@@ -5,6 +5,7 @@ import java.util.Date;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.streams.osgi.components.ActivityPublisherRegistration;
+import org.apache.streams.osgi.components.activityconsumer.impl.PushActivityConsumer;
public class ActivityPublisherRegistrationImpl implements ActivityPublisherRegistration {
private static final transient Log LOG = LogFactory.getLog(ActivityPublisherRegistrationImpl.class);
@@ -12,14 +13,19 @@ public class ActivityPublisherRegistrati
private String prefix = "Activity Publisher Registration";
public Object register(Object body) {
+
+ //authorize this producer based on some rule set...
+ //create a new ActivityConsumer...
+ //using the URI supplied to set it up...
+ //return the consumer for addition to the consumer warehouse
+
String answer = prefix + " set body: " + body + " " + new Date();
- if (verbose) {
- System.out.println(">> call >> " + answer);
- }
LOG.info(">> call >>" + answer);
- return answer;
+
+ return new PushActivityConsumer(body.toString());
}
+
public boolean isVerbose() {
return verbose;
}
Modified: incubator/streams/trunk/streams-osgi-components/pom.xml
URL: http://svn.apache.org/viewvc/incubator/streams/trunk/streams-osgi-components/pom.xml?rev=1434103&r1=1434102&r2=1434103&view=diff
==============================================================================
--- incubator/streams/trunk/streams-osgi-components/pom.xml (original)
+++ incubator/streams/trunk/streams-osgi-components/pom.xml Wed Jan 16 18:46:24 2013
@@ -19,6 +19,7 @@
<modules>
<module>activity-publisher-registration</module>
+ <module>activity-consumer</module>
<module>streams-components-all</module>
</modules>