From 906b2145157936ee1c2729c91fd38cb0ef5bf9aa Mon Sep 17 00:00:00 2001 From: Mateusz Kopeć <m.kopec@ipipan.waw.pl> Date: Thu, 13 Aug 2015 12:34:11 +0200 Subject: [PATCH] update package naming, log4j upgrade, deployment configuration --- pom.xml | 23 +++++++++++++++++------ src/main/java/mkopec/summ/pscapi/io/PSC_IO.java | 44 -------------------------------------------- src/main/java/mkopec/summ/pscapi/xml/Adapter1.java | 29 ----------------------------- src/main/java/mkopec/summ/pscapi/xml/Adapter2.java | 29 ----------------------------- src/main/java/mkopec/summ/pscapi/xml/ObjectFactory.java | 79 ------------------------------------------------------------------------------- src/main/java/mkopec/summ/pscapi/xml/Span.java | 127 ------------------------------------------------------------------------------------------------------------------------------- src/main/java/mkopec/summ/pscapi/xml/SpanType.java | 127 ------------------------------------------------------------------------------------------------------------------------------- src/main/java/mkopec/summ/pscapi/xml/Spans.java | 76 ---------------------------------------------------------------------------- src/main/java/mkopec/summ/pscapi/xml/Summaries.java | 74 -------------------------------------------------------------------------- src/main/java/mkopec/summ/pscapi/xml/Summary.java | 195 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/main/java/mkopec/summ/pscapi/xml/Text.java | 253 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/main/java/pl/waw/ipipan/zil/summ/pscapi/io/PSC_IO.java | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Adapter1.java | 29 +++++++++++++++++++++++++++++ src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Adapter2.java | 29 +++++++++++++++++++++++++++++ src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/ObjectFactory.java | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Span.java | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/SpanType.java | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Spans.java | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Summaries.java | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Summary.java | 195 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Text.java | 253 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/log4j.properties | 6 ------ src/main/resources/log4j2.xml | 13 +++++++++++++ src/test/java/mkopec/summ/pscapi/io/ReadTest.java | 41 ----------------------------------------- src/test/java/pl/waw/ipipan/zil/summ/pscapi/io/ReadTest.java | 43 +++++++++++++++++++++++++++++++++++++++++++ 25 files changed, 1107 insertions(+), 1086 deletions(-) delete mode 100644 src/main/java/mkopec/summ/pscapi/io/PSC_IO.java delete mode 100644 src/main/java/mkopec/summ/pscapi/xml/Adapter1.java delete mode 100644 src/main/java/mkopec/summ/pscapi/xml/Adapter2.java delete mode 100644 src/main/java/mkopec/summ/pscapi/xml/ObjectFactory.java delete mode 100644 src/main/java/mkopec/summ/pscapi/xml/Span.java delete mode 100644 src/main/java/mkopec/summ/pscapi/xml/SpanType.java delete mode 100644 src/main/java/mkopec/summ/pscapi/xml/Spans.java delete mode 100644 src/main/java/mkopec/summ/pscapi/xml/Summaries.java delete mode 100644 src/main/java/mkopec/summ/pscapi/xml/Summary.java delete mode 100644 src/main/java/mkopec/summ/pscapi/xml/Text.java create mode 100644 src/main/java/pl/waw/ipipan/zil/summ/pscapi/io/PSC_IO.java create mode 100644 src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Adapter1.java create mode 100644 src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Adapter2.java create mode 100644 src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/ObjectFactory.java create mode 100644 src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Span.java create mode 100644 src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/SpanType.java create mode 100644 src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Spans.java create mode 100644 src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Summaries.java create mode 100644 src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Summary.java create mode 100644 src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Text.java delete mode 100644 src/main/resources/log4j.properties create mode 100644 src/main/resources/log4j2.xml delete mode 100644 src/test/java/mkopec/summ/pscapi/io/ReadTest.java create mode 100644 src/test/java/pl/waw/ipipan/zil/summ/pscapi/io/ReadTest.java diff --git a/pom.xml b/pom.xml index 6b9ce19..5842e02 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,9 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>mkopec.summ</groupId> + <groupId>pl.waw.ipipan.zil.summ</groupId> <artifactId>pscapi</artifactId> - <version>0.1-SNAPSHOT</version> + <version>1.0-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> @@ -20,14 +20,14 @@ <dependencies> <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.17</version> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.3</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.8.1</version> + <version>4.12</version> </dependency> </dependencies> @@ -44,4 +44,15 @@ </plugin> </plugins> </build> + + <distributionManagement> + <repository> + <id>deployment</id> + <url>http://maven.nlp.ipipan.waw.pl/content/repositories/releases/</url> + </repository> + <snapshotRepository> + <id>deployment</id> + <url>http://maven.nlp.ipipan.waw.pl/content/repositories/snapshots/</url> + </snapshotRepository> + </distributionManagement> </project> \ No newline at end of file diff --git a/src/main/java/mkopec/summ/pscapi/io/PSC_IO.java b/src/main/java/mkopec/summ/pscapi/io/PSC_IO.java deleted file mode 100644 index 9f4b4c9..0000000 --- a/src/main/java/mkopec/summ/pscapi/io/PSC_IO.java +++ /dev/null @@ -1,44 +0,0 @@ -package mkopec.summ.pscapi.io; - -import java.io.File; -import java.io.IOException; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; - -import org.apache.log4j.Logger; - -import mkopec.summ.pscapi.xml.Text; - -public class PSC_IO { - - private final static Logger LOG = Logger.getLogger(PSC_IO.class); - - public static Text readText(String testFilePath) throws IOException, JAXBException { - return readText(new File(testFilePath)); - } - - public static Text readText(File file) throws IOException, JAXBException { - LOG.debug("Reading text from file: " + file); - if (!file.isFile()) { - LOG.error("Error reading text - file not found: " + file.getPath()); - throw new IOException("File not found: " + file.getPath()); - } - JAXBContext jc = JAXBContext.newInstance(Text.class); - Unmarshaller unmarshaller = jc.createUnmarshaller(); - Text text = (Text) unmarshaller.unmarshal(file); - - return text; - } - - public static void saveText(Text text, String targetPath) throws JAXBException { - LOG.debug("Saving text to file: " + targetPath); - - JAXBContext jc = JAXBContext.newInstance(Text.class); - Marshaller marshaller = jc.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - marshaller.marshal(text, new File(targetPath)); - } -} diff --git a/src/main/java/mkopec/summ/pscapi/xml/Adapter1.java b/src/main/java/mkopec/summ/pscapi/xml/Adapter1.java deleted file mode 100644 index b841ae8..0000000 --- a/src/main/java/mkopec/summ/pscapi/xml/Adapter1.java +++ /dev/null @@ -1,29 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.22 at 12:56:02 PM CEST -// - - -package mkopec.summ.pscapi.xml; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -public class Adapter1 - extends XmlAdapter<String, Integer> -{ - - - public Integer unmarshal(String value) { - return new Integer(value); - } - - public String marshal(Integer value) { - if (value == null) { - return null; - } - return value.toString(); - } - -} diff --git a/src/main/java/mkopec/summ/pscapi/xml/Adapter2.java b/src/main/java/mkopec/summ/pscapi/xml/Adapter2.java deleted file mode 100644 index 648bde9..0000000 --- a/src/main/java/mkopec/summ/pscapi/xml/Adapter2.java +++ /dev/null @@ -1,29 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.22 at 12:56:02 PM CEST -// - - -package mkopec.summ.pscapi.xml; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -public class Adapter2 - extends XmlAdapter<String, Integer> -{ - - - public Integer unmarshal(String value) { - return new Integer(value); - } - - public String marshal(Integer value) { - if (value == null) { - return null; - } - return value.toString(); - } - -} diff --git a/src/main/java/mkopec/summ/pscapi/xml/ObjectFactory.java b/src/main/java/mkopec/summ/pscapi/xml/ObjectFactory.java deleted file mode 100644 index 46ca11b..0000000 --- a/src/main/java/mkopec/summ/pscapi/xml/ObjectFactory.java +++ /dev/null @@ -1,79 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.22 at 12:56:02 PM CEST -// - - -package mkopec.summ.pscapi.xml; - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the mkopec.summ.pscapi.xml package. - * <p>An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: mkopec.summ.pscapi.xml - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link Text } - * - */ - public Text createText() { - return new Text(); - } - - /** - * Create an instance of {@link Summaries } - * - */ - public Summaries createSummaries() { - return new Summaries(); - } - - /** - * Create an instance of {@link Summary } - * - */ - public Summary createSummary() { - return new Summary(); - } - - /** - * Create an instance of {@link Span } - * - */ - public Span createSpan() { - return new Span(); - } - - /** - * Create an instance of {@link Spans } - * - */ - public Spans createSpans() { - return new Spans(); - } - -} diff --git a/src/main/java/mkopec/summ/pscapi/xml/Span.java b/src/main/java/mkopec/summ/pscapi/xml/Span.java deleted file mode 100644 index ee4667f..0000000 --- a/src/main/java/mkopec/summ/pscapi/xml/Span.java +++ /dev/null @@ -1,127 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.22 at 12:56:02 PM CEST -// - - -package mkopec.summ.pscapi.xml; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - * <p>Java class for Span complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="Span"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <attribute name="start" type="{http://www.w3.org/2001/XMLSchema}integer" /> - * <attribute name="end" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" /> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Span", propOrder = { - "content" -}) -public class Span { - - @XmlValue - protected String content; - @XmlAttribute(name = "start") - @XmlJavaTypeAdapter(Adapter1 .class) - @XmlSchemaType(name = "integer") - protected Integer start; - @XmlAttribute(name = "end") - @XmlJavaTypeAdapter(Adapter2 .class) - @XmlSchemaType(name = "positiveInteger") - protected Integer end; - - /** - * Gets the value of the content property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getContent() { - return content; - } - - /** - * Sets the value of the content property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setContent(String value) { - this.content = value; - } - - /** - * Gets the value of the start property. - * - * @return - * possible object is - * {@link String } - * - */ - public Integer getStart() { - return start; - } - - /** - * Sets the value of the start property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStart(Integer value) { - this.start = value; - } - - /** - * Gets the value of the end property. - * - * @return - * possible object is - * {@link String } - * - */ - public Integer getEnd() { - return end; - } - - /** - * Sets the value of the end property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEnd(Integer value) { - this.end = value; - } - -} diff --git a/src/main/java/mkopec/summ/pscapi/xml/SpanType.java b/src/main/java/mkopec/summ/pscapi/xml/SpanType.java deleted file mode 100644 index f01e1b6..0000000 --- a/src/main/java/mkopec/summ/pscapi/xml/SpanType.java +++ /dev/null @@ -1,127 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.22 at 12:53:09 PM CEST -// - - -package mkopec.summ.pscapi.xml; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - * <p>Java class for SpanType complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="SpanType"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <attribute name="start" type="{http://www.w3.org/2001/XMLSchema}integer" /> - * <attribute name="end" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" /> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SpanType", propOrder = { - "content" -}) -public class SpanType { - - @XmlValue - protected String content; - @XmlAttribute(name = "start") - @XmlJavaTypeAdapter(Adapter1 .class) - @XmlSchemaType(name = "integer") - protected Integer start; - @XmlAttribute(name = "end") - @XmlJavaTypeAdapter(Adapter2 .class) - @XmlSchemaType(name = "positiveInteger") - protected Integer end; - - /** - * Gets the value of the content property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getContent() { - return content; - } - - /** - * Sets the value of the content property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setContent(String value) { - this.content = value; - } - - /** - * Gets the value of the start property. - * - * @return - * possible object is - * {@link String } - * - */ - public Integer getStart() { - return start; - } - - /** - * Sets the value of the start property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStart(Integer value) { - this.start = value; - } - - /** - * Gets the value of the end property. - * - * @return - * possible object is - * {@link String } - * - */ - public Integer getEnd() { - return end; - } - - /** - * Sets the value of the end property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEnd(Integer value) { - this.end = value; - } - -} diff --git a/src/main/java/mkopec/summ/pscapi/xml/Spans.java b/src/main/java/mkopec/summ/pscapi/xml/Spans.java deleted file mode 100644 index 1ad8ba8..0000000 --- a/src/main/java/mkopec/summ/pscapi/xml/Spans.java +++ /dev/null @@ -1,76 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.22 at 12:56:02 PM CEST -// - - -package mkopec.summ.pscapi.xml; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for Spans complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="Spans"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="span" type="{}Span" maxOccurs="unbounded"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Spans", propOrder = { - "span" -}) -public class Spans { - - @XmlElement(required = true) - protected List<Span> span; - - /** - * Gets the value of the span property. - * - * <p> - * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a <CODE>set</CODE> method for the span property. - * - * <p> - * For example, to add a new item, do as follows: - * <pre> - * getSpan().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list - * {@link Span } - * - * - */ - public List<Span> getSpan() { - if (span == null) { - span = new ArrayList<Span>(); - } - return this.span; - } - -} diff --git a/src/main/java/mkopec/summ/pscapi/xml/Summaries.java b/src/main/java/mkopec/summ/pscapi/xml/Summaries.java deleted file mode 100644 index 4a80fc8..0000000 --- a/src/main/java/mkopec/summ/pscapi/xml/Summaries.java +++ /dev/null @@ -1,74 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.22 at 12:56:02 PM CEST -// - - -package mkopec.summ.pscapi.xml; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for Summaries complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="Summaries"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="summary" type="{}Summary" maxOccurs="unbounded" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Summaries", propOrder = { - "summary" -}) -public class Summaries { - - protected List<Summary> summary; - - /** - * Gets the value of the summary property. - * - * <p> - * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a <CODE>set</CODE> method for the summary property. - * - * <p> - * For example, to add a new item, do as follows: - * <pre> - * getSummary().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list - * {@link Summary } - * - * - */ - public List<Summary> getSummary() { - if (summary == null) { - summary = new ArrayList<Summary>(); - } - return this.summary; - } - -} diff --git a/src/main/java/mkopec/summ/pscapi/xml/Summary.java b/src/main/java/mkopec/summ/pscapi/xml/Summary.java deleted file mode 100644 index 1e30669..0000000 --- a/src/main/java/mkopec/summ/pscapi/xml/Summary.java +++ /dev/null @@ -1,195 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.22 at 12:56:02 PM CEST -// - - -package mkopec.summ.pscapi.xml; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - * <p>Java class for Summary complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="Summary"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="body" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="spans" type="{}Spans" minOccurs="0"/> - * </sequence> - * <attribute name="ratio"> - * <simpleType> - * <restriction base="{http://www.w3.org/2001/XMLSchema}positiveInteger"> - * <enumeration value="20"/> - * <enumeration value="10"/> - * <enumeration value="5"/> - * </restriction> - * </simpleType> - * </attribute> - * <attribute name="type"> - * <simpleType> - * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> - * <enumeration value="extract"/> - * <enumeration value="abstract"/> - * </restriction> - * </simpleType> - * </attribute> - * <attribute name="author" type="{http://www.w3.org/2001/XMLSchema}string" /> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Summary", propOrder = { - "body", - "spans" -}) -public class Summary { - - @XmlElement(required = true) - protected String body; - protected Spans spans; - @XmlAttribute(name = "ratio") - @XmlJavaTypeAdapter(Adapter2 .class) - protected Integer ratio; - @XmlAttribute(name = "type") - protected String type; - @XmlAttribute(name = "author") - protected String author; - - /** - * Gets the value of the body property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getBody() { - return body; - } - - /** - * Sets the value of the body property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setBody(String value) { - this.body = value; - } - - /** - * Gets the value of the spans property. - * - * @return - * possible object is - * {@link Spans } - * - */ - public Spans getSpans() { - return spans; - } - - /** - * Sets the value of the spans property. - * - * @param value - * allowed object is - * {@link Spans } - * - */ - public void setSpans(Spans value) { - this.spans = value; - } - - /** - * Gets the value of the ratio property. - * - * @return - * possible object is - * {@link String } - * - */ - public Integer getRatio() { - return ratio; - } - - /** - * Sets the value of the ratio property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRatio(Integer value) { - this.ratio = value; - } - - /** - * Gets the value of the type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getType() { - return type; - } - - /** - * Sets the value of the type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setType(String value) { - this.type = value; - } - - /** - * Gets the value of the author property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAuthor() { - return author; - } - - /** - * Sets the value of the author property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAuthor(String value) { - this.author = value; - } - -} diff --git a/src/main/java/mkopec/summ/pscapi/xml/Text.java b/src/main/java/mkopec/summ/pscapi/xml/Text.java deleted file mode 100644 index e5612c7..0000000 --- a/src/main/java/mkopec/summ/pscapi/xml/Text.java +++ /dev/null @@ -1,253 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.22 at 12:56:02 PM CEST -// - - -package mkopec.summ.pscapi.xml; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.datatype.XMLGregorianCalendar; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="date" type="{http://www.w3.org/2001/XMLSchema}date"/> - * <element name="title" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="section"> - * <simpleType> - * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> - * <enumeration value="Ekonomia"/> - * <enumeration value="Kraj"/> - * <enumeration value="Kultura"/> - * <enumeration value="Nauka i Technika"/> - * <enumeration value="Prawo"/> - * <enumeration value="Publicystyka, Opinie"/> - * <enumeration value="Sport"/> - * </restriction> - * </simpleType> - * </element> - * <element name="authors" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="body" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="summaries" type="{}Summaries" minOccurs="0"/> - * </sequence> - * <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" /> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "date", - "title", - "section", - "authors", - "body", - "summaries" -}) -@XmlRootElement(name = "text") -public class Text { - - @XmlElement(required = true) - @XmlSchemaType(name = "date") - protected XMLGregorianCalendar date; - @XmlElement(required = true) - protected String title; - @XmlElement(required = true) - protected String section; - @XmlElement(required = true) - protected String authors; - @XmlElement(required = true) - protected String body; - protected Summaries summaries; - @XmlAttribute(name = "id") - protected String id; - - /** - * Gets the value of the date property. - * - * @return - * possible object is - * {@link XMLGregorianCalendar } - * - */ - public XMLGregorianCalendar getDate() { - return date; - } - - /** - * Sets the value of the date property. - * - * @param value - * allowed object is - * {@link XMLGregorianCalendar } - * - */ - public void setDate(XMLGregorianCalendar value) { - this.date = value; - } - - /** - * Gets the value of the title property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTitle() { - return title; - } - - /** - * Sets the value of the title property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTitle(String value) { - this.title = value; - } - - /** - * Gets the value of the section property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSection() { - return section; - } - - /** - * Sets the value of the section property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSection(String value) { - this.section = value; - } - - /** - * Gets the value of the authors property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAuthors() { - return authors; - } - - /** - * Sets the value of the authors property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAuthors(String value) { - this.authors = value; - } - - /** - * Gets the value of the body property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getBody() { - return body; - } - - /** - * Sets the value of the body property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setBody(String value) { - this.body = value; - } - - /** - * Gets the value of the summaries property. - * - * @return - * possible object is - * {@link Summaries } - * - */ - public Summaries getSummaries() { - return summaries; - } - - /** - * Sets the value of the summaries property. - * - * @param value - * allowed object is - * {@link Summaries } - * - */ - public void setSummaries(Summaries value) { - this.summaries = value; - } - - /** - * Gets the value of the id property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getId() { - return id; - } - - /** - * Sets the value of the id property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setId(String value) { - this.id = value; - } - -} diff --git a/src/main/java/pl/waw/ipipan/zil/summ/pscapi/io/PSC_IO.java b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/io/PSC_IO.java new file mode 100644 index 0000000..562e920 --- /dev/null +++ b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/io/PSC_IO.java @@ -0,0 +1,45 @@ +package pl.waw.ipipan.zil.summ.pscapi.io; + +import java.io.File; +import java.io.IOException; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import pl.waw.ipipan.zil.summ.pscapi.xml.Text; + +public class PSC_IO { + + private final static Logger LOG = LogManager.getLogger(PSC_IO.class); + + public static Text readText(String testFilePath) throws IOException, JAXBException { + return readText(new File(testFilePath)); + } + + public static Text readText(File file) throws IOException, JAXBException { + LOG.debug("Reading text from file: " + file); + if (!file.isFile()) { + LOG.error("Error reading text - file not found: " + file.getPath()); + throw new IOException("File not found: " + file.getPath()); + } + JAXBContext jc = JAXBContext.newInstance(Text.class); + Unmarshaller unmarshaller = jc.createUnmarshaller(); + Text text = (Text) unmarshaller.unmarshal(file); + + return text; + } + + public static void saveText(Text text, String targetPath) throws JAXBException { + LOG.debug("Saving text to file: " + targetPath); + + JAXBContext jc = JAXBContext.newInstance(Text.class); + Marshaller marshaller = jc.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + marshaller.marshal(text, new File(targetPath)); + } +} diff --git a/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Adapter1.java b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Adapter1.java new file mode 100644 index 0000000..6baec88 --- /dev/null +++ b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Adapter1.java @@ -0,0 +1,29 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.07.22 at 12:56:02 PM CEST +// + + +package pl.waw.ipipan.zil.summ.pscapi.xml; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +public class Adapter1 + extends XmlAdapter<String, Integer> +{ + + + public Integer unmarshal(String value) { + return new Integer(value); + } + + public String marshal(Integer value) { + if (value == null) { + return null; + } + return value.toString(); + } + +} diff --git a/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Adapter2.java b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Adapter2.java new file mode 100644 index 0000000..c8a5abb --- /dev/null +++ b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Adapter2.java @@ -0,0 +1,29 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.07.22 at 12:56:02 PM CEST +// + + +package pl.waw.ipipan.zil.summ.pscapi.xml; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +public class Adapter2 + extends XmlAdapter<String, Integer> +{ + + + public Integer unmarshal(String value) { + return new Integer(value); + } + + public String marshal(Integer value) { + if (value == null) { + return null; + } + return value.toString(); + } + +} diff --git a/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/ObjectFactory.java b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/ObjectFactory.java new file mode 100644 index 0000000..5cada92 --- /dev/null +++ b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/ObjectFactory.java @@ -0,0 +1,79 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.07.22 at 12:56:02 PM CEST +// + + +package pl.waw.ipipan.zil.summ.pscapi.xml; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the mkopec.summ.pscapi.xml package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: mkopec.summ.pscapi.xml + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Text } + * + */ + public Text createText() { + return new Text(); + } + + /** + * Create an instance of {@link Summaries } + * + */ + public Summaries createSummaries() { + return new Summaries(); + } + + /** + * Create an instance of {@link Summary } + * + */ + public Summary createSummary() { + return new Summary(); + } + + /** + * Create an instance of {@link Span } + * + */ + public Span createSpan() { + return new Span(); + } + + /** + * Create an instance of {@link Spans } + * + */ + public Spans createSpans() { + return new Spans(); + } + +} diff --git a/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Span.java b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Span.java new file mode 100644 index 0000000..60861b3 --- /dev/null +++ b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Span.java @@ -0,0 +1,127 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.07.22 at 12:56:02 PM CEST +// + + +package pl.waw.ipipan.zil.summ.pscapi.xml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * <p>Java class for Span complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="Span"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <attribute name="start" type="{http://www.w3.org/2001/XMLSchema}integer" /> + * <attribute name="end" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" /> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Span", propOrder = { + "content" +}) +public class Span { + + @XmlValue + protected String content; + @XmlAttribute(name = "start") + @XmlJavaTypeAdapter(Adapter1 .class) + @XmlSchemaType(name = "integer") + protected Integer start; + @XmlAttribute(name = "end") + @XmlJavaTypeAdapter(Adapter2 .class) + @XmlSchemaType(name = "positiveInteger") + protected Integer end; + + /** + * Gets the value of the content property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getContent() { + return content; + } + + /** + * Sets the value of the content property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContent(String value) { + this.content = value; + } + + /** + * Gets the value of the start property. + * + * @return + * possible object is + * {@link String } + * + */ + public Integer getStart() { + return start; + } + + /** + * Sets the value of the start property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStart(Integer value) { + this.start = value; + } + + /** + * Gets the value of the end property. + * + * @return + * possible object is + * {@link String } + * + */ + public Integer getEnd() { + return end; + } + + /** + * Sets the value of the end property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEnd(Integer value) { + this.end = value; + } + +} diff --git a/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/SpanType.java b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/SpanType.java new file mode 100644 index 0000000..6868d13 --- /dev/null +++ b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/SpanType.java @@ -0,0 +1,127 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.07.22 at 12:53:09 PM CEST +// + + +package pl.waw.ipipan.zil.summ.pscapi.xml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * <p>Java class for SpanType complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="SpanType"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <attribute name="start" type="{http://www.w3.org/2001/XMLSchema}integer" /> + * <attribute name="end" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" /> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SpanType", propOrder = { + "content" +}) +public class SpanType { + + @XmlValue + protected String content; + @XmlAttribute(name = "start") + @XmlJavaTypeAdapter(Adapter1 .class) + @XmlSchemaType(name = "integer") + protected Integer start; + @XmlAttribute(name = "end") + @XmlJavaTypeAdapter(Adapter2 .class) + @XmlSchemaType(name = "positiveInteger") + protected Integer end; + + /** + * Gets the value of the content property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getContent() { + return content; + } + + /** + * Sets the value of the content property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContent(String value) { + this.content = value; + } + + /** + * Gets the value of the start property. + * + * @return + * possible object is + * {@link String } + * + */ + public Integer getStart() { + return start; + } + + /** + * Sets the value of the start property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStart(Integer value) { + this.start = value; + } + + /** + * Gets the value of the end property. + * + * @return + * possible object is + * {@link String } + * + */ + public Integer getEnd() { + return end; + } + + /** + * Sets the value of the end property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEnd(Integer value) { + this.end = value; + } + +} diff --git a/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Spans.java b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Spans.java new file mode 100644 index 0000000..fbe83c3 --- /dev/null +++ b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Spans.java @@ -0,0 +1,76 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.07.22 at 12:56:02 PM CEST +// + + +package pl.waw.ipipan.zil.summ.pscapi.xml; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for Spans complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="Spans"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="span" type="{}Span" maxOccurs="unbounded"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Spans", propOrder = { + "span" +}) +public class Spans { + + @XmlElement(required = true) + protected List<Span> span; + + /** + * Gets the value of the span property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the span property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getSpan().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Span } + * + * + */ + public List<Span> getSpan() { + if (span == null) { + span = new ArrayList<Span>(); + } + return this.span; + } + +} diff --git a/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Summaries.java b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Summaries.java new file mode 100644 index 0000000..a2b192d --- /dev/null +++ b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Summaries.java @@ -0,0 +1,74 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.07.22 at 12:56:02 PM CEST +// + + +package pl.waw.ipipan.zil.summ.pscapi.xml; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for Summaries complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="Summaries"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="summary" type="{}Summary" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Summaries", propOrder = { + "summary" +}) +public class Summaries { + + protected List<Summary> summary; + + /** + * Gets the value of the summary property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the summary property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getSummary().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Summary } + * + * + */ + public List<Summary> getSummary() { + if (summary == null) { + summary = new ArrayList<Summary>(); + } + return this.summary; + } + +} diff --git a/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Summary.java b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Summary.java new file mode 100644 index 0000000..b7c45e4 --- /dev/null +++ b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Summary.java @@ -0,0 +1,195 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.07.22 at 12:56:02 PM CEST +// + + +package pl.waw.ipipan.zil.summ.pscapi.xml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * <p>Java class for Summary complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="Summary"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="body" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="spans" type="{}Spans" minOccurs="0"/> + * </sequence> + * <attribute name="ratio"> + * <simpleType> + * <restriction base="{http://www.w3.org/2001/XMLSchema}positiveInteger"> + * <enumeration value="20"/> + * <enumeration value="10"/> + * <enumeration value="5"/> + * </restriction> + * </simpleType> + * </attribute> + * <attribute name="type"> + * <simpleType> + * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> + * <enumeration value="extract"/> + * <enumeration value="abstract"/> + * </restriction> + * </simpleType> + * </attribute> + * <attribute name="author" type="{http://www.w3.org/2001/XMLSchema}string" /> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Summary", propOrder = { + "body", + "spans" +}) +public class Summary { + + @XmlElement(required = true) + protected String body; + protected Spans spans; + @XmlAttribute(name = "ratio") + @XmlJavaTypeAdapter(Adapter2 .class) + protected Integer ratio; + @XmlAttribute(name = "type") + protected String type; + @XmlAttribute(name = "author") + protected String author; + + /** + * Gets the value of the body property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBody() { + return body; + } + + /** + * Sets the value of the body property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBody(String value) { + this.body = value; + } + + /** + * Gets the value of the spans property. + * + * @return + * possible object is + * {@link Spans } + * + */ + public Spans getSpans() { + return spans; + } + + /** + * Sets the value of the spans property. + * + * @param value + * allowed object is + * {@link Spans } + * + */ + public void setSpans(Spans value) { + this.spans = value; + } + + /** + * Gets the value of the ratio property. + * + * @return + * possible object is + * {@link String } + * + */ + public Integer getRatio() { + return ratio; + } + + /** + * Sets the value of the ratio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRatio(Integer value) { + this.ratio = value; + } + + /** + * Gets the value of the type property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Gets the value of the author property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthor() { + return author; + } + + /** + * Sets the value of the author property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthor(String value) { + this.author = value; + } + +} diff --git a/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Text.java b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Text.java new file mode 100644 index 0000000..6a28f23 --- /dev/null +++ b/src/main/java/pl/waw/ipipan/zil/summ/pscapi/xml/Text.java @@ -0,0 +1,253 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.07.22 at 12:56:02 PM CEST +// + + +package pl.waw.ipipan.zil.summ.pscapi.xml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.datatype.XMLGregorianCalendar; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="date" type="{http://www.w3.org/2001/XMLSchema}date"/> + * <element name="title" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="section"> + * <simpleType> + * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> + * <enumeration value="Ekonomia"/> + * <enumeration value="Kraj"/> + * <enumeration value="Kultura"/> + * <enumeration value="Nauka i Technika"/> + * <enumeration value="Prawo"/> + * <enumeration value="Publicystyka, Opinie"/> + * <enumeration value="Sport"/> + * </restriction> + * </simpleType> + * </element> + * <element name="authors" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="body" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="summaries" type="{}Summaries" minOccurs="0"/> + * </sequence> + * <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" /> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "date", + "title", + "section", + "authors", + "body", + "summaries" +}) +@XmlRootElement(name = "text") +public class Text { + + @XmlElement(required = true) + @XmlSchemaType(name = "date") + protected XMLGregorianCalendar date; + @XmlElement(required = true) + protected String title; + @XmlElement(required = true) + protected String section; + @XmlElement(required = true) + protected String authors; + @XmlElement(required = true) + protected String body; + protected Summaries summaries; + @XmlAttribute(name = "id") + protected String id; + + /** + * Gets the value of the date property. + * + * @return + * possible object is + * {@link XMLGregorianCalendar } + * + */ + public XMLGregorianCalendar getDate() { + return date; + } + + /** + * Sets the value of the date property. + * + * @param value + * allowed object is + * {@link XMLGregorianCalendar } + * + */ + public void setDate(XMLGregorianCalendar value) { + this.date = value; + } + + /** + * Gets the value of the title property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTitle() { + return title; + } + + /** + * Sets the value of the title property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTitle(String value) { + this.title = value; + } + + /** + * Gets the value of the section property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSection() { + return section; + } + + /** + * Sets the value of the section property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSection(String value) { + this.section = value; + } + + /** + * Gets the value of the authors property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthors() { + return authors; + } + + /** + * Sets the value of the authors property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAuthors(String value) { + this.authors = value; + } + + /** + * Gets the value of the body property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBody() { + return body; + } + + /** + * Sets the value of the body property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBody(String value) { + this.body = value; + } + + /** + * Gets the value of the summaries property. + * + * @return + * possible object is + * {@link Summaries } + * + */ + public Summaries getSummaries() { + return summaries; + } + + /** + * Sets the value of the summaries property. + * + * @param value + * allowed object is + * {@link Summaries } + * + */ + public void setSummaries(Summaries value) { + this.summaries = value; + } + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + +} diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties deleted file mode 100644 index d726a06..0000000 --- a/src/main/resources/log4j.properties +++ /dev/null @@ -1,6 +0,0 @@ -log4j.rootCategory=DEBUG, CONSOLE - -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender -log4j.appender.CONSOLE.Threshold=DEBUG -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=[%-5p] %d{HH:mm:ss} %C{1}: %m%n diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml new file mode 100644 index 0000000..e43e1b9 --- /dev/null +++ b/src/main/resources/log4j2.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Configuration status="WARN"> + <Appenders> + <Console name="Console" target="SYSTEM_OUT"> + <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> + </Console> + </Appenders> + <Loggers> + <Root level="error"> + <AppenderRef ref="Console" /> + </Root> + </Loggers> +</Configuration> \ No newline at end of file diff --git a/src/test/java/mkopec/summ/pscapi/io/ReadTest.java b/src/test/java/mkopec/summ/pscapi/io/ReadTest.java deleted file mode 100644 index 18a1922..0000000 --- a/src/test/java/mkopec/summ/pscapi/io/ReadTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package mkopec.summ.pscapi.io; - -import java.io.File; -import java.io.IOException; - -import javax.xml.bind.JAXBException; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -public class ReadTest { - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - private static final String TEST_FILE_PATH = ReadTest.class.getResource( - new File("/sample_texts", "199704210011.xml").getPath()).getFile(); - - @Test - public void testReadPath() throws IOException, JAXBException { - PSC_IO.readText(TEST_FILE_PATH); - } - - @Test - public void testReadFile() throws IOException, JAXBException { - PSC_IO.readText(new File(TEST_FILE_PATH)); - } - - @Test - public void testReadInvalidFile() throws IOException, JAXBException { - thrown.expect(IOException.class); - PSC_IO.readText(new File(TEST_FILE_PATH + "xxx")); - } - - @Test - public void testReadInvalidPath() throws IOException, JAXBException { - thrown.expect(IOException.class); - PSC_IO.readText(TEST_FILE_PATH + "xxx"); - } -} diff --git a/src/test/java/pl/waw/ipipan/zil/summ/pscapi/io/ReadTest.java b/src/test/java/pl/waw/ipipan/zil/summ/pscapi/io/ReadTest.java new file mode 100644 index 0000000..96b702c --- /dev/null +++ b/src/test/java/pl/waw/ipipan/zil/summ/pscapi/io/ReadTest.java @@ -0,0 +1,43 @@ +package pl.waw.ipipan.zil.summ.pscapi.io; + +import java.io.File; +import java.io.IOException; + +import javax.xml.bind.JAXBException; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import pl.waw.ipipan.zil.summ.pscapi.io.PSC_IO; + +public class ReadTest { + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + private static final String TEST_FILE_PATH = ReadTest.class.getResource( + new File("/sample_texts", "199704210011.xml").getPath()).getFile(); + + @Test + public void testReadPath() throws IOException, JAXBException { + PSC_IO.readText(TEST_FILE_PATH); + } + + @Test + public void testReadFile() throws IOException, JAXBException { + PSC_IO.readText(new File(TEST_FILE_PATH)); + } + + @Test + public void testReadInvalidFile() throws IOException, JAXBException { + thrown.expect(IOException.class); + PSC_IO.readText(new File(TEST_FILE_PATH + "xxx")); + } + + @Test + public void testReadInvalidPath() throws IOException, JAXBException { + thrown.expect(IOException.class); + PSC_IO.readText(TEST_FILE_PATH + "xxx"); + } +} -- libgit2 0.22.2