You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by ha...@apache.org on 2011/12/08 03:15:25 UTC

svn commit: r1211742 - in /labs/magnet/core/src: main/java/org/apache/labs/magnet/bbs/Bulletin.java main/resources/META-INF/spring/beans.xml test/java/org/apache/labs/magnet/core/RouteTest.java

Author: hadrian
Date: Thu Dec  8 02:15:25 2011
New Revision: 1211742

URL: http://svn.apache.org/viewvc?rev=1211742&view=rev
Log:
Use link instead of ref to avoid confusion. Make them attributes instead of elements

Modified:
    labs/magnet/core/src/main/java/org/apache/labs/magnet/bbs/Bulletin.java
    labs/magnet/core/src/main/resources/META-INF/spring/beans.xml
    labs/magnet/core/src/test/java/org/apache/labs/magnet/core/RouteTest.java

Modified: labs/magnet/core/src/main/java/org/apache/labs/magnet/bbs/Bulletin.java
URL: http://svn.apache.org/viewvc/labs/magnet/core/src/main/java/org/apache/labs/magnet/bbs/Bulletin.java?rev=1211742&r1=1211741&r2=1211742&view=diff
==============================================================================
--- labs/magnet/core/src/main/java/org/apache/labs/magnet/bbs/Bulletin.java (original)
+++ labs/magnet/core/src/main/java/org/apache/labs/magnet/bbs/Bulletin.java Thu Dec  8 02:15:25 2011
@@ -16,70 +16,73 @@
  */
 package org.apache.labs.magnet.bbs;
 
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 
 
-@XmlRootElement(namespace = "http://labs.apache.org/magnet", name = "bulletin")
 @XmlType
+@XmlRootElement(namespace = "http://labs.apache.org/magnet", name = "bulletin")
+@XmlAccessorType(XmlAccessType.FIELD)
 public class Bulletin {
-
-	private String id;
-	private String ref;
-	private String text;
-	private String summary;
-	private String description;
-
-	public Bulletin() {
-		this(null);
-	}
-	
-	public Bulletin(String id) {
-		this.id = id;
-	}
-	
-	@Override
-	public String toString() {
-		return "Bulletin [id=" + id + ", ref=" + ref + "]";
-	}
-
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
-	public String getRef() {
-		return ref;
-	}
-
-	public void setRef(String ref) {
-		this.ref = ref;
-	}
-
-	public String getText() {
-		return text;
-	}
-
-	public void setText(String text) {
-		this.text = text;
-	}
-
-	public String getSummary() {
-		return summary;
-	}
-
-	public void setSummary(String summary) {
-		this.summary = summary;
-	}
-
-	public String getDescription() {
-		return description;
-	}
-
-	public void setDescription(String description) {
-		this.description = description;
-	}
+    @XmlAttribute private String id;
+    @XmlAttribute private String link;
+    private String text;
+    private String summary;
+    private String description;
+
+    public Bulletin() {
+        this(null);
+    }
+    
+    public Bulletin(String id) {
+        this.id = id;
+    }
+    
+    @Override
+    public String toString() {
+        return "Bulletin [id=" + id + ", link=" + link + "]";
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getLink() {
+        return link;
+    }
+
+    public void setLink(String link) {
+        this.link = link;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public String getSummary() {
+        return summary;
+    }
+
+    public void setSummary(String summary) {
+        this.summary = summary;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
 }

Modified: labs/magnet/core/src/main/resources/META-INF/spring/beans.xml
URL: http://svn.apache.org/viewvc/labs/magnet/core/src/main/resources/META-INF/spring/beans.xml?rev=1211742&r1=1211741&r2=1211742&view=diff
==============================================================================
--- labs/magnet/core/src/main/resources/META-INF/spring/beans.xml (original)
+++ labs/magnet/core/src/main/resources/META-INF/spring/beans.xml Thu Dec  8 02:15:25 2011
@@ -91,6 +91,7 @@
 
     <route id="bbs-process">
       <from uri="direct://bulletin-processor" />
+      <setHeader headerName="CamelFileName"><simple>${body.id}.xml</simple></setHeader>
       <marshal><jaxb contextPath="org.apache.labs.magnet.bbs" /></marshal>
       <to uri="file:/x1/apache/magnet" />
     </route>

Modified: labs/magnet/core/src/test/java/org/apache/labs/magnet/core/RouteTest.java
URL: http://svn.apache.org/viewvc/labs/magnet/core/src/test/java/org/apache/labs/magnet/core/RouteTest.java?rev=1211742&r1=1211741&r2=1211742&view=diff
==============================================================================
--- labs/magnet/core/src/test/java/org/apache/labs/magnet/core/RouteTest.java (original)
+++ labs/magnet/core/src/test/java/org/apache/labs/magnet/core/RouteTest.java Thu Dec  8 02:15:25 2011
@@ -36,7 +36,7 @@ public class RouteTest extends CamelSpri
     @Test
     public void testRoute() throws Exception {
         HttpPost post = new HttpPost("http://localhost:9100/bbs");
-        StringEntity entity = new StringEntity("<bulletin xmlns=\"http://labs.apache.org/magnet\"><id>CAMEL-1234</id><ref>http://camel.apache.org</ref></bulletin>", "UTF-8");
+        StringEntity entity = new StringEntity("<bulletin xmlns=\"http://labs.apache.org/magnet\" id=\"CAMEL-1234\" link=\"http://camel.apache.org\" />", "UTF-8");
         entity.setContentType("text/xml; charset=UTF-8");
         post.setEntity(entity);
         HttpClient httpclient = new DefaultHttpClient();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org