Commit c464dab5fb592a0d0d91b59451e3009dc2599d78

Authored by Gonzalo Aguilar Delgado
1 parent 828adb18

Version Bump

Support MetaAttributes
level2-mq-api/pom.xml
... ... @@ -4,7 +4,7 @@
4 4 <parent>
5 5 <groupId>com.level2.server.mq</groupId>
6 6 <artifactId>level2-mq</artifactId>
7   - <version>1.4.2-SNAPSHOT</version>
  7 + <version>1.4.3-SNAPSHOT</version>
8 8 </parent>
9 9 <name>Level2 :: MQ :: API</name>
10 10 <url>http://www.level2crm.com</url>
... ...
level2-mq-examples/pom.xml
... ... @@ -3,7 +3,7 @@
3 3 <parent>
4 4 <groupId>com.level2.server.mq</groupId>
5 5 <artifactId>level2-mq</artifactId>
6   - <version>1.4.2-SNAPSHOT</version>
  6 + <version>1.4.3-SNAPSHOT</version>
7 7 </parent>
8 8 <artifactId>level2-mq-examples</artifactId>
9 9 <name>Level2 :: MQ :: Examples</name>
... ... @@ -37,7 +37,7 @@
37 37 <dependency>
38 38 <groupId>com.level2.server.mq</groupId>
39 39 <artifactId>level2-rabbit-mq-impl</artifactId>
40   - <version>1.4.2-SNAPSHOT</version>
  40 + <version>1.4.3-SNAPSHOT</version>
41 41 </dependency>
42 42 <dependency>
43 43 <groupId>org.slf4j</groupId>
... ...
level2-rabbit-mq-impl/pom.xml
... ... @@ -4,7 +4,7 @@
4 4 <parent>
5 5 <groupId>com.level2.server.mq</groupId>
6 6 <artifactId>level2-mq</artifactId>
7   - <version>1.4.2-SNAPSHOT</version>
  7 + <version>1.4.3-SNAPSHOT</version>
8 8 </parent>
9 9 <name>Level2 :: MQ :: RABBIT</name>
10 10 <url>http://www.level2crm.com</url>
... ...
level2-rabbit-mq-impl/src/main/java/com/level2/enterprise/nebula/mq/mapping/ProcessorClass.java
... ... @@ -2,15 +2,20 @@ package com.level2.enterprise.nebula.mq.mapping;
2 2  
3 3 import java.util.ArrayList;
4 4 import java.util.List;
  5 +import java.util.Map;
5 6  
6   -public class ProcessorClass {
  7 +import com.level2.enterprise.nebula.mq.mapping.meta.MetaAttributable;
  8 +import com.level2.enterprise.nebula.mq.mapping.meta.MetaAttribute;
  9 +
  10 +public class ProcessorClass implements MetaAttributable {
7 11  
8 12 protected List<MethodDescription> listMethods;
9 13 protected String name;
10 14 protected String className;
11 15 protected String targetClassName;
12 16 protected String queueName;
13   -
  17 + private Map metaAttributes;
  18 +
14 19 public ProcessorClass() {
15 20 listMethods = new ArrayList<MethodDescription>();
16 21 }
... ... @@ -55,4 +60,14 @@ public class ProcessorClass {
55 60 this.queueName = queueName;
56 61 }
57 62  
  63 + public java.util.Map getMetaAttributes() {
  64 + return metaAttributes;
  65 + }
  66 + public MetaAttribute getMetaAttribute(String attributeName) {
  67 + return metaAttributes==null?null:(MetaAttribute) metaAttributes.get(attributeName);
  68 + }
  69 +
  70 + public void setMetaAttributes(java.util.Map metas) {
  71 + this.metaAttributes = metas;
  72 + }
58 73 }
... ...
level2-rabbit-mq-impl/src/main/java/com/level2/enterprise/nebula/mq/mapping/meta/MetaAttributable.java 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +package com.level2.enterprise.nebula.mq.mapping.meta;
  2 +
  3 +public interface MetaAttributable {
  4 + public java.util.Map getMetaAttributes();
  5 + public void setMetaAttributes(java.util.Map metas);
  6 + public MetaAttribute getMetaAttribute(String name);
  7 +
  8 +}
... ...
level2-rabbit-mq-impl/src/main/java/com/level2/enterprise/nebula/mq/mapping/meta/MetaAttribute.java 0 → 100644
... ... @@ -0,0 +1,69 @@
  1 +/*
  2 + * Hibernate, Relational Persistence for Idiomatic Java
  3 + *
  4 + * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
  5 + * indicated by the @author tags or express copyright attribution
  6 + * statements applied by the authors. All third-party contributions are
  7 + * distributed under license by Red Hat Middleware LLC.
  8 + *
  9 + * This copyrighted material is made available to anyone wishing to use, modify,
  10 + * copy, or redistribute it subject to the terms and conditions of the GNU
  11 + * Lesser General Public License, as published by the Free Software Foundation.
  12 + *
  13 + * This program is distributed in the hope that it will be useful,
  14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  15 + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
  16 + * for more details.
  17 + *
  18 + * You should have received a copy of the GNU Lesser General Public License
  19 + * along with this distribution; if not, write to:
  20 + * Free Software Foundation, Inc.
  21 + * 51 Franklin Street, Fifth Floor
  22 + * Boston, MA 02110-1301 USA
  23 + *
  24 + */
  25 +package com.level2.enterprise.nebula.mq.mapping.meta;
  26 +
  27 +import java.io.Serializable;
  28 +import java.util.ArrayList;
  29 +import java.util.Collections;
  30 +
  31 +/**
  32 + * A meta attribute is a named value or values.
  33 + * @author Gavin King
  34 + */
  35 +public class MetaAttribute implements Serializable {
  36 + private String name;
  37 + private java.util.List values = new ArrayList();
  38 +
  39 + public MetaAttribute(String name) {
  40 + this.name = name;
  41 + }
  42 +
  43 + public String getName() {
  44 + return name;
  45 + }
  46 +
  47 + public java.util.List getValues() {
  48 + return Collections.unmodifiableList(values);
  49 + }
  50 +
  51 + public void addValue(String value) {
  52 + values.add(value);
  53 + }
  54 +
  55 + public String getValue() {
  56 + if ( values.size()!=1 ) {
  57 + throw new IllegalStateException("no unique value");
  58 + }
  59 + return (String) values.get(0);
  60 + }
  61 +
  62 + public boolean isMultiValued() {
  63 + return values.size()>1;
  64 + }
  65 +
  66 + public String toString() {
  67 + return "[" + name + "=" + values + "]";
  68 + }
  69 +}
... ...
pom.xml
... ... @@ -5,7 +5,7 @@
5 5 <groupId>com.level2.server.mq</groupId>
6 6 <artifactId>level2-mq</artifactId>
7 7 <packaging>pom</packaging>
8   - <version>1.4.2-SNAPSHOT</version>
  8 + <version>1.4.3-SNAPSHOT</version>
9 9 <name>Level2 :: MQ</name>
10 10 <prerequisites>
11 11 <maven>3.0.0</maven>
... ...