diff --git a/src/main/java/ch/eitchnet/xmlpers/api/ParserFactory.java b/src/main/java/ch/eitchnet/xmlpers/api/ParserFactory.java index b1ba612cf..003b1236d 100644 --- a/src/main/java/ch/eitchnet/xmlpers/api/ParserFactory.java +++ b/src/main/java/ch/eitchnet/xmlpers/api/ParserFactory.java @@ -15,7 +15,6 @@ */ package ch.eitchnet.xmlpers.api; - public interface ParserFactory { public DomParser getDomParser(); diff --git a/src/main/java/ch/eitchnet/xmlpers/api/PersistenceManager.java b/src/main/java/ch/eitchnet/xmlpers/api/PersistenceManager.java index 2790a394c..e19b71521 100644 --- a/src/main/java/ch/eitchnet/xmlpers/api/PersistenceManager.java +++ b/src/main/java/ch/eitchnet/xmlpers/api/PersistenceManager.java @@ -15,7 +15,6 @@ */ package ch.eitchnet.xmlpers.api; - /** * @author Robert von Burg * @@ -23,10 +22,10 @@ package ch.eitchnet.xmlpers.api; public interface PersistenceManager { public static final String DEFAULT_REALM = "defaultRealm"; //$NON-NLS-1$ - + public PersistenceContextFactoryDelegator getCtxFactory(); - + public PersistenceTransaction openTx(); - + public PersistenceTransaction openTx(String realm); } diff --git a/src/main/java/ch/eitchnet/xmlpers/objref/LockableObject.java b/src/main/java/ch/eitchnet/xmlpers/objref/LockableObject.java index 760b8234f..545de62d7 100644 --- a/src/main/java/ch/eitchnet/xmlpers/objref/LockableObject.java +++ b/src/main/java/ch/eitchnet/xmlpers/objref/LockableObject.java @@ -48,11 +48,11 @@ public class LockableObject { if (!this.lock.tryLock(tryLockTime, TimeUnit.MILLISECONDS)) { String msg = "Failed to acquire lock after {0} for {1}"; //$NON-NLS-1$ - msg = MessageFormat.format(msg, StringHelper.formatMillisecondsDuration(tryLockTime), this.toString()); + msg = MessageFormat.format(msg, StringHelper.formatMillisecondsDuration(tryLockTime), toString()); throw new XmlPersistenceException(msg); } if (logger.isDebugEnabled()) - logger.debug("locked " + this.toString()); //$NON-NLS-1$ + logger.debug("locked " + toString()); //$NON-NLS-1$ } catch (InterruptedException e) { throw new XmlPersistenceException("Thread interrupted: " + e.getMessage(), e); //$NON-NLS-1$ } @@ -64,6 +64,6 @@ public class LockableObject { public void unlock() { this.lock.unlock(); if (logger.isDebugEnabled()) - logger.debug("unlocking " + this.toString()); //$NON-NLS-1$ + logger.debug("unlocking " + toString()); //$NON-NLS-1$ } } diff --git a/src/main/java/ch/eitchnet/xmlpers/objref/SubTypeRef.java b/src/main/java/ch/eitchnet/xmlpers/objref/SubTypeRef.java index f77e274ef..ed792d5f5 100644 --- a/src/main/java/ch/eitchnet/xmlpers/objref/SubTypeRef.java +++ b/src/main/java/ch/eitchnet/xmlpers/objref/SubTypeRef.java @@ -72,7 +72,7 @@ public class SubTypeRef extends ObjectRef { public File getPath(PathBuilder pathBuilder) { return pathBuilder.getSubTypePath(this.type, this.subType); } - + @Override public PersistenceContext createPersistenceContext(PersistenceTransaction tx) { String msg = MessageFormat.format("{0} is not a leaf and can thus not have a Persistence Context", getName()); //$NON-NLS-1$ diff --git a/src/main/java/javanet/staxutils/Indentation.java b/src/main/java/javanet/staxutils/Indentation.java index e7f554b92..844513789 100644 --- a/src/main/java/javanet/staxutils/Indentation.java +++ b/src/main/java/javanet/staxutils/Indentation.java @@ -1,39 +1,36 @@ package javanet.staxutils; /** - * Characters that represent line breaks and indentation. These are represented - * as String-valued JavaBean properties. + * Characters that represent line breaks and indentation. These are represented as String-valued JavaBean properties. */ @SuppressWarnings("nls") public interface Indentation { - /** Two spaces; the default indentation. */ + /** Two spaces; the default indentation. */ public static final String DEFAULT_INDENT = " "; - /** - * Set the characters used for one level of indentation. The default is - * {@link #DEFAULT_INDENT}. "\t" is a popular alternative. - */ - void setIndent(String indent); + /** + * Set the characters used for one level of indentation. The default is {@link #DEFAULT_INDENT}. "\t" is a popular + * alternative. + */ + void setIndent(String indent); - /** The characters used for one level of indentation. */ - String getIndent(); + /** The characters used for one level of indentation. */ + String getIndent(); - /** - * "\n"; the normalized representation of end-of-line in XML. - */ - public static final String NORMAL_END_OF_LINE = "\n"; + /** + * "\n"; the normalized representation of end-of-line in XML. + */ + public static final String NORMAL_END_OF_LINE = "\n"; - /** - * Set the characters that introduce a new line. The default is - * {@link #NORMAL_END_OF_LINE}. - * {@link IndentingXMLStreamWriter#getLineSeparator}() is a popular - * alternative. - */ - public void setNewLine(String newLine); + /** + * Set the characters that introduce a new line. The default is {@link #NORMAL_END_OF_LINE}. + * {@link IndentingXMLStreamWriter#getLineSeparator}() is a popular alternative. + */ + public void setNewLine(String newLine); - /** The characters that introduce a new line. */ - String getNewLine(); + /** The characters that introduce a new line. */ + String getNewLine(); } diff --git a/src/main/java/javanet/staxutils/IndentingXMLStreamWriter.java b/src/main/java/javanet/staxutils/IndentingXMLStreamWriter.java index aa9ffc3b6..f4af62c62 100644 --- a/src/main/java/javanet/staxutils/IndentingXMLStreamWriter.java +++ b/src/main/java/javanet/staxutils/IndentingXMLStreamWriter.java @@ -37,9 +37,8 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** - * A filter that indents an XML stream. To apply it, construct a filter that - * contains another {@link XMLStreamWriter}, which you pass to the constructor. - * Then call methods of the filter instead of the contained stream. For example: + * A filter that indents an XML stream. To apply it, construct a filter that contains another {@link XMLStreamWriter}, + * which you pass to the constructor. Then call methods of the filter instead of the contained stream. For example: * *
  * {@link XMLStreamWriter} stream = ...
@@ -49,22 +48,19 @@ import javax.xml.stream.XMLStreamWriter;
  * 
* *

- * The filter inserts characters to format the document as an outline, with - * nested elements indented. Basically, it inserts a line break and whitespace - * before: + * The filter inserts characters to format the document as an outline, with nested elements indented. Basically, it + * inserts a line break and whitespace before: *

    *
  • each DTD, processing instruction or comment that's not preceded by data
  • *
  • each starting tag that's not preceded by data
  • *
  • each ending tag that's preceded by nested elements but not data
  • *
- * This works well with 'data-oriented' XML, wherein each element contains - * either data or nested elements but not both. It can work badly with other - * styles of XML. For example, the data in a 'mixed content' document are apt to - * be polluted with indentation characters. + * This works well with 'data-oriented' XML, wherein each element contains either data or nested elements but not both. + * It can work badly with other styles of XML. For example, the data in a 'mixed content' document are apt to be + * polluted with indentation characters. *

- * Indentation can be adjusted by setting the newLine and indent properties. But - * set them to whitespace only, for best results. Non-whitespace is apt to cause - * problems, for example when this class attempts to insert newLine before the + * Indentation can be adjusted by setting the newLine and indent properties. But set them to whitespace only, for best + * results. Non-whitespace is apt to cause problems, for example when this class attempts to insert newLine before the * root element. * * @author John Kristian @@ -72,307 +68,303 @@ import javax.xml.stream.XMLStreamWriter; @SuppressWarnings("nls") public class IndentingXMLStreamWriter extends StreamWriterDelegate implements Indentation { - public IndentingXMLStreamWriter(XMLStreamWriter out) { - this(out, DEFAULT_INDENT, NORMAL_END_OF_LINE); - } - - public IndentingXMLStreamWriter(XMLStreamWriter out, String indent) { - this(out, indent, NORMAL_END_OF_LINE); - } - - public IndentingXMLStreamWriter(XMLStreamWriter out, String indent, String newLine) { - super(out); - setIndent(indent); - setNewLine(newLine); - } + public IndentingXMLStreamWriter(XMLStreamWriter out) { + this(out, DEFAULT_INDENT, NORMAL_END_OF_LINE); + } - /** How deeply nested the current scope is. The root element is depth 1. */ - private int depth = 0; // document scope + public IndentingXMLStreamWriter(XMLStreamWriter out, String indent) { + this(out, indent, NORMAL_END_OF_LINE); + } - /** stack[depth] indicates what's been written into the current scope. */ - private int[] stack = new int[] { 0, 0, 0, 0 }; // nothing written yet + public IndentingXMLStreamWriter(XMLStreamWriter out, String indent, String newLine) { + super(out); + setIndent(indent); + setNewLine(newLine); + } - private static final int WROTE_MARKUP = 1; + /** How deeply nested the current scope is. The root element is depth 1. */ + private int depth = 0; // document scope - private static final int WROTE_DATA = 2; + /** stack[depth] indicates what's been written into the current scope. */ + private int[] stack = new int[] { 0, 0, 0, 0 }; // nothing written yet - private String indent = DEFAULT_INDENT; + private static final int WROTE_MARKUP = 1; - private String newLine = NORMAL_END_OF_LINE; + private static final int WROTE_DATA = 2; - /** newLine followed by copies of indent. */ - private char[] linePrefix = null; + private String indent = DEFAULT_INDENT; - @Override + private String newLine = NORMAL_END_OF_LINE; + + /** newLine followed by copies of indent. */ + private char[] linePrefix = null; + + @Override public void setIndent(String indent) { - if (!indent.equals(this.indent)) { - this.indent = indent; - this.linePrefix = null; - } - } + if (!indent.equals(this.indent)) { + this.indent = indent; + this.linePrefix = null; + } + } - @Override + @Override public String getIndent() { - return this.indent; - } + return this.indent; + } - @Override + @Override public void setNewLine(String newLine) { - if (!newLine.equals(this.newLine)) { - this.newLine = newLine; - this.linePrefix = null; - } - } + if (!newLine.equals(this.newLine)) { + this.newLine = newLine; + this.linePrefix = null; + } + } - /** - * @return System.getProperty("line.separator"); or - * {@link #NORMAL_END_OF_LINE} if that fails. - */ - public static String getLineSeparator() { - try { - return System.getProperty("line.separator"); - } catch (SecurityException ignored) { - // - } - return NORMAL_END_OF_LINE; - } + /** + * @return System.getProperty("line.separator"); or {@link #NORMAL_END_OF_LINE} if that fails. + */ + public static String getLineSeparator() { + try { + return System.getProperty("line.separator"); + } catch (SecurityException ignored) { + // + } + return NORMAL_END_OF_LINE; + } - @Override + @Override public String getNewLine() { - return this.newLine; - } + return this.newLine; + } - @Override + @Override public void writeStartDocument() throws XMLStreamException { - beforeMarkup(); - this.out.writeStartDocument(); - afterMarkup(); - } + beforeMarkup(); + this.out.writeStartDocument(); + afterMarkup(); + } - @Override + @Override public void writeStartDocument(String version) throws XMLStreamException { - beforeMarkup(); - this.out.writeStartDocument(version); - afterMarkup(); - } + beforeMarkup(); + this.out.writeStartDocument(version); + afterMarkup(); + } - @Override + @Override public void writeStartDocument(String encoding, String version) throws XMLStreamException { - beforeMarkup(); - this.out.writeStartDocument(encoding, version); - afterMarkup(); - } + beforeMarkup(); + this.out.writeStartDocument(encoding, version); + afterMarkup(); + } - @Override + @Override public void writeDTD(String dtd) throws XMLStreamException { - beforeMarkup(); - this.out.writeDTD(dtd); - afterMarkup(); - } + beforeMarkup(); + this.out.writeDTD(dtd); + afterMarkup(); + } - @Override + @Override public void writeProcessingInstruction(String target) throws XMLStreamException { - beforeMarkup(); - this.out.writeProcessingInstruction(target); - afterMarkup(); - } + beforeMarkup(); + this.out.writeProcessingInstruction(target); + afterMarkup(); + } - @Override + @Override public void writeProcessingInstruction(String target, String data) throws XMLStreamException { - beforeMarkup(); - this.out.writeProcessingInstruction(target, data); - afterMarkup(); - } + beforeMarkup(); + this.out.writeProcessingInstruction(target, data); + afterMarkup(); + } - @Override + @Override public void writeComment(String data) throws XMLStreamException { - beforeMarkup(); - this.out.writeComment(data); - afterMarkup(); - } + beforeMarkup(); + this.out.writeComment(data); + afterMarkup(); + } - @Override + @Override public void writeEmptyElement(String localName) throws XMLStreamException { - beforeMarkup(); - this.out.writeEmptyElement(localName); - afterMarkup(); - } + beforeMarkup(); + this.out.writeEmptyElement(localName); + afterMarkup(); + } - @Override + @Override public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException { - beforeMarkup(); - this.out.writeEmptyElement(namespaceURI, localName); - afterMarkup(); - } + beforeMarkup(); + this.out.writeEmptyElement(namespaceURI, localName); + afterMarkup(); + } - @Override - public void writeEmptyElement(String prefix, String localName, String namespaceURI) - throws XMLStreamException { - beforeMarkup(); - this.out.writeEmptyElement(prefix, localName, namespaceURI); - afterMarkup(); - } + @Override + public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { + beforeMarkup(); + this.out.writeEmptyElement(prefix, localName, namespaceURI); + afterMarkup(); + } - @Override + @Override public void writeStartElement(String localName) throws XMLStreamException { - beforeStartElement(); - this.out.writeStartElement(localName); - afterStartElement(); - } + beforeStartElement(); + this.out.writeStartElement(localName); + afterStartElement(); + } - @Override + @Override public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException { - beforeStartElement(); - this.out.writeStartElement(namespaceURI, localName); - afterStartElement(); - } + beforeStartElement(); + this.out.writeStartElement(namespaceURI, localName); + afterStartElement(); + } - @Override - public void writeStartElement(String prefix, String localName, String namespaceURI) - throws XMLStreamException { - beforeStartElement(); - this.out.writeStartElement(prefix, localName, namespaceURI); - afterStartElement(); - } + @Override + public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { + beforeStartElement(); + this.out.writeStartElement(prefix, localName, namespaceURI); + afterStartElement(); + } - @Override + @Override public void writeCharacters(String text) throws XMLStreamException { - this.out.writeCharacters(text); - afterData(); - } + this.out.writeCharacters(text); + afterData(); + } - @Override + @Override public void writeCharacters(char[] text, int start, int len) throws XMLStreamException { - this.out.writeCharacters(text, start, len); - afterData(); - } + this.out.writeCharacters(text, start, len); + afterData(); + } - @Override + @Override public void writeCData(String data) throws XMLStreamException { - this.out.writeCData(data); - afterData(); - } + this.out.writeCData(data); + afterData(); + } - @Override + @Override public void writeEntityRef(String name) throws XMLStreamException { - this.out.writeEntityRef(name); - afterData(); - } + this.out.writeEntityRef(name); + afterData(); + } - @Override + @Override public void writeEndElement() throws XMLStreamException { - beforeEndElement(); - this.out.writeEndElement(); - afterEndElement(); - } + beforeEndElement(); + this.out.writeEndElement(); + afterEndElement(); + } - @Override + @Override public void writeEndDocument() throws XMLStreamException { - try { - while (this.depth > 0) { - writeEndElement(); // indented - } - } catch (Exception ignored) { - ignored.printStackTrace(); - } - this.out.writeEndDocument(); - afterEndDocument(); - } + try { + while (this.depth > 0) { + writeEndElement(); // indented + } + } catch (Exception ignored) { + ignored.printStackTrace(); + } + this.out.writeEndDocument(); + afterEndDocument(); + } - /** Prepare to write markup, by writing a new line and indentation. */ - protected void beforeMarkup() { - int soFar = this.stack[this.depth]; - if ((soFar & WROTE_DATA) == 0 // no data in this scope - && (this.depth > 0 || soFar != 0)) // not the first line - { - try { - writeNewLine(this.depth); - if (this.depth > 0 && getIndent().length() > 0) { - afterMarkup(); // indentation was written - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } + /** Prepare to write markup, by writing a new line and indentation. */ + protected void beforeMarkup() { + int soFar = this.stack[this.depth]; + if ((soFar & WROTE_DATA) == 0 // no data in this scope + && (this.depth > 0 || soFar != 0)) // not the first line + { + try { + writeNewLine(this.depth); + if (this.depth > 0 && getIndent().length() > 0) { + afterMarkup(); // indentation was written + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } - /** Note that markup or indentation was written. */ - protected void afterMarkup() { - this.stack[this.depth] |= WROTE_MARKUP; - } + /** Note that markup or indentation was written. */ + protected void afterMarkup() { + this.stack[this.depth] |= WROTE_MARKUP; + } - /** Note that data were written. */ - protected void afterData() { - this.stack[this.depth] |= WROTE_DATA; - } + /** Note that data were written. */ + protected void afterData() { + this.stack[this.depth] |= WROTE_DATA; + } - /** Prepare to start an element, by allocating stack space. */ - protected void beforeStartElement() { - beforeMarkup(); - if (this.stack.length <= this.depth + 1) { - // Allocate more space for the stack: - int[] newStack = new int[this.stack.length * 2]; - System.arraycopy(this.stack, 0, newStack, 0, this.stack.length); - this.stack = newStack; - } - this.stack[this.depth + 1] = 0; // nothing written yet - } + /** Prepare to start an element, by allocating stack space. */ + protected void beforeStartElement() { + beforeMarkup(); + if (this.stack.length <= this.depth + 1) { + // Allocate more space for the stack: + int[] newStack = new int[this.stack.length * 2]; + System.arraycopy(this.stack, 0, newStack, 0, this.stack.length); + this.stack = newStack; + } + this.stack[this.depth + 1] = 0; // nothing written yet + } - /** Note that an element was started. */ - protected void afterStartElement() { - afterMarkup(); - ++this.depth; - } + /** Note that an element was started. */ + protected void afterStartElement() { + afterMarkup(); + ++this.depth; + } - /** Prepare to end an element, by writing a new line and indentation. */ - protected void beforeEndElement() { - if (this.depth > 0 && this.stack[this.depth] == WROTE_MARKUP) { // but not data - try { - writeNewLine(this.depth - 1); - } catch (Exception ignored) { - ignored.printStackTrace(); - } - } - } + /** Prepare to end an element, by writing a new line and indentation. */ + protected void beforeEndElement() { + if (this.depth > 0 && this.stack[this.depth] == WROTE_MARKUP) { // but not data + try { + writeNewLine(this.depth - 1); + } catch (Exception ignored) { + ignored.printStackTrace(); + } + } + } - /** Note that an element was ended. */ - protected void afterEndElement() { - if (this.depth > 0) { - --this.depth; - } - } + /** Note that an element was ended. */ + protected void afterEndElement() { + if (this.depth > 0) { + --this.depth; + } + } - /** Note that a document was ended. */ - protected void afterEndDocument() { - if (this.stack[this.depth = 0] == WROTE_MARKUP) { // but not data - try { - writeNewLine(0); - } catch (Exception ignored) { - ignored.printStackTrace(); - } - } - this.stack[this.depth] = 0; // start fresh - } + /** Note that a document was ended. */ + protected void afterEndDocument() { + if (this.stack[this.depth = 0] == WROTE_MARKUP) { // but not data + try { + writeNewLine(0); + } catch (Exception ignored) { + ignored.printStackTrace(); + } + } + this.stack[this.depth] = 0; // start fresh + } - /** Write a line separator followed by indentation. */ - protected void writeNewLine(int indentation) throws XMLStreamException { - final int newLineLength = getNewLine().length(); - final int prefixLength = newLineLength + (getIndent().length() * indentation); - if (prefixLength > 0) { - if (this.linePrefix == null) { - this.linePrefix = (getNewLine() + getIndent()).toCharArray(); - } - while (prefixLength > this.linePrefix.length) { - // make linePrefix longer: - char[] newPrefix = new char[newLineLength - + ((this.linePrefix.length - newLineLength) * 2)]; - System.arraycopy(this.linePrefix, 0, newPrefix, 0, this.linePrefix.length); - System.arraycopy(this.linePrefix, newLineLength, newPrefix, this.linePrefix.length, - this.linePrefix.length - newLineLength); - this.linePrefix = newPrefix; - } - this.out.writeCharacters(this.linePrefix, 0, prefixLength); - } - } + /** Write a line separator followed by indentation. */ + protected void writeNewLine(int indentation) throws XMLStreamException { + final int newLineLength = getNewLine().length(); + final int prefixLength = newLineLength + (getIndent().length() * indentation); + if (prefixLength > 0) { + if (this.linePrefix == null) { + this.linePrefix = (getNewLine() + getIndent()).toCharArray(); + } + while (prefixLength > this.linePrefix.length) { + // make linePrefix longer: + char[] newPrefix = new char[newLineLength + ((this.linePrefix.length - newLineLength) * 2)]; + System.arraycopy(this.linePrefix, 0, newPrefix, 0, this.linePrefix.length); + System.arraycopy(this.linePrefix, newLineLength, newPrefix, this.linePrefix.length, + this.linePrefix.length - newLineLength); + this.linePrefix = newPrefix; + } + this.out.writeCharacters(this.linePrefix, 0, prefixLength); + } + } } diff --git a/src/main/java/javanet/staxutils/helpers/StreamWriterDelegate.java b/src/main/java/javanet/staxutils/helpers/StreamWriterDelegate.java index 49e70d88e..9922aafa7 100644 --- a/src/main/java/javanet/staxutils/helpers/StreamWriterDelegate.java +++ b/src/main/java/javanet/staxutils/helpers/StreamWriterDelegate.java @@ -36,182 +36,178 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; /** - * Abstract class for writing filtered XML streams. This class provides methods - * that merely delegate to the contained stream. Subclasses should override some - * of these methods, and may also provide additional methods and fields. + * Abstract class for writing filtered XML streams. This class provides methods that merely delegate to the contained + * stream. Subclasses should override some of these methods, and may also provide additional methods and fields. * * @author John Kristian */ public abstract class StreamWriterDelegate implements XMLStreamWriter { - protected StreamWriterDelegate(XMLStreamWriter out) { - this.out = out; - } + protected StreamWriterDelegate(XMLStreamWriter out) { + this.out = out; + } - protected XMLStreamWriter out; + protected XMLStreamWriter out; - @Override + @Override public Object getProperty(String name) throws IllegalArgumentException { - return this.out.getProperty(name); - } + return this.out.getProperty(name); + } - @Override + @Override public NamespaceContext getNamespaceContext() { - return this.out.getNamespaceContext(); - } + return this.out.getNamespaceContext(); + } - @Override + @Override public void setNamespaceContext(NamespaceContext context) throws XMLStreamException { - this.out.setNamespaceContext(context); - } + this.out.setNamespaceContext(context); + } - @Override + @Override public void setDefaultNamespace(String uri) throws XMLStreamException { - this.out.setDefaultNamespace(uri); - } + this.out.setDefaultNamespace(uri); + } - @Override + @Override public void writeStartDocument() throws XMLStreamException { - this.out.writeStartDocument(); - } + this.out.writeStartDocument(); + } - @Override + @Override public void writeStartDocument(String version) throws XMLStreamException { - this.out.writeStartDocument(version); - } + this.out.writeStartDocument(version); + } - @Override + @Override public void writeStartDocument(String encoding, String version) throws XMLStreamException { - this.out.writeStartDocument(encoding, version); - } + this.out.writeStartDocument(encoding, version); + } - @Override + @Override public void writeDTD(String dtd) throws XMLStreamException { - this.out.writeDTD(dtd); - } + this.out.writeDTD(dtd); + } - @Override + @Override public void writeProcessingInstruction(String target) throws XMLStreamException { - this.out.writeProcessingInstruction(target); - } + this.out.writeProcessingInstruction(target); + } - @Override + @Override public void writeProcessingInstruction(String target, String data) throws XMLStreamException { - this.out.writeProcessingInstruction(target, data); - } + this.out.writeProcessingInstruction(target, data); + } - @Override + @Override public void writeComment(String data) throws XMLStreamException { - this.out.writeComment(data); - } + this.out.writeComment(data); + } - @Override + @Override public void writeEmptyElement(String localName) throws XMLStreamException { - this.out.writeEmptyElement(localName); - } + this.out.writeEmptyElement(localName); + } - @Override + @Override public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException { - this.out.writeEmptyElement(namespaceURI, localName); - } + this.out.writeEmptyElement(namespaceURI, localName); + } - @Override - public void writeEmptyElement(String prefix, String localName, String namespaceURI) - throws XMLStreamException { - this.out.writeEmptyElement(prefix, localName, namespaceURI); - } + @Override + public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { + this.out.writeEmptyElement(prefix, localName, namespaceURI); + } - @Override + @Override public void writeStartElement(String localName) throws XMLStreamException { - this.out.writeStartElement(localName); - } + this.out.writeStartElement(localName); + } - @Override + @Override public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException { - this.out.writeStartElement(namespaceURI, localName); - } + this.out.writeStartElement(namespaceURI, localName); + } - @Override - public void writeStartElement(String prefix, String localName, String namespaceURI) - throws XMLStreamException { - this.out.writeStartElement(prefix, localName, namespaceURI); - } + @Override + public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { + this.out.writeStartElement(prefix, localName, namespaceURI); + } - @Override + @Override public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException { - this.out.writeDefaultNamespace(namespaceURI); - } + this.out.writeDefaultNamespace(namespaceURI); + } - @Override + @Override public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException { - this.out.writeNamespace(prefix, namespaceURI); - } + this.out.writeNamespace(prefix, namespaceURI); + } - @Override + @Override public String getPrefix(String uri) throws XMLStreamException { - return this.out.getPrefix(uri); - } + return this.out.getPrefix(uri); + } - @Override + @Override public void setPrefix(String prefix, String uri) throws XMLStreamException { - this.out.setPrefix(prefix, uri); - } + this.out.setPrefix(prefix, uri); + } - @Override + @Override public void writeAttribute(String localName, String value) throws XMLStreamException { - this.out.writeAttribute(localName, value); - } + this.out.writeAttribute(localName, value); + } - @Override - public void writeAttribute(String namespaceURI, String localName, String value) - throws XMLStreamException { - this.out.writeAttribute(namespaceURI, localName, value); - } + @Override + public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException { + this.out.writeAttribute(namespaceURI, localName, value); + } - @Override + @Override public void writeAttribute(String prefix, String namespaceURI, String localName, String value) - throws XMLStreamException { - this.out.writeAttribute(prefix, namespaceURI, localName, value); - } + throws XMLStreamException { + this.out.writeAttribute(prefix, namespaceURI, localName, value); + } - @Override + @Override public void writeCharacters(String text) throws XMLStreamException { - this.out.writeCharacters(text); - } + this.out.writeCharacters(text); + } - @Override + @Override public void writeCharacters(char[] text, int start, int len) throws XMLStreamException { - this.out.writeCharacters(text, start, len); - } + this.out.writeCharacters(text, start, len); + } - @Override + @Override public void writeCData(String data) throws XMLStreamException { - this.out.writeCData(data); - } + this.out.writeCData(data); + } - @Override + @Override public void writeEntityRef(String name) throws XMLStreamException { - this.out.writeEntityRef(name); - } + this.out.writeEntityRef(name); + } - @Override + @Override public void writeEndElement() throws XMLStreamException { - this.out.writeEndElement(); - } + this.out.writeEndElement(); + } - @Override + @Override public void writeEndDocument() throws XMLStreamException { - this.out.writeEndDocument(); - } + this.out.writeEndDocument(); + } - @Override + @Override public void flush() throws XMLStreamException { - this.out.flush(); - } + this.out.flush(); + } - @Override + @Override public void close() throws XMLStreamException { - this.out.close(); - } + this.out.close(); + } } diff --git a/src/test/java/ch/eitchnet/xmlpers/test/LockingTest.java b/src/test/java/ch/eitchnet/xmlpers/test/LockingTest.java index 68de2d5a9..906d61a4c 100644 --- a/src/test/java/ch/eitchnet/xmlpers/test/LockingTest.java +++ b/src/test/java/ch/eitchnet/xmlpers/test/LockingTest.java @@ -60,7 +60,7 @@ public class LockingTest extends AbstractPersistenceTest { properties.setProperty(PersistenceConstants.PROP_LOCK_TIME_MILLIS, Long.toString(500L)); setup(properties); - this.waitForWorkersTime = LockableObject.getLockTime() + this.getWaitForWorkersTime() + 300L; + this.waitForWorkersTime = LockableObject.getLockTime() + getWaitForWorkersTime() + 300L; } @Test @@ -128,10 +128,10 @@ public class LockingTest extends AbstractPersistenceTest { private int runWorkers(List workers) throws InterruptedException { - this.setRun(true); + setRun(true); for (AbstractWorker worker : workers) { - worker.join(this.getWaitForWorkersTime() + 2000L); + worker.join(getWaitForWorkersTime() + 2000L); } int nrOfSuccess = 0; @@ -169,7 +169,7 @@ public class LockingTest extends AbstractPersistenceTest { public void run() { logger.info("Waiting for ok to work..."); //$NON-NLS-1$ - while (!LockingTest.this.isRun()) { + while (!isRun()) { try { Thread.sleep(10L); } catch (InterruptedException e) { diff --git a/src/test/java/ch/eitchnet/xmlpers/test/XmlTestMain.java b/src/test/java/ch/eitchnet/xmlpers/test/XmlTestMain.java index f05e83215..690cf4e6f 100644 --- a/src/test/java/ch/eitchnet/xmlpers/test/XmlTestMain.java +++ b/src/test/java/ch/eitchnet/xmlpers/test/XmlTestMain.java @@ -47,8 +47,8 @@ import org.xml.sax.helpers.DefaultHandler; import ch.eitchnet.utils.exceptions.XmlException; import ch.eitchnet.utils.helper.XmlHelper; import ch.eitchnet.xmlpers.test.model.ModelBuilder; -import ch.eitchnet.xmlpers.test.model.MyParameter; import ch.eitchnet.xmlpers.test.model.MyModel; +import ch.eitchnet.xmlpers.test.model.MyParameter; /** * @author Robert von Burg diff --git a/src/test/java/ch/eitchnet/xmlpers/test/impl/MyModelDomParser.java b/src/test/java/ch/eitchnet/xmlpers/test/impl/MyModelDomParser.java index f7ede8f27..30859879e 100644 --- a/src/test/java/ch/eitchnet/xmlpers/test/impl/MyModelDomParser.java +++ b/src/test/java/ch/eitchnet/xmlpers/test/impl/MyModelDomParser.java @@ -23,8 +23,8 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import ch.eitchnet.xmlpers.api.DomParser; -import ch.eitchnet.xmlpers.test.model.MyParameter; import ch.eitchnet.xmlpers.test.model.MyModel; +import ch.eitchnet.xmlpers.test.model.MyParameter; import ch.eitchnet.xmlpers.util.DomUtil; public class MyModelDomParser implements DomParser { diff --git a/src/test/java/ch/eitchnet/xmlpers/test/impl/MyModelSaxParser.java b/src/test/java/ch/eitchnet/xmlpers/test/impl/MyModelSaxParser.java index 1e8efcc2b..858be533a 100644 --- a/src/test/java/ch/eitchnet/xmlpers/test/impl/MyModelSaxParser.java +++ b/src/test/java/ch/eitchnet/xmlpers/test/impl/MyModelSaxParser.java @@ -23,8 +23,8 @@ import org.xml.sax.helpers.DefaultHandler; import ch.eitchnet.xmlpers.api.SaxParser; import ch.eitchnet.xmlpers.api.XmlPersistenceStreamWriter; -import ch.eitchnet.xmlpers.test.model.MyParameter; import ch.eitchnet.xmlpers.test.model.MyModel; +import ch.eitchnet.xmlpers.test.model.MyParameter; class MyModelSaxParser extends DefaultHandler implements SaxParser { diff --git a/src/test/java/ch/eitchnet/xmlpers/test/model/ModelBuilder.java b/src/test/java/ch/eitchnet/xmlpers/test/model/ModelBuilder.java index 229382476..be4d9ff78 100644 --- a/src/test/java/ch/eitchnet/xmlpers/test/model/ModelBuilder.java +++ b/src/test/java/ch/eitchnet/xmlpers/test/model/ModelBuilder.java @@ -46,7 +46,7 @@ public class ModelBuilder { public static MyModel createResource() { return createResource(RES_ID, RES_NAME, RES_TYPE); } - + public static MyModel createResource(String id) { return createResource(id, RES_NAME, RES_TYPE); } diff --git a/src/test/java/ch/eitchnet/xmlpers/test/model/MyModel.java b/src/test/java/ch/eitchnet/xmlpers/test/model/MyModel.java index f61a0fa62..2bac6fdf5 100644 --- a/src/test/java/ch/eitchnet/xmlpers/test/model/MyModel.java +++ b/src/test/java/ch/eitchnet/xmlpers/test/model/MyModel.java @@ -73,7 +73,8 @@ public class MyModel { } /** - * @param id the id to set + * @param id + * the id to set */ public void setId(String id) { this.id = id; @@ -87,7 +88,8 @@ public class MyModel { } /** - * @param name the name to set + * @param name + * the name to set */ public void setName(String name) { this.name = name; @@ -101,7 +103,8 @@ public class MyModel { } /** - * @param type the type to set + * @param type + * the type to set */ public void setType(String type) { this.type = type;