barely started with writing json version of archive data
git-svn-id: https://svn.apache.org/repos/asf/creadur/tentacles/trunk@1615488 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index b4caca4..58329ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,13 +40,19 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
- <version>4.1.1</version>
+ <version>4.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
- <version>4.1.1</version>
+ <version>4.3.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.module</groupId>
+ <artifactId>jackson-module-jaxb-annotations</artifactId>
+ <version>2.4.0</version>
</dependency>
<dependency>
diff --git a/src/main/java/org/apache/creadur/tentacles/ArchivesJson.java b/src/main/java/org/apache/creadur/tentacles/ArchivesJson.java
new file mode 100644
index 0000000..02a9a9a
--- /dev/null
+++ b/src/main/java/org/apache/creadur/tentacles/ArchivesJson.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.creadur.tentacles;
+
+public class ArchivesJson {
+
+
+
+}
diff --git a/src/main/java/org/apache/creadur/tentacles/model/Archives.java b/src/main/java/org/apache/creadur/tentacles/model/Archives.java
new file mode 100644
index 0000000..e9898c8
--- /dev/null
+++ b/src/main/java/org/apache/creadur/tentacles/model/Archives.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.creadur.tentacles.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * To be marshalled to json as an archives.json file
+ * Will contain a summary list of the artifacts intended for tabular display
+ */
+@XmlRootElement
+public class Archives {
+
+ private final List<Item> archives = new ArrayList<Item>();
+
+ /**
+ * Required for JAXB
+ */
+ public Archives() {
+ }
+
+ public List<Item> getArchives() {
+ return archives;
+ }
+
+ public void add(Item item) {
+ archives.add(item);
+ }
+
+ public Item addItem() {
+ final Item item = new Item();
+ archives.add(item);
+ return item;
+ }
+
+ public static class Item {
+
+ /**
+ * Required for JAXB
+ */
+ public Item() {
+ }
+
+ /**
+ * The path in the repo, minus the repo portion itself (relative)
+ */
+ private String path;
+
+ /**
+ * Just the file name with no path
+ */
+ private String name;
+
+ /**
+ * Jar, war, zip
+ */
+ private String type;
+
+ /**
+ * Count of how many jars are in this archive
+ */
+ private int jars;
+
+ /**
+ * Unique ID of the license file
+ */
+ private String license;
+
+
+ /**
+ * Unique ID of the notice file
+ */
+ private String notice;
+
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public int getJars() {
+ return jars;
+ }
+
+ public void setJars(int jars) {
+ this.jars = jars;
+ }
+
+ public String getLicense() {
+ return license;
+ }
+
+ public void setLicense(String license) {
+ this.license = license;
+ }
+
+ public String getNotice() {
+ return notice;
+ }
+
+ public void setNotice(String notice) {
+ this.notice = notice;
+ }
+
+ public Item path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ public Item name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Item type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public Item jars(int jars) {
+ this.jars = jars;
+ return this;
+ }
+
+ public Item license(String license) {
+ this.license = license;
+ return this;
+ }
+
+ public Item notice(String notice) {
+ this.notice = notice;
+ return this;
+ }
+ }
+}
diff --git a/src/test/java/org/apache/creadur/tentacles/ArchivesJsonTest.java b/src/test/java/org/apache/creadur/tentacles/ArchivesJsonTest.java
new file mode 100644
index 0000000..699c0d9
--- /dev/null
+++ b/src/test/java/org/apache/creadur/tentacles/ArchivesJsonTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.creadur.tentacles;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
+import org.apache.creadur.tentacles.model.Archives;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ArchivesJsonTest extends Assert {
+
+ @Test
+ public void test() throws Exception {
+
+ final Archives archives = new Archives();
+ archives.addItem()
+ .name("hello.jar")
+ .path("one/two/hello.jar")
+ ;
+
+ final ObjectMapper mapper = new ObjectMapper();
+ JaxbAnnotationModule module = new JaxbAnnotationModule();
+ // configure as necessary
+ mapper.registerModule(module);
+
+ mapper.writerWithDefaultPrettyPrinter().writeValue(System.out, archives);
+ }
+}