Seam SVN: r12766 - in modules/jms/trunk: api/src/main/java/org/jboss/seam/jms/bridge and 5 other directories.
by seam-commits@lists.jboss.org
Author: jganoff
Date: 2010-05-20 19:58:16 -0400 (Thu, 20 May 2010)
New Revision: 12766
Added:
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java
Removed:
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/
Modified:
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java
Log:
EventBridge api and egress routing implementation
Copied: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge (from rev 12765, modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge)
Deleted: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import java.lang.reflect.Type;
-
-/**
- * Facilitates bridging of events between CDI and a messaging system.
- *
- * @author Jordan Ganoff
- *
- */
-public interface EventBridge
-{
- /**
- * Creates a routing for the provided payload (event) type.
- *
- * @param type Type or direction of routing.
- * @param payloadType Payload type to route. This is the event type we wish
- * to observe events for.
- * @return
- */
- public Route createRoute(RouteType type, Type payloadType);
-}
Copied: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java (from rev 12765, modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java)
===================================================================
--- modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java (rev 0)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.reflect.Type;
+
+/**
+ * Facilitates bridging of events between CDI and a messaging system.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public interface EventBridge
+{
+ /**
+ * Creates a routing for the provided payload (event) type.
+ *
+ * @param type Type or direction of routing.
+ * @param payloadType Payload type to route. This is the event type we wish
+ * to observe events for.
+ * @return
+ */
+ public Route createRoute(RouteType type, Type payloadType);
+}
Deleted: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * <p>
- * Identifies an Event Routing configuration method. May be applied to a method
- * of a bean class.
- * </p>
- *
- * <p>
- * The method may return {@link EventBridge} or {@code List<}{@link EventBridge}{@code>}.
- * </p>
- *
- * <pre>
- * @Inject
- * EventBridge bridge;
- *
- * @EventRouting
- * public static Route eventRoutingConfig()
- * {
- * return bridge.createRoute(EGRESS, Object.class).addQualifier(SPECIAL).connectTo(Topic.class, myTopic);
- * }
- * </pre>
- *
- * @author Jordan Ganoff
- */
-@Target( { METHOD })
-@Retention(RUNTIME)
-@Documented
-public @interface EventRouting
-{
-}
Copied: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java (from rev 12765, modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java)
===================================================================
--- modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java (rev 0)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * <p>
+ * Identifies an Event Routing configuration method. May be applied to a method
+ * of a bean class.
+ * </p>
+ *
+ * <p>
+ * The method may return {@link EventBridge} or {@code List<}{@link EventBridge}{@code>}.
+ * </p>
+ *
+ * <pre>
+ * @Inject
+ * EventBridge bridge;
+ *
+ * @EventRouting
+ * public static Route eventRoutingConfig()
+ * {
+ * return bridge.createRoute(EGRESS, Object.class).addQualifier(SPECIAL).connectTo(Topic.class, myTopic);
+ * }
+ * </pre>
+ *
+ * @author Jordan Ganoff
+ */
+@Target( { METHOD })
+@Retention(RUNTIME)
+@Documented
+public @interface EventRouting
+{
+}
Deleted: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/Route.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import javax.jms.Destination;
-
-/**
- * Routing configuration between CDI and JMS.
- *
- * @author Jordan Ganoff
- *
- */
-public interface Route
-{
-
- /**
- * Connect this route to a destination. Multiple destinations may be defined.
- *
- * @param <D> Destination type
- * @param d Destination type (e.g. javax.jms.Topic)
- * @param destination Destination to connect this route to
- * @return this
- */
- public <D extends Destination> Route connectTo(Class<D> d, D destination);
-
- /**
- * Apply the qualifiers listed to this route.
- *
- * @param qualifiers Qualifiers for the payload type
- * @return this
- */
- public Route addQualifiers(Annotation... qualifiers);
-
- /**
- * @return the routing type
- */
- public RouteType getType();
-
- /**
- * @return the type this route routes
- */
- public Type getPayloadType();
-
- /**
- * @return the qualifiers
- */
- public Set<Annotation> getQualifiers();
-
- /**
- * @return The destinations involved in this routing
- */
- public Set<? extends Destination> getDestinations();
-}
Copied: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java (from rev 12765, modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/Route.java)
===================================================================
--- modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java (rev 0)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.jms.Destination;
+
+/**
+ * Routing configuration between CDI and JMS.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public interface Route
+{
+
+ /**
+ * Connect this route to a destination. Multiple destinations may be defined.
+ *
+ * @param <D> Destination type
+ * @param d Destination type (e.g. javax.jms.Topic)
+ * @param destination Destination to connect this route to
+ * @return this
+ */
+ public <D extends Destination> Route connectTo(Class<D> d, D destination);
+
+ /**
+ * Apply the qualifiers listed to this route.
+ *
+ * @param qualifiers Qualifiers for the payload type
+ * @return this
+ */
+ public Route addQualifiers(Annotation... qualifiers);
+
+ /**
+ * @return the routing type
+ */
+ public RouteType getType();
+
+ /**
+ * @return the type this route routes
+ */
+ public Type getPayloadType();
+
+ /**
+ * @return the qualifiers
+ */
+ public Set<Annotation> getQualifiers();
+
+ /**
+ * @return The destinations involved in this routing
+ */
+ public Set<? extends Destination> getDestinations();
+}
Deleted: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-/**
- * All valid {@link Route} types.
- *
- * @author Jordan Ganoff
- *
- */
-public enum RouteType
-{
- /**
- * Inbound route. Any route defined as INGRESS will listen for objects
- * delivered to the registered destinations and fire events for all that
- * match the configuration as defined by the route.
- */
- INGRESS,
-
- /**
- * Outbound route. Any route defined as EGRESS will forward CDI events that
- * match the configuration as defined by the route to the registered
- * destinations.
- */
- EGRESS;
-}
Copied: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java (from rev 12765, modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java)
===================================================================
--- modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java (rev 0)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+/**
+ * All valid {@link Route} types.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public enum RouteType
+{
+ /**
+ * Inbound route. Any route defined as INGRESS will listen for objects
+ * delivered to the registered destinations and fire events for all that
+ * match the configuration as defined by the route.
+ */
+ INGRESS,
+
+ /**
+ * Outbound route. Any route defined as EGRESS will forward CDI events that
+ * match the configuration as defined by the route to the registered
+ * destinations.
+ */
+ EGRESS;
+}
Deleted: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Reception;
-import javax.enterprise.event.TransactionPhase;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.ObserverMethod;
-import javax.inject.Named;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Observer Method to observe events and forward (bridge) them over JMS.
- *
- * @author Jordan Ganoff
- */
-@Named
-@ApplicationScoped
-public class BridgedObserver implements ObserverMethod<Object>
-{
- private Logger log = LoggerFactory.getLogger(getClass());
-
- private BeanManager bm;
- private JmsForwarding config;
-
- public BridgedObserver(BeanManager bm, JmsForwarding config)
- {
- this.bm = bm;
- this.config = config;
- }
-
- public Class<?> getBeanClass()
- {
- return null;
- }
-
- public Set<Annotation> getObservedQualifiers()
- {
- return config.getQualifiers();
- }
-
- public Type getObservedType()
- {
- return config.getEventType();
- }
-
- public Reception getReception()
- {
- return Reception.ALWAYS;
- }
-
- public TransactionPhase getTransactionPhase()
- {
- return TransactionPhase.AFTER_SUCCESS;
- }
-
- public void notify(Object evt)
- {
- // FIXME Include qualifiers once CDI 1.0 MR is complete and
- // notify(Event, Set<Annotation>) is added
- forwardEvent(evt, null);
- }
-
- private void forwardEvent(Object event, Set<Annotation> qualifiers)
- {
- Set<Bean<?>> beans = bm.getBeans(Session.class);
- Bean<?> bean = bm.resolve(beans);
- Session s = (Session) bm.getReference(bean, Session.class, bm.createCreationalContext(bean));
- try
- {
- for (Destination d : config.getDestinations())
- {
- try
- {
- Message m = s.createObjectMessage((Serializable) event);
- // Safe to create producers here always? In an app server these
- // should be cached via JCA managed connection factory but what
- // about other environments?
- s.createProducer(d).send(m);
- }
- catch (JMSException ex)
- {
- log.error("Unable to forward event", ex);
- }
- }
- }
- finally
- {
- try
- {
- s.close();
- }
- catch (JMSException ex)
- {
- log.error("Unable to close session", ex);
- }
- }
- }
-}
Modified: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -21,16 +21,23 @@
*/
package org.jboss.seam.jms;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.Set;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.Extension;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import org.jboss.seam.jms.bridge.EgressRoutingObserver;
+import org.jboss.seam.jms.bridge.EventRouting;
+import org.jboss.seam.jms.bridge.Route;
import org.jboss.seam.jms.impl.wrapper.JmsAnnotatedTypeWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,27 +51,65 @@
{
private static final Logger log = LoggerFactory.getLogger(Seam3JmsExtension.class);
- public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm)
+ private Set<AnnotatedMethod<?>> eventRoutingRegistry = new HashSet<AnnotatedMethod<?>>();
+
+ public void buildRoutes(@Observes final AfterBeanDiscovery abd, final BeanManager bm)
{
- Set<Bean<?>> configuration = bm.getBeans(JmsForwarding.class);
-
- if(configuration == null || configuration.isEmpty())
+ for (AnnotatedMethod<?> m : eventRoutingRegistry)
{
- log.info("No {} registered. Event forwarding disabled.", JmsForwarding.class.getSimpleName());
- } else
- {
- for(Bean<?> c : configuration)
+ Type beanType = m.getDeclaringType().getBaseType();
+ Set<Bean<?>> configBeans = bm.getBeans(beanType);
+ for (Bean<?> configBean : configBeans)
{
- log.info("Creating {} for configuration {}", BridgedObserver.class.getSimpleName(), c);
- CreationalContext<?> context = bm.createCreationalContext(c);
- // TODO Verify configuration for correctness (e.g. getQualifiers() must contain only @Qualifier annotations)
- JmsForwarding config = JmsForwarding.class.cast(bm.getReference(c, JmsForwarding.class, context));
- BridgedObserver b = new BridgedObserver(bm, config);
- abd.addObserverMethod(b);
+ CreationalContext<?> context = bm.createCreationalContext(configBean);
+ Object config = null;
+ try
+ {
+ Object bean = bm.getReference(configBean, beanType, context);
+ config = m.getJavaMember().invoke(bean);
+ } catch (Exception ex)
+ {
+ abd.addDefinitionError(new IllegalArgumentException(EventRouting.class.getSimpleName() + " could not be loaded from bean " + beanType + ": " + ex.getMessage(), ex));
+ }
+ log.debug("Building " + Route.class.getSimpleName() + "s from " + beanType);
+ if (config != null)
+ {
+ if (Collection.class.isAssignableFrom(config.getClass()))
+ {
+ Collection<?> routes = Collection.class.cast(config);
+ for (Object route : routes)
+ {
+ if(route == null || !Route.class.isAssignableFrom(route.getClass()))
+ {
+ abd.addDefinitionError(new IllegalArgumentException("Non-" + Route.class.getSimpleName() + " found when loading " + EventRouting.class.getSimpleName() + " from " + beanType + ": " + route));
+ }
+ createRoute(abd, bm, (Route) route);
+ }
+ } else if(Route.class.isAssignableFrom(config.getClass()))
+ {
+ createRoute(abd, bm, Route.class.cast(config));
+ } else
+ {
+ abd.addDefinitionError(new IllegalArgumentException(EventRouting.class + " methods must return a " + Collection.class + "<? extends " + Route.class + "> or " + Route.class + " directly."));
+ }
+ }
}
}
}
+ private void createRoute(final AfterBeanDiscovery abd, final BeanManager bm, final Route route)
+ {
+ switch(route.getType())
+ {
+ case EGRESS:
+ abd.addObserverMethod(new EgressRoutingObserver(bm, route));
+ log.debug("Built " + route);
+ break;
+ default:
+ abd.addDefinitionError(new IllegalArgumentException("Unsupported routing type: " + route.getType()));
+ }
+ }
+
public <X> void decorateAnnotatedType(@Observes ProcessAnnotatedType<X> pat)
{
/**
@@ -72,4 +117,15 @@
*/
pat.setAnnotatedType(JmsAnnotatedTypeWrapper.decorate(pat.getAnnotatedType()));
}
+
+ public void registerEventRouting(@Observes ProcessAnnotatedType<?> pat)
+ {
+ for(AnnotatedMethod<?> m : pat.getAnnotatedType().getMethods())
+ {
+ if(m.isAnnotationPresent(EventRouting.class))
+ {
+ eventRoutingRegistry.add(m);
+ }
+ }
+ }
}
Copied: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge (from rev 12765, modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge)
Deleted: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,135 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Reception;
-import javax.enterprise.event.TransactionPhase;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.ObserverMethod;
-import javax.inject.Named;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Forwards CDI events that match the provided {@link Route} configuration to
- * the configured destinations.
- *
- * @author Jordan Ganoff
- *
- */
-@Named
-@ApplicationScoped
-public class EgressRoutingObserver implements ObserverMethod<Object>
-{
- private Logger log;
- private BeanManager bm;
- private Route routing;
-
- public EgressRoutingObserver(BeanManager bm, Route routing)
- {
- this.bm = bm;
- this.routing = routing;
- log = LoggerFactory.getLogger(routing.getClass());
- }
-
- public Class<?> getBeanClass()
- {
- return null;
- }
-
- public Set<Annotation> getObservedQualifiers()
- {
- return routing.getQualifiers();
- }
-
- public Type getObservedType()
- {
- return routing.getPayloadType();
- }
-
- public Reception getReception()
- {
- return Reception.ALWAYS;
- }
-
- public TransactionPhase getTransactionPhase()
- {
- return TransactionPhase.AFTER_SUCCESS;
- }
-
- public void notify(Object evt)
- {
- // FIXME Include qualifiers once CDI 1.0 MR is complete and
- // notify(Event, Set<Annotation>) is added
- forwardEvent(evt, null);
- }
-
- private void forwardEvent(Object event, Set<Annotation> qualifiers)
- {
- // TODO Allow session to be configured
- Set<Bean<?>> beans = bm.getBeans(Session.class);
- Bean<?> bean = bm.resolve(beans);
- Session s = (Session) bm.getReference(bean, Session.class, bm.createCreationalContext(bean));
- try
- {
- for (Destination d : routing.getDestinations())
- {
- log.info("Routing event {} over destination {}", event, d);
- try
- {
- Message m = s.createObjectMessage((Serializable) event);
- // Safe to create producers here always? In an app server these
- // should be cached via JCA managed connection factory but what
- // about other environments?
- s.createProducer(d).send(m);
- }
- catch (JMSException ex)
- {
- log.error("Unable to forward event", ex);
- }
- }
- }
- finally
- {
- try
- {
- s.close();
- }
- catch (JMSException ex)
- {
- log.error("Unable to close session", ex);
- }
- }
- }
-}
Copied: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java)
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java (rev 0)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.inject.Named;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Forwards CDI events that match the provided {@link Route} configuration to
+ * the configured destinations.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+@Named
+@ApplicationScoped
+public class EgressRoutingObserver implements ObserverMethod<Object>
+{
+ private Logger log;
+ private BeanManager bm;
+ private Route routing;
+
+ public EgressRoutingObserver(BeanManager bm, Route routing)
+ {
+ this.bm = bm;
+ this.routing = routing;
+ log = LoggerFactory.getLogger(routing.getClass());
+ }
+
+ public Class<?> getBeanClass()
+ {
+ return null;
+ }
+
+ public Set<Annotation> getObservedQualifiers()
+ {
+ return routing.getQualifiers();
+ }
+
+ public Type getObservedType()
+ {
+ return routing.getPayloadType();
+ }
+
+ public Reception getReception()
+ {
+ return Reception.ALWAYS;
+ }
+
+ public TransactionPhase getTransactionPhase()
+ {
+ return TransactionPhase.AFTER_SUCCESS;
+ }
+
+ public void notify(Object evt)
+ {
+ // FIXME Include qualifiers once CDI 1.0 MR is complete and
+ // notify(Event, Set<Annotation>) is added
+ forwardEvent(evt, null);
+ }
+
+ private void forwardEvent(Object event, Set<Annotation> qualifiers)
+ {
+ // TODO Allow session to be configured
+ Set<Bean<?>> beans = bm.getBeans(Session.class);
+ Bean<?> bean = bm.resolve(beans);
+ Session s = (Session) bm.getReference(bean, Session.class, bm.createCreationalContext(bean));
+ try
+ {
+ for (Destination d : routing.getDestinations())
+ {
+ log.info("Routing event {} over destination {}", event, d);
+ try
+ {
+ Message m = s.createObjectMessage((Serializable) event);
+ // Safe to create producers here always? In an app server these
+ // should be cached via JCA managed connection factory but what
+ // about other environments?
+ s.createProducer(d).send(m);
+ }
+ catch (JMSException ex)
+ {
+ log.error("Unable to forward event", ex);
+ }
+ }
+ }
+ finally
+ {
+ try
+ {
+ s.close();
+ }
+ catch (JMSException ex)
+ {
+ log.error("Unable to close session", ex);
+ }
+ }
+ }
+}
Deleted: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import java.lang.reflect.Type;
-
-/**
- * Default JMS Event Bridge
- *
- * @author Jordan Ganoff
- *
- */
-public class JmsEventBridge implements EventBridge
-{
- public Route createRoute(RouteType type, Type payloadType)
- {
- return new RouteImpl(type, payloadType);
- }
-}
Copied: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java)
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java (rev 0)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.reflect.Type;
+
+/**
+ * Default JMS Event Bridge
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public class JmsEventBridge implements EventBridge
+{
+ public Route createRoute(RouteType type, Type payloadType)
+ {
+ return new RouteImpl(type, payloadType);
+ }
+}
Deleted: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.inject.Qualifier;
-import javax.jms.Destination;
-
-/**
- * JMS Event Bridge Routing
- *
- * @author Jordan Ganoff
- *
- */
-public class RouteImpl implements Route
-{
- private RouteType type;
- private Type payloadType;
- private Set<Annotation> qualifiers;
- private Set<Destination> destinations;
-
- public RouteImpl(RouteType type, Type payloadType)
- {
- this.type = type;
- this.payloadType = payloadType;
- qualifiers = new HashSet<Annotation>();
- destinations = new HashSet<Destination>();
- }
-
- public Route addQualifiers(Annotation... q)
- {
- if (q != null)
- {
- for (int i = 0; i < q.length; i++)
- {
- Annotation qualifier = q[i];
- if (!qualifier.annotationType().isAnnotationPresent(Qualifier.class))
- {
- throw new IllegalArgumentException("not a qualifier: " + qualifier);
- }
- qualifiers.add(q[i]);
- }
- }
- return this;
- }
-
- public <D extends Destination> Route connectTo(java.lang.Class<D> d, D destination)
- {
- destinations.add(Destination.class.cast(destination));
- return this;
- };
-
- public RouteType getType()
- {
- return type;
- }
-
- public Type getPayloadType()
- {
- return payloadType;
- }
-
- public Set<Annotation> getQualifiers()
- {
- return qualifiers;
- }
-
- public Set<? extends Destination> getDestinations()
- {
- return destinations;
- }
-}
Copied: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java)
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java (rev 0)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.inject.Qualifier;
+import javax.jms.Destination;
+
+/**
+ * JMS Event Bridge Routing
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public class RouteImpl implements Route
+{
+ private RouteType type;
+ private Type payloadType;
+ private Set<Annotation> qualifiers;
+ private Set<Destination> destinations;
+
+ public RouteImpl(RouteType type, Type payloadType)
+ {
+ this.type = type;
+ this.payloadType = payloadType;
+ qualifiers = new HashSet<Annotation>();
+ destinations = new HashSet<Destination>();
+ }
+
+ public Route addQualifiers(Annotation... q)
+ {
+ if (q != null)
+ {
+ for (int i = 0; i < q.length; i++)
+ {
+ Annotation qualifier = q[i];
+ if (!qualifier.annotationType().isAnnotationPresent(Qualifier.class))
+ {
+ throw new IllegalArgumentException("not a qualifier: " + qualifier);
+ }
+ qualifiers.add(q[i]);
+ }
+ }
+ return this;
+ }
+
+ public <D extends Destination> Route connectTo(java.lang.Class<D> d, D destination)
+ {
+ destinations.add(Destination.class.cast(destination));
+ return this;
+ };
+
+ public RouteType getType()
+ {
+ return type;
+ }
+
+ public Type getPayloadType()
+ {
+ return payloadType;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+
+ public Set<? extends Destination> getDestinations()
+ {
+ return destinations;
+ }
+}
Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -21,14 +21,9 @@
*/
package org.jboss.seam.jms.test;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
import javax.inject.Qualifier;
Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -21,14 +21,9 @@
*/
package org.jboss.seam.jms.test;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
import javax.inject.Qualifier;
Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -25,6 +25,7 @@
import org.jboss.seam.jms.Seam3JmsExtension;
import org.jboss.seam.jms.annotations.JmsSession;
+import org.jboss.seam.jms.bridge.Route;
import org.jboss.seam.jms.impl.inject.ConnectionProducer;
import org.jboss.seam.jms.impl.wrapper.JmsAnnotatedTypeWrapper;
import org.jboss.shrinkwrap.api.ArchivePaths;
@@ -43,6 +44,7 @@
archive.addPackage(JmsSession.class.getPackage());
archive.addPackage(ConnectionProducer.class.getPackage());
archive.addPackage(JmsAnnotatedTypeWrapper.class.getPackage());
+ archive.addPackage(Route.class.getPackage());
archive.addManifestResource(new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml"));
archive.addServiceProvider(Extension.class, Seam3JmsExtension.class);
archive.addManifestResource("topic_T-service.xml");
Added: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.jms.bridge.EventBridge;
+import org.jboss.seam.jms.bridge.Route;
+import org.jboss.seam.jms.bridge.RouteType;
+import org.jboss.seam.jms.test.Util;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class JmsEventBridgeTest
+{
+
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return Util.createDeployment(JmsEventBridgeTest.class);
+ }
+
+ @Inject Instance<EventBridge> bridge;
+
+ @Test
+ public void injectBridge()
+ {
+ Assert.assertNotNull(bridge.get());
+ }
+
+ @Test
+ public void createRoute()
+ {
+ EventBridge b = bridge.get();
+ Route r = b.createRoute(RouteType.EGRESS, Object.class);
+ Assert.assertNotNull(r);
+ Assert.assertEquals(RouteType.EGRESS, r.getType());
+ Assert.assertEquals(Object.class, r.getPayloadType());
+ }
+
+
+}
Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge;
+
+import static org.jboss.seam.jms.bridge.RouteType.EGRESS;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Qualifier;
+
+import org.jboss.seam.jms.bridge.Route;
+import org.jboss.seam.jms.bridge.RouteImpl;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class RouteImplTest
+{
+ @Qualifier public @interface TestQualifier {}
+
+ @SuppressWarnings("serial")
+ @Test
+ public void addQualifier()
+ {
+ Route r = new RouteImpl(EGRESS, Object.class);
+ Annotation qualifier = new AnnotationLiteral<TestQualifier>() {};
+ r.addQualifiers(qualifier);
+ Assert.assertFalse(r.getQualifiers().isEmpty());
+ Assert.assertEquals(1, r.getQualifiers().size());
+ Assert.assertEquals(qualifier, r.getQualifiers().iterator().next());
+ }
+
+ @SuppressWarnings("serial")
+ @Test(expected=IllegalArgumentException.class)
+ public void addQualifier_non_qualifier()
+ {
+ Route r = new RouteImpl(EGRESS, Object.class);
+ r.addQualifiers(new AnnotationLiteral<Deprecated>() {});
+ }
+}
Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route (from rev 12765, modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route)
Deleted: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.test.bridge.route;
-
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-@Retention(RUNTIME)
-public @interface Bridged
-{
-}
Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge.route;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RUNTIME)
+public @interface Bridged
+{
+}
Deleted: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.test.bridge.route;
-
-import javax.enterprise.event.Event;
-import javax.inject.Inject;
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.QueueReceiver;
-
-import org.jboss.arquillian.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.jms.annotations.JmsDestination;
-import org.jboss.seam.jms.test.Util;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-(a)RunWith(Arquillian.class)
-public class RouteTest
-{
- @Deployment
- public static JavaArchive createDeployment()
- {
- return Util.createDeployment(RouteTest.class);
- }
-
- @Inject Connection c;
- @Inject @JmsDestination(jndiName="queue/DLQ") QueueReceiver qr;
- @Inject @Bridged Event<String> event;
- @Inject Event<String> plainEvent;
-
- @Test
- public void forwardSimpleEvent() throws JMSException
- {
- String expected = "test";
- c.start();
- event.fire(expected);
- Message m = qr.receive(3000);
- Assert.assertTrue(m != null);
- Assert.assertTrue(m instanceof ObjectMessage);
- Assert.assertEquals(expected, ((ObjectMessage) m).getObject());
- }
-
- @Test
- public void noMatchingRoutes() throws JMSException
- {
- String expected = "test";
- c.start();
- plainEvent.fire(expected);
- Message m = qr.receive(3000);
- Assert.assertNull(m);
- }
-}
Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge.route;
+
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.QueueReceiver;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.jms.annotations.JmsDestination;
+import org.jboss.seam.jms.test.Util;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class RouteTest
+{
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return Util.createDeployment(RouteTest.class);
+ }
+
+ @Inject Connection c;
+ @Inject @JmsDestination(jndiName="queue/DLQ") QueueReceiver qr;
+ @Inject @Bridged Event<String> event;
+ @Inject Event<String> plainEvent;
+
+ @Test
+ public void forwardSimpleEvent() throws JMSException
+ {
+ String expected = "test";
+ c.start();
+ event.fire(expected);
+ Message m = qr.receive(3000);
+ Assert.assertTrue(m != null);
+ Assert.assertTrue(m instanceof ObjectMessage);
+ Assert.assertEquals(expected, ((ObjectMessage) m).getObject());
+ }
+
+ @Test
+ public void noMatchingRoutes() throws JMSException
+ {
+ String expected = "test";
+ c.start();
+ plainEvent.fire(expected);
+ Message m = qr.receive(3000);
+ Assert.assertNull(m);
+ }
+}
Deleted: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.test.bridge.route;
-
-import static org.jboss.seam.jms.bridge.RouteType.EGRESS;
-
-import javax.enterprise.util.AnnotationLiteral;
-import javax.inject.Inject;
-import javax.jms.Queue;
-
-import org.jboss.seam.jms.annotations.JmsDestination;
-import org.jboss.seam.jms.bridge.EventBridge;
-import org.jboss.seam.jms.bridge.EventRouting;
-import org.jboss.seam.jms.bridge.Route;
-
-public class RoutingConfig
-{
- @Inject EventBridge bridge;
-
- @Inject @JmsDestination(jndiName = "queue/DLQ") Queue q;
-
- private static final AnnotationLiteral<Bridged> BRIDGED = new AnnotationLiteral<Bridged>()
- {
- private static final long serialVersionUID = 1L;
- };
-
- @EventRouting
- public Route getRoute()
- {
- return bridge.createRoute(EGRESS, String.class).addQualifiers(BRIDGED).connectTo(Queue.class, q);
- }
-}
Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge.route;
+
+import static org.jboss.seam.jms.bridge.RouteType.EGRESS;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+import javax.jms.Queue;
+
+import org.jboss.seam.jms.annotations.JmsDestination;
+import org.jboss.seam.jms.bridge.EventBridge;
+import org.jboss.seam.jms.bridge.EventRouting;
+import org.jboss.seam.jms.bridge.Route;
+
+public class RoutingConfig
+{
+ @Inject EventBridge bridge;
+
+ @Inject @JmsDestination(jndiName = "queue/DLQ") Queue q;
+
+ private static final AnnotationLiteral<Bridged> BRIDGED = new AnnotationLiteral<Bridged>()
+ {
+ private static final long serialVersionUID = 1L;
+ };
+
+ @EventRouting
+ public Route getRoute()
+ {
+ return bridge.createRoute(EGRESS, String.class).addQualifiers(BRIDGED).connectTo(Queue.class, q);
+ }
+}
14 years, 1 month
Seam SVN: r12765 - modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge.
by seam-commits@lists.jboss.org
Author: jganoff
Date: 2010-05-20 19:28:05 -0400 (Thu, 20 May 2010)
New Revision: 12765
Added:
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java
Removed:
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java
Log:
RouteImpl tests
Deleted: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java 2010-05-20 23:27:41 UTC (rev 12764)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java 2010-05-20 23:28:05 UTC (rev 12765)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.test.bridge;
-
-import static org.jboss.seam.jms.bridge.RouteType.EGRESS;
-import static org.jboss.seam.jms.bridge.RouteType.INGRESS;
-
-import javax.enterprise.util.AnnotationLiteral;
-import javax.inject.Qualifier;
-import javax.jms.JMSException;
-import javax.jms.Topic;
-
-import org.jboss.seam.jms.bridge.JmsEventBridge;
-import org.junit.Test;
-
-public class JmsEventBridgeTest
-{
- @Test
- public void createRoute()
- {
- new JmsEventBridge().createRoute(EGRESS, Object.class);
- }
-
- @Test
- public void createConnectedRoute()
- {
- new JmsEventBridge().createRoute(INGRESS, String.class).connectTo(Topic.class, new Topic()
- {
-
- public String getTopicName() throws JMSException
- {
- // TODO Auto-generated method stub
- return null;
- }
- });
- }
-
- @Qualifier
- public @interface TestQualifier
- {
- }
-
- @Test
- public void addQualifiers()
- {
- new JmsEventBridge().createRoute(EGRESS, Object.class).addQualifiers(new AnnotationLiteral<TestQualifier>()
- {
- });
- }
-
-}
Copied: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java (from rev 12763, modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java)
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java (rev 0)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java 2010-05-20 23:28:05 UTC (rev 12765)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge;
+
+import static org.jboss.seam.jms.bridge.RouteType.EGRESS;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Qualifier;
+
+import org.jboss.seam.jms.bridge.Route;
+import org.jboss.seam.jms.bridge.RouteImpl;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class RouteImplTest
+{
+ @Qualifier public @interface TestQualifier {}
+
+ @SuppressWarnings("serial")
+ @Test
+ public void addQualifier()
+ {
+ Route r = new RouteImpl(EGRESS, Object.class);
+ Annotation qualifier = new AnnotationLiteral<TestQualifier>() {};
+ r.addQualifiers(qualifier);
+ Assert.assertFalse(r.getQualifiers().isEmpty());
+ Assert.assertEquals(1, r.getQualifiers().size());
+ Assert.assertEquals(qualifier, r.getQualifiers().iterator().next());
+ }
+
+ @SuppressWarnings("serial")
+ @Test(expected=IllegalArgumentException.class)
+ public void addQualifier_non_qualifier()
+ {
+ Route r = new RouteImpl(EGRESS, Object.class);
+ r.addQualifiers(new AnnotationLiteral<Deprecated>() {});
+ }
+}
14 years, 1 month
Seam SVN: r12764 - in modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test: bridge/route and 1 other directory.
by seam-commits@lists.jboss.org
Author: jganoff
Date: 2010-05-20 19:27:41 -0400 (Thu, 20 May 2010)
New Revision: 12764
Modified:
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/Util.java
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java
Log:
Updated RouteTest to use DLQ. Re-added topic deployment resource to test utility.
Modified: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/Util.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/Util.java 2010-05-20 13:05:35 UTC (rev 12763)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/Util.java 2010-05-20 23:27:41 UTC (rev 12764)
@@ -47,7 +47,7 @@
archive.addPackage(Route.class.getPackage());
archive.addManifestResource(new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml"));
archive.addServiceProvider(Extension.class, Seam3JmsExtension.class);
-// archive.addManifestResource("topic_T-service.xml");
+ archive.addManifestResource("topic_T-service.xml");
archive.addManifestResource("queue_Q-service.xml");
archive.addPackage(c.getPackage());
Modified: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java 2010-05-20 13:05:35 UTC (rev 12763)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java 2010-05-20 23:27:41 UTC (rev 12764)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.jms.test.bridge.route;
import javax.enterprise.event.Event;
@@ -6,7 +27,7 @@
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.ObjectMessage;
-import javax.jms.TopicSubscriber;
+import javax.jms.QueueReceiver;
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
@@ -23,28 +44,11 @@
@Deployment
public static JavaArchive createDeployment()
{
- JavaArchive a = Util.createDeployment(RouteTest.class);
- a.addPackage(RouteTest.class.getPackage());
-
-// JavaArchive ejbJar = ShrinkWrap.create("test.jar", JavaArchive.class)
-// .addManifestResource(new ByteArrayAsset(new byte[0]), "beans.xml")
-// .addPackage(Seam3JmsExtension.class.getPackage())
-// .addPackage(JmsSession.class.getPackage())
-// .addPackage(ConnectionProducer.class.getPackage())
-// .addPackage(JmsAnnotatedTypeWrapper.class.getPackage())
-// .addPackage(Route.class.getPackage())
-// .addPackage(RouteTest.class.getPackage());
-//
-// EnterpriseArchive ear = ShrinkWrap.create("test.ear", EnterpriseArchive.class)
-// .addModule(ejbJar)
-// .addManifestResource("topic_T-service.xml")
-// .addManifestResource("queue_Q-service.xml");
-
- return a;
+ return Util.createDeployment(RouteTest.class);
}
@Inject Connection c;
- @Inject @JmsDestination(jndiName="jms/T") TopicSubscriber ts;
+ @Inject @JmsDestination(jndiName="queue/DLQ") QueueReceiver qr;
@Inject @Bridged Event<String> event;
@Inject Event<String> plainEvent;
@@ -54,7 +58,7 @@
String expected = "test";
c.start();
event.fire(expected);
- Message m = ts.receive(3000);
+ Message m = qr.receive(3000);
Assert.assertTrue(m != null);
Assert.assertTrue(m instanceof ObjectMessage);
Assert.assertEquals(expected, ((ObjectMessage) m).getObject());
@@ -66,7 +70,7 @@
String expected = "test";
c.start();
plainEvent.fire(expected);
- Message m = ts.receive(3000);
+ Message m = qr.receive(3000);
Assert.assertNull(m);
}
}
Modified: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java 2010-05-20 13:05:35 UTC (rev 12763)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java 2010-05-20 23:27:41 UTC (rev 12764)
@@ -25,7 +25,7 @@
import javax.enterprise.util.AnnotationLiteral;
import javax.inject.Inject;
-import javax.jms.Topic;
+import javax.jms.Queue;
import org.jboss.seam.jms.annotations.JmsDestination;
import org.jboss.seam.jms.bridge.EventBridge;
@@ -36,7 +36,7 @@
{
@Inject EventBridge bridge;
- @Inject @JmsDestination(jndiName = "jms/T") Topic t;
+ @Inject @JmsDestination(jndiName = "queue/DLQ") Queue q;
private static final AnnotationLiteral<Bridged> BRIDGED = new AnnotationLiteral<Bridged>()
{
@@ -46,6 +46,6 @@
@EventRouting
public Route getRoute()
{
- return bridge.createRoute(EGRESS, String.class).addQualifiers(BRIDGED).connectTo(Topic.class, t);
+ return bridge.createRoute(EGRESS, String.class).addQualifiers(BRIDGED).connectTo(Queue.class, q);
}
}
14 years, 1 month
Seam SVN: r12763 - branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/webservice.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-05-20 09:05:35 -0400 (Thu, 20 May 2010)
New Revision: 12763
Modified:
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/webservice/SOAPRequestHandler.java
Log:
back ported JBSEAM-4549
Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/webservice/SOAPRequestHandler.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/webservice/SOAPRequestHandler.java 2010-05-20 13:00:14 UTC (rev 12762)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/webservice/SOAPRequestHandler.java 2010-05-20 13:05:35 UTC (rev 12763)
@@ -68,7 +68,7 @@
try
{
HttpServletRequest request = (HttpServletRequest) messageContext.get(MessageContext.SERVLET_REQUEST);
- ServletLifecycle.beginRequest(request);
+ ServletLifecycle.beginRequest(request, ServletLifecycle.getServletContext());
ServletContexts.instance().setRequest(request);
14 years, 1 month
Seam SVN: r12762 - branches/enterprise/JBPAPP_5_0/examples/seambay/src/org/jboss/seam/example/seambay.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-05-20 09:00:14 -0400 (Thu, 20 May 2010)
New Revision: 12762
Modified:
branches/enterprise/JBPAPP_5_0/examples/seambay/src/org/jboss/seam/example/seambay/AuctionService.java
Log:
cleared warnings in src
Modified: branches/enterprise/JBPAPP_5_0/examples/seambay/src/org/jboss/seam/example/seambay/AuctionService.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/seambay/src/org/jboss/seam/example/seambay/AuctionService.java 2010-05-20 03:13:45 UTC (rev 12761)
+++ branches/enterprise/JBPAPP_5_0/examples/seambay/src/org/jboss/seam/example/seambay/AuctionService.java 2010-05-20 13:00:14 UTC (rev 12762)
@@ -16,15 +16,17 @@
@WebService(name = "AuctionService", serviceName = "AuctionService")
public class AuctionService implements AuctionServiceRemote
{
+ @Override
@WebMethod
public boolean login(String username, String password)
{
- Identity.instance().setUsername(username);
- Identity.instance().setPassword(password);
+ Identity.instance().getCredentials().setUsername(username);
+ Identity.instance().getCredentials().setPassword(password);
Identity.instance().login();
return Identity.instance().isLoggedIn();
}
+ @Override
@WebMethod
public boolean logout()
{
@@ -32,6 +34,7 @@
return !Identity.instance().isLoggedIn();
}
+ @Override
@WebMethod @Restrict("#{identity.loggedIn}")
public Category[] listCategories()
{
@@ -43,6 +46,7 @@
return categories.toArray(new Category[categories.size()]);
}
+ @Override
@WebMethod
public void createAuction(String title, String description, int categoryId)
{
@@ -51,30 +55,35 @@
action.setDetails(title, description, categoryId);
}
+ @Override
@WebMethod
public Auction getNewAuctionDetails()
{
return getAuctionAction().getAuction();
}
+ @Override
@WebMethod
public void updateAuctionDetails(String title, String description, int categoryId)
{
getAuctionAction().setDetails(title, description, categoryId);
}
+ @Override
@WebMethod
public void setAuctionDuration(int days)
{
getAuctionAction().setDuration(days);
}
+ @Override
@WebMethod
public void setAuctionPrice(double price)
{
getAuctionAction().getAuction().setStartingPrice(price);
}
+ @Override
@WebMethod
public void confirmAuction()
{
@@ -86,6 +95,7 @@
return (AuctionAction) Component.getInstance(AuctionAction.class, true);
}
+ @Override
@WebMethod
public Auction[] findAuctions(String searchTerm)
{
14 years, 1 month
Seam SVN: r12761 - in modules/jms/branches/eventbridge: api/src/main/java/org/jboss/seam/jms/bridge and 4 other directories.
by seam-commits@lists.jboss.org
Author: jganoff
Date: 2010-05-19 23:13:45 -0400 (Wed, 19 May 2010)
New Revision: 12761
Added:
modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/
modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java
modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java
modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/Route.java
modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java
modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/
modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java
modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/IngressRoutingBean.java
modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java
modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java
modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RoutingListener.java
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java
Log:
Start of EventBridge api and egress routing implementation
Added: modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java (rev 0)
+++ modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.reflect.Type;
+
+/**
+ * Facilitates bridging of events between CDI and a messaging system.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public interface EventBridge
+{
+ /**
+ * Creates a routing for the provided payload (event) type.
+ *
+ * @param type Type or direction of routing.
+ * @param payloadType Payload type to route. This is the event type we wish
+ * to observe events for.
+ * @return
+ */
+ public Route createRoute(RouteType type, Type payloadType);
+}
Added: modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java (rev 0)
+++ modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * <p>
+ * Identifies an Event Routing configuration method. May be applied to a method
+ * of a bean class.
+ * </p>
+ *
+ * <p>
+ * The method may return {@link EventBridge} or {@code List<}{@link EventBridge}{@code>}.
+ * </p>
+ *
+ * <pre>
+ * @Inject
+ * EventBridge bridge;
+ *
+ * @EventRouting
+ * public static Route eventRoutingConfig()
+ * {
+ * return bridge.createRoute(EGRESS, Object.class).addQualifier(SPECIAL).connectTo(Topic.class, myTopic);
+ * }
+ * </pre>
+ *
+ * @author Jordan Ganoff
+ */
+@Target( { METHOD })
+@Retention(RUNTIME)
+@Documented
+public @interface EventRouting
+{
+}
Added: modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/Route.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/Route.java (rev 0)
+++ modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/Route.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.jms.Destination;
+
+/**
+ * Routing configuration between CDI and JMS.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public interface Route
+{
+
+ /**
+ * Connect this route to a destination. Multiple destinations may be defined.
+ *
+ * @param <D> Destination type
+ * @param d Destination type (e.g. javax.jms.Topic)
+ * @param destination Destination to connect this route to
+ * @return this
+ */
+ public <D extends Destination> Route connectTo(Class<D> d, D destination);
+
+ /**
+ * Apply the qualifiers listed to this route.
+ *
+ * @param qualifiers Qualifiers for the payload type
+ * @return this
+ */
+ public Route addQualifiers(Annotation... qualifiers);
+
+ /**
+ * @return the routing type
+ */
+ public RouteType getType();
+
+ /**
+ * @return the type this route routes
+ */
+ public Type getPayloadType();
+
+ /**
+ * @return the qualifiers
+ */
+ public Set<Annotation> getQualifiers();
+
+ /**
+ * @return The destinations involved in this routing
+ */
+ public Set<? extends Destination> getDestinations();
+}
Added: modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java (rev 0)
+++ modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+/**
+ * All valid {@link Route} types.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public enum RouteType
+{
+ /**
+ * Inbound route. Any route defined as INGRESS will listen for objects
+ * delivered to the registered destinations and fire events for all that
+ * match the configuration as defined by the route.
+ */
+ INGRESS,
+
+ /**
+ * Outbound route. Any route defined as EGRESS will forward CDI events that
+ * match the configuration as defined by the route to the registered
+ * destinations.
+ */
+ EGRESS;
+}
Added: modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java (rev 0)
+++ modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.inject.Named;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Forwards CDI events that match the provided {@link Route} configuration to
+ * the configured destinations.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+@Named
+@ApplicationScoped
+public class EgressRoutingObserver implements ObserverMethod<Object>
+{
+ private Logger log;
+ private BeanManager bm;
+ private Route routing;
+
+ public EgressRoutingObserver(BeanManager bm, Route routing)
+ {
+ this.bm = bm;
+ this.routing = routing;
+ log = LoggerFactory.getLogger(routing.getClass());
+ }
+
+ public Class<?> getBeanClass()
+ {
+ return null;
+ }
+
+ public Set<Annotation> getObservedQualifiers()
+ {
+ return routing.getQualifiers();
+ }
+
+ public Type getObservedType()
+ {
+ return routing.getPayloadType();
+ }
+
+ public Reception getReception()
+ {
+ return Reception.ALWAYS;
+ }
+
+ public TransactionPhase getTransactionPhase()
+ {
+ return TransactionPhase.AFTER_SUCCESS;
+ }
+
+ public void notify(Object evt)
+ {
+ // FIXME Include qualifiers once CDI 1.0 MR is complete and
+ // notify(Event, Set<Annotation>) is added
+ forwardEvent(evt, null);
+ }
+
+ private void forwardEvent(Object event, Set<Annotation> qualifiers)
+ {
+ // TODO Allow session to be configured
+ Set<Bean<?>> beans = bm.getBeans(Session.class);
+ Bean<?> bean = bm.resolve(beans);
+ Session s = (Session) bm.getReference(bean, Session.class, bm.createCreationalContext(bean));
+ try
+ {
+ for (Destination d : routing.getDestinations())
+ {
+ log.info("Routing event {} over destination {}", event, d);
+ try
+ {
+ Message m = s.createObjectMessage((Serializable) event);
+ // Safe to create producers here always? In an app server these
+ // should be cached via JCA managed connection factory but what
+ // about other environments?
+ s.createProducer(d).send(m);
+ }
+ catch (JMSException ex)
+ {
+ log.error("Unable to forward event", ex);
+ }
+ }
+ }
+ finally
+ {
+ try
+ {
+ s.close();
+ }
+ catch (JMSException ex)
+ {
+ log.error("Unable to close session", ex);
+ }
+ }
+ }
+}
Added: modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/IngressRoutingBean.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/IngressRoutingBean.java (rev 0)
+++ modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/IngressRoutingBean.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+/**
+ * Translates received JMS messages from the configured destinations into CDI
+ * events that match the provided {@link Route} configuration.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public class IngressRoutingBean implements Bean
+{
+
+ public Class getBeanClass()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set getInjectionPoints()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getName()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set getQualifiers()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Class getScope()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set getStereotypes()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set getTypes()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isAlternative()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isNullable()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public Object create(CreationalContext creationalContext)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void destroy(Object instance, CreationalContext creationalContext)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java (rev 0)
+++ modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.reflect.Type;
+
+/**
+ * Default JMS Event Bridge
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public class JmsEventBridge implements EventBridge
+{
+ public Route createRoute(RouteType type, Type payloadType)
+ {
+ return new RouteImpl(type, payloadType);
+ }
+}
Added: modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java (rev 0)
+++ modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.inject.Qualifier;
+import javax.jms.Destination;
+
+/**
+ * JMS Event Bridge Routing
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public class RouteImpl implements Route
+{
+ private RouteType type;
+ private Type payloadType;
+ private Set<Annotation> qualifiers;
+ private Set<Destination> destinations;
+
+ public RouteImpl(RouteType type, Type payloadType)
+ {
+ this.type = type;
+ this.payloadType = payloadType;
+ qualifiers = new HashSet<Annotation>();
+ destinations = new HashSet<Destination>();
+ }
+
+ public Route addQualifiers(Annotation... q)
+ {
+ if (q != null)
+ {
+ for (int i = 0; i < q.length; i++)
+ {
+ Annotation qualifier = q[i];
+ if (!qualifier.annotationType().isAnnotationPresent(Qualifier.class))
+ {
+ throw new IllegalArgumentException("not a qualifier: " + qualifier);
+ }
+ qualifiers.add(q[i]);
+ }
+ }
+ return this;
+ }
+
+ public <D extends Destination> Route connectTo(java.lang.Class<D> d, D destination)
+ {
+ destinations.add(Destination.class.cast(destination));
+ return this;
+ };
+
+ public RouteType getType()
+ {
+ return type;
+ }
+
+ public Type getPayloadType()
+ {
+ return payloadType;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+
+ public Set<? extends Destination> getDestinations()
+ {
+ return destinations;
+ }
+}
Added: modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RoutingListener.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RoutingListener.java (rev 0)
+++ modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RoutingListener.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+@ApplicationScoped
+public class RoutingListener implements MessageListener
+{
+
+ public void onMessage(Message arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java (rev 0)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge;
+
+import static org.jboss.seam.jms.bridge.RouteType.EGRESS;
+import static org.jboss.seam.jms.bridge.RouteType.INGRESS;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Qualifier;
+import javax.jms.JMSException;
+import javax.jms.Topic;
+
+import org.jboss.seam.jms.bridge.JmsEventBridge;
+import org.junit.Test;
+
+public class JmsEventBridgeTest
+{
+ @Test
+ public void createRoute()
+ {
+ new JmsEventBridge().createRoute(EGRESS, Object.class);
+ }
+
+ @Test
+ public void createConnectedRoute()
+ {
+ new JmsEventBridge().createRoute(INGRESS, String.class).connectTo(Topic.class, new Topic()
+ {
+
+ public String getTopicName() throws JMSException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ });
+ }
+
+ @Qualifier
+ public @interface TestQualifier
+ {
+ }
+
+ @Test
+ public void addQualifiers()
+ {
+ new JmsEventBridge().createRoute(EGRESS, Object.class).addQualifiers(new AnnotationLiteral<TestQualifier>()
+ {
+ });
+ }
+
+}
Added: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java (rev 0)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge.route;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RUNTIME)
+public @interface Bridged
+{
+}
Added: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java (rev 0)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,72 @@
+package org.jboss.seam.jms.test.bridge.route;
+
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.TopicSubscriber;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.jms.annotations.JmsDestination;
+import org.jboss.seam.jms.test.Util;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class RouteTest
+{
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ JavaArchive a = Util.createDeployment(RouteTest.class);
+ a.addPackage(RouteTest.class.getPackage());
+
+// JavaArchive ejbJar = ShrinkWrap.create("test.jar", JavaArchive.class)
+// .addManifestResource(new ByteArrayAsset(new byte[0]), "beans.xml")
+// .addPackage(Seam3JmsExtension.class.getPackage())
+// .addPackage(JmsSession.class.getPackage())
+// .addPackage(ConnectionProducer.class.getPackage())
+// .addPackage(JmsAnnotatedTypeWrapper.class.getPackage())
+// .addPackage(Route.class.getPackage())
+// .addPackage(RouteTest.class.getPackage());
+//
+// EnterpriseArchive ear = ShrinkWrap.create("test.ear", EnterpriseArchive.class)
+// .addModule(ejbJar)
+// .addManifestResource("topic_T-service.xml")
+// .addManifestResource("queue_Q-service.xml");
+
+ return a;
+ }
+
+ @Inject Connection c;
+ @Inject @JmsDestination(jndiName="jms/T") TopicSubscriber ts;
+ @Inject @Bridged Event<String> event;
+ @Inject Event<String> plainEvent;
+
+ @Test
+ public void forwardSimpleEvent() throws JMSException
+ {
+ String expected = "test";
+ c.start();
+ event.fire(expected);
+ Message m = ts.receive(3000);
+ Assert.assertTrue(m != null);
+ Assert.assertTrue(m instanceof ObjectMessage);
+ Assert.assertEquals(expected, ((ObjectMessage) m).getObject());
+ }
+
+ @Test
+ public void noMatchingRoutes() throws JMSException
+ {
+ String expected = "test";
+ c.start();
+ plainEvent.fire(expected);
+ Message m = ts.receive(3000);
+ Assert.assertNull(m);
+ }
+}
Added: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java (rev 0)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java 2010-05-20 03:13:45 UTC (rev 12761)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge.route;
+
+import static org.jboss.seam.jms.bridge.RouteType.EGRESS;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+import javax.jms.Topic;
+
+import org.jboss.seam.jms.annotations.JmsDestination;
+import org.jboss.seam.jms.bridge.EventBridge;
+import org.jboss.seam.jms.bridge.EventRouting;
+import org.jboss.seam.jms.bridge.Route;
+
+public class RoutingConfig
+{
+ @Inject EventBridge bridge;
+
+ @Inject @JmsDestination(jndiName = "jms/T") Topic t;
+
+ private static final AnnotationLiteral<Bridged> BRIDGED = new AnnotationLiteral<Bridged>()
+ {
+ private static final long serialVersionUID = 1L;
+ };
+
+ @EventRouting
+ public Route getRoute()
+ {
+ return bridge.createRoute(EGRESS, String.class).addQualifiers(BRIDGED).connectTo(Topic.class, t);
+ }
+}
14 years, 1 month
Seam SVN: r12760 - in modules/jms/branches: eventbridge and 3 other directories.
by seam-commits@lists.jboss.org
Author: jganoff
Date: 2010-05-19 23:11:50 -0400 (Wed, 19 May 2010)
New Revision: 12760
Added:
modules/jms/branches/eventbridge/
modules/jms/branches/eventbridge/distribution.txt
modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java
Removed:
modules/jms/branches/eventbridge/distribution.txt
modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java
Modified:
modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java
modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/Util.java
Log:
EventBridge work
Copied: modules/jms/branches/eventbridge (from rev 12757, modules/jms/trunk)
Deleted: modules/jms/branches/eventbridge/distribution.txt
===================================================================
--- modules/jms/trunk/distribution.txt 2010-05-19 18:33:29 UTC (rev 12757)
+++ modules/jms/branches/eventbridge/distribution.txt 2010-05-20 03:11:50 UTC (rev 12760)
@@ -1,5 +0,0 @@
-To create the Seam JMS distribution, run the following Maven command:
-
-mvn clean package -P distribution
-
-Release binaries will be produced in: dist/target
\ No newline at end of file
Copied: modules/jms/branches/eventbridge/distribution.txt (from rev 12758, modules/jms/trunk/distribution.txt)
===================================================================
--- modules/jms/branches/eventbridge/distribution.txt (rev 0)
+++ modules/jms/branches/eventbridge/distribution.txt 2010-05-20 03:11:50 UTC (rev 12760)
@@ -0,0 +1,5 @@
+To create the Seam JMS distribution, run the following Maven command:
+
+mvn clean package -Drelease
+
+Release binaries will be produced in: dist/target
\ No newline at end of file
Modified: modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java 2010-05-19 18:33:29 UTC (rev 12757)
+++ modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java 2010-05-20 03:11:50 UTC (rev 12760)
@@ -21,16 +21,23 @@
*/
package org.jboss.seam.jms;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.Set;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.Extension;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import org.jboss.seam.jms.bridge.EgressRoutingObserver;
+import org.jboss.seam.jms.bridge.EventRouting;
+import org.jboss.seam.jms.bridge.Route;
import org.jboss.seam.jms.impl.wrapper.JmsAnnotatedTypeWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,27 +51,65 @@
{
private static final Logger log = LoggerFactory.getLogger(Seam3JmsExtension.class);
- public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm)
+ private Set<AnnotatedMethod<?>> eventRoutingRegistry = new HashSet<AnnotatedMethod<?>>();
+
+ public void buildRoutes(@Observes final AfterBeanDiscovery abd, final BeanManager bm)
{
- Set<Bean<?>> configuration = bm.getBeans(JmsForwarding.class);
-
- if(configuration == null || configuration.isEmpty())
+ for (AnnotatedMethod<?> m : eventRoutingRegistry)
{
- log.info("No {} registered. Event forwarding disabled.", JmsForwarding.class.getSimpleName());
- } else
- {
- for(Bean<?> c : configuration)
+ Type beanType = m.getDeclaringType().getBaseType();
+ Set<Bean<?>> configBeans = bm.getBeans(beanType);
+ for (Bean<?> configBean : configBeans)
{
- log.info("Creating {} for configuration {}", BridgedObserver.class.getSimpleName(), c);
- CreationalContext<?> context = bm.createCreationalContext(c);
- // TODO Verify configuration for correctness (e.g. getQualifiers() must contain only @Qualifier annotations)
- JmsForwarding config = JmsForwarding.class.cast(bm.getReference(c, JmsForwarding.class, context));
- BridgedObserver b = new BridgedObserver(bm, config);
- abd.addObserverMethod(b);
+ CreationalContext<?> context = bm.createCreationalContext(configBean);
+ Object config = null;
+ try
+ {
+ Object bean = bm.getReference(configBean, beanType, context);
+ config = m.getJavaMember().invoke(bean);
+ } catch (Exception ex)
+ {
+ abd.addDefinitionError(new IllegalArgumentException(EventRouting.class.getSimpleName() + " could not be loaded from bean " + beanType + ": " + ex.getMessage(), ex));
+ }
+ log.debug("Building " + Route.class.getSimpleName() + "s from " + beanType);
+ if (config != null)
+ {
+ if (Collection.class.isAssignableFrom(config.getClass()))
+ {
+ Collection<?> routes = Collection.class.cast(config);
+ for (Object route : routes)
+ {
+ if(route == null || !Route.class.isAssignableFrom(route.getClass()))
+ {
+ abd.addDefinitionError(new IllegalArgumentException("Non-" + Route.class.getSimpleName() + " found when loading " + EventRouting.class.getSimpleName() + " from " + beanType + ": " + route));
+ }
+ createRoute(abd, bm, (Route) route);
+ }
+ } else if(Route.class.isAssignableFrom(config.getClass()))
+ {
+ createRoute(abd, bm, Route.class.cast(config));
+ } else
+ {
+ abd.addDefinitionError(new IllegalArgumentException(EventRouting.class + " methods must return a " + Collection.class + "<? extends " + Route.class + "> or " + Route.class + " directly."));
+ }
+ }
}
}
}
+ private void createRoute(final AfterBeanDiscovery abd, final BeanManager bm, final Route route)
+ {
+ switch(route.getType())
+ {
+ case EGRESS:
+ abd.addObserverMethod(new EgressRoutingObserver(bm, route));
+ log.debug("Built " + route);
+ break;
+ default:
+ abd.addDefinitionError(new IllegalArgumentException("Unsupported routing type: " + route.getType()));
+ }
+ }
+
public <X> void decorateAnnotatedType(@Observes ProcessAnnotatedType<X> pat)
{
/**
@@ -72,4 +117,15 @@
*/
pat.setAnnotatedType(JmsAnnotatedTypeWrapper.decorate(pat.getAnnotatedType()));
}
+
+ public void registerEventRouting(@Observes ProcessAnnotatedType<?> pat)
+ {
+ for(AnnotatedMethod<?> m : pat.getAnnotatedType().getMethods())
+ {
+ if(m.isAnnotationPresent(EventRouting.class))
+ {
+ eventRoutingRegistry.add(m);
+ }
+ }
+ }
}
Deleted: modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java 2010-05-19 18:33:29 UTC (rev 12757)
+++ modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java 2010-05-20 03:11:50 UTC (rev 12760)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.impl.inject;
-
-import static org.jboss.seam.jms.impl.inject.InjectionUtil.getExpectedQualifier;
-
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.jms.Queue;
-import javax.jms.Topic;
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-import org.jboss.seam.jms.annotations.JmsDestination;
-import org.jboss.seam.jms.annotations.Module;
-
-public @RequestScoped class DestinationProducer
-{
-
- @Produces
- @JmsDestination
- public Topic getTopic(InjectionPoint ip, @Module Context c) throws NamingException
- {
- JmsDestination d = getExpectedQualifier(JmsDestination.class, ip.getQualifiers());
- return (Topic) c.lookup(d.jndiName());
- }
-
- @Produces
- @JmsDestination
- public Queue getQueue(InjectionPoint ip, @Module Context c) throws NamingException
- {
- JmsDestination d = getExpectedQualifier(JmsDestination.class, ip.getQualifiers());
- return (Queue) c.lookup(d.jndiName());
- }
-}
Copied: modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java (from rev 12759, modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java)
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java (rev 0)
+++ modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java 2010-05-20 03:11:50 UTC (rev 12760)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.impl.inject;
+
+import static org.jboss.seam.jms.impl.inject.InjectionUtil.getExpectedQualifier;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.jms.Queue;
+import javax.jms.Topic;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.seam.jms.annotations.JmsDestination;
+import org.jboss.seam.jms.annotations.Module;
+
+public @ApplicationScoped class DestinationProducer
+{
+
+ @Produces
+ @JmsDestination
+ public Topic getTopic(InjectionPoint ip, @Module Context c) throws NamingException
+ {
+ JmsDestination d = getExpectedQualifier(JmsDestination.class, ip.getQualifiers());
+ return (Topic) c.lookup(d.jndiName());
+ }
+
+ @Produces
+ @JmsDestination
+ public Queue getQueue(InjectionPoint ip, @Module Context c) throws NamingException
+ {
+ JmsDestination d = getExpectedQualifier(JmsDestination.class, ip.getQualifiers());
+ return (Queue) c.lookup(d.jndiName());
+ }
+}
Modified: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java 2010-05-19 18:33:29 UTC (rev 12757)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java 2010-05-20 03:11:50 UTC (rev 12760)
@@ -21,14 +21,9 @@
*/
package org.jboss.seam.jms.test;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
import javax.inject.Qualifier;
Modified: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java 2010-05-19 18:33:29 UTC (rev 12757)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java 2010-05-20 03:11:50 UTC (rev 12760)
@@ -21,14 +21,9 @@
*/
package org.jboss.seam.jms.test;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
import javax.inject.Qualifier;
Modified: modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/Util.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java 2010-05-19 18:33:29 UTC (rev 12757)
+++ modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/Util.java 2010-05-20 03:11:50 UTC (rev 12760)
@@ -25,6 +25,7 @@
import org.jboss.seam.jms.Seam3JmsExtension;
import org.jboss.seam.jms.annotations.JmsSession;
+import org.jboss.seam.jms.bridge.Route;
import org.jboss.seam.jms.impl.inject.ConnectionProducer;
import org.jboss.seam.jms.impl.wrapper.JmsAnnotatedTypeWrapper;
import org.jboss.shrinkwrap.api.ArchivePaths;
@@ -43,9 +44,10 @@
archive.addPackage(JmsSession.class.getPackage());
archive.addPackage(ConnectionProducer.class.getPackage());
archive.addPackage(JmsAnnotatedTypeWrapper.class.getPackage());
+ archive.addPackage(Route.class.getPackage());
archive.addManifestResource(new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml"));
archive.addServiceProvider(Extension.class, Seam3JmsExtension.class);
- archive.addManifestResource("topic_T-service.xml");
+// archive.addManifestResource("topic_T-service.xml");
archive.addManifestResource("queue_Q-service.xml");
archive.addPackage(c.getPackage());
14 years, 1 month
Seam SVN: r12759 - modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/impl/inject.
by seam-commits@lists.jboss.org
Author: jganoff
Date: 2010-05-19 23:10:12 -0400 (Wed, 19 May 2010)
New Revision: 12759
Modified:
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java
Log:
Destinations are now ApplicationScoped
Modified: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java 2010-05-20 03:09:35 UTC (rev 12758)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java 2010-05-20 03:10:12 UTC (rev 12759)
@@ -23,7 +23,7 @@
import static org.jboss.seam.jms.impl.inject.InjectionUtil.getExpectedQualifier;
-import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.jms.Queue;
@@ -34,7 +34,7 @@
import org.jboss.seam.jms.annotations.JmsDestination;
import org.jboss.seam.jms.annotations.Module;
-public @RequestScoped class DestinationProducer
+public @ApplicationScoped class DestinationProducer
{
@Produces
14 years, 1 month
Seam SVN: r12758 - modules/jms/trunk.
by seam-commits@lists.jboss.org
Author: jganoff
Date: 2010-05-19 23:09:35 -0400 (Wed, 19 May 2010)
New Revision: 12758
Modified:
modules/jms/trunk/distribution.txt
Log:
Updated distribution.txt to reflect changes made to project configuration
Modified: modules/jms/trunk/distribution.txt
===================================================================
--- modules/jms/trunk/distribution.txt 2010-05-19 18:33:29 UTC (rev 12757)
+++ modules/jms/trunk/distribution.txt 2010-05-20 03:09:35 UTC (rev 12758)
@@ -1,5 +1,5 @@
To create the Seam JMS distribution, run the following Maven command:
-mvn clean package -P distribution
+mvn clean package -Drelease
Release binaries will be produced in: dist/target
\ No newline at end of file
14 years, 1 month
Seam SVN: r12757 - in modules/jms/trunk: docs/reference and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-05-19 14:33:29 -0400 (Wed, 19 May 2010)
New Revision: 12757
Modified:
modules/jms/trunk/dist/pom.xml
modules/jms/trunk/docs/reference/pom.xml
Log:
don't deploy docs or dist
Modified: modules/jms/trunk/dist/pom.xml
===================================================================
--- modules/jms/trunk/dist/pom.xml 2010-05-19 18:18:17 UTC (rev 12756)
+++ modules/jms/trunk/dist/pom.xml 2010-05-19 18:33:29 UTC (rev 12757)
@@ -53,6 +53,13 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>
Modified: modules/jms/trunk/docs/reference/pom.xml
===================================================================
--- modules/jms/trunk/docs/reference/pom.xml 2010-05-19 18:18:17 UTC (rev 12756)
+++ modules/jms/trunk/docs/reference/pom.xml 2010-05-19 18:33:29 UTC (rev 12757)
@@ -87,6 +87,13 @@
</options>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>
14 years, 1 month