Compare commits
28 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b4f7f3b9b | ||
|
|
e812a54c75 | ||
|
|
2f7468c66d | ||
|
|
6f6f379807 | ||
|
|
ede6b9dae1 | ||
|
|
ff96c29f8a | ||
|
|
149d37ddd2 | ||
|
|
e6fae2280c | ||
|
|
8f041518fb | ||
|
|
bfa6d320e6 | ||
|
|
8931e1f548 | ||
|
|
9d6f4ebde1 | ||
|
|
c85a561f24 | ||
|
|
97e0127e8d | ||
|
|
5019e52f83 | ||
|
|
a7fdcd2144 | ||
|
|
92b32b9305 | ||
|
|
8f0422d628 | ||
|
|
db4d9f0233 | ||
|
|
a47c0b7053 | ||
|
|
f3ffe3eac1 | ||
|
|
c22e7f21a5 | ||
|
|
583be9a4fd | ||
|
|
93c866d7df | ||
|
|
c834ce255a | ||
|
|
df7bfc8888 | ||
|
|
b963ac327a | ||
|
|
bf87f5a399 |
5 changed files with 3 additions and 460 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -1,5 +0,0 @@
|
|||
/common-2.2.1.zip
|
||||
/common-3.0.1.zip
|
||||
/common-3.0.2.zip
|
||||
/common-3.1.0.zip
|
||||
/common-3.3.0.zip
|
||||
3
dead.package
Normal file
3
dead.package
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
2017-04-30: Retired orphaned package, because it was orphaned for
|
||||
more than six weeks.
|
||||
|
||||
312
remove-xom.patch
312
remove-xom.patch
|
|
@ -1,312 +0,0 @@
|
|||
diff --git zanata-common-util/pom.xml zanata-common-util/pom.xml
|
||||
index 4586f63..ba563ab 100644
|
||||
--- zanata-common-util/pom.xml
|
||||
+++ zanata-common-util/pom.xml
|
||||
@@ -83,10 +83,6 @@
|
||||
<artifactId>stax-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
- <dependency>
|
||||
- <groupId>xom</groupId>
|
||||
- <artifactId>xom</artifactId>
|
||||
- </dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
diff --git zanata-common-util/src/main/java/org/zanata/common/util/ElementBuilder.java zanata-common-util/src/main/java/org/zanata/common/util/ElementBuilder.java
|
||||
deleted file mode 100644
|
||||
index ace5a04..0000000
|
||||
--- zanata-common-util/src/main/java/org/zanata/common/util/ElementBuilder.java
|
||||
+++ /dev/null
|
||||
@@ -1,212 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2013, Red Hat, Inc. and individual contributors
|
||||
- * as indicated by the @author tags. See the copyright.txt file in the
|
||||
- * distribution for a full listing of individual contributors.
|
||||
- *
|
||||
- * This is free software; you can redistribute it and/or modify it
|
||||
- * under the terms of the GNU Lesser General Public License as
|
||||
- * published by the Free Software Foundation; either version 2.1 of
|
||||
- * the License, or (at your option) any later version.
|
||||
- *
|
||||
- * This software is distributed in the hope that it will be useful,
|
||||
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
- * Lesser General Public License for more details.
|
||||
- *
|
||||
- * You should have received a copy of the GNU Lesser General Public
|
||||
- * License along with this software; if not, write to the Free
|
||||
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
||||
- */
|
||||
-
|
||||
-package org.zanata.common.util;
|
||||
-
|
||||
-import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
-import static javax.xml.stream.XMLStreamConstants.*;
|
||||
-
|
||||
-import java.util.Iterator;
|
||||
-
|
||||
-import javax.xml.namespace.QName;
|
||||
-import javax.xml.stream.XMLEventReader;
|
||||
-import javax.xml.stream.XMLStreamException;
|
||||
-import javax.xml.stream.XMLStreamReader;
|
||||
-import javax.xml.stream.events.Attribute;
|
||||
-import javax.xml.stream.events.Characters;
|
||||
-import javax.xml.stream.events.StartElement;
|
||||
-import javax.xml.stream.events.XMLEvent;
|
||||
-import javax.xml.transform.Transformer;
|
||||
-import javax.xml.transform.TransformerException;
|
||||
-import javax.xml.transform.dom.DOMResult;
|
||||
-import javax.xml.transform.stax.StAXSource;
|
||||
-
|
||||
-import nu.xom.Attribute.Type;
|
||||
-import nu.xom.Element;
|
||||
-import nu.xom.converters.DOMConverter;
|
||||
-
|
||||
-import org.w3c.dom.Document;
|
||||
-
|
||||
-/**
|
||||
- * ElementBuilder consumes a complete element from a StAX XMLStreamReader or
|
||||
- * XMLEventReader and returns it as a xom Element.
|
||||
- * <p>
|
||||
- * {@link nux.xom.io.StaxParser} implements a similar idea.
|
||||
- *
|
||||
- * @author Sean Flanigan <a
|
||||
- * href="mailto:sflaniga@redhat.com">sflaniga@redhat.com</a>
|
||||
- */
|
||||
-public class ElementBuilder {
|
||||
-
|
||||
- /**
|
||||
- * Converts the element and subelements at the reader's current position
|
||||
- * into a xom Element tree
|
||||
- *
|
||||
- * @param reader
|
||||
- * must be in START_ELEMENT state
|
||||
- * @return
|
||||
- * @throws XMLStreamException
|
||||
- */
|
||||
- public static Element buildElement(XMLStreamReader reader)
|
||||
- throws XMLStreamException {
|
||||
- int eventType = reader.getEventType();
|
||||
- assert eventType == START_ELEMENT;
|
||||
- String localName = reader.getLocalName();
|
||||
- String qualName = getName(reader.getPrefix(), localName);
|
||||
- Element xElem = new Element(qualName, reader.getNamespaceURI());
|
||||
- copyAttributes(reader, xElem);
|
||||
-
|
||||
- while (reader.hasNext() && eventType != END_ELEMENT) {
|
||||
- eventType = reader.next();
|
||||
- switch (eventType) {
|
||||
- case START_ELEMENT:
|
||||
- Element startElement = buildElement(reader);
|
||||
- xElem.appendChild(startElement);
|
||||
- break;
|
||||
- case END_ELEMENT:
|
||||
- break;
|
||||
- case CHARACTERS:
|
||||
- xElem.appendChild(reader.getText());
|
||||
- break;
|
||||
- case SPACE:
|
||||
- break;
|
||||
- default:
|
||||
- throw new RuntimeException("unhandled event type: " + eventType);
|
||||
- }
|
||||
- }
|
||||
- return xElem;
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Converts the element and subsequent subelements at the reader's current
|
||||
- * position into a xom Element tree
|
||||
- *
|
||||
- * @param startElem
|
||||
- * @param reader
|
||||
- * must be just past the START_ELEMENT event
|
||||
- * @return
|
||||
- * @throws XMLStreamException
|
||||
- */
|
||||
- public static Element buildElement(StartElement startElem,
|
||||
- XMLEventReader reader) throws XMLStreamException {
|
||||
- QName name = startElem.getName();
|
||||
- String qualName = getName(name);
|
||||
- Element xElem = new Element(qualName, name.getNamespaceURI());
|
||||
- copyAttributes(startElem, xElem);
|
||||
-
|
||||
- while (reader.hasNext() && !reader.peek().isEndElement()) {
|
||||
- XMLEvent event = reader.nextEvent();
|
||||
- if (event.isStartElement()) {
|
||||
- Element startElement =
|
||||
- buildElement(event.asStartElement(), reader);
|
||||
- xElem.appendChild(startElement);
|
||||
- } else if (event.isCharacters()) {
|
||||
- Characters characters = event.asCharacters();
|
||||
- if (!characters.isIgnorableWhiteSpace()) {
|
||||
- xElem.appendChild(characters.getData());
|
||||
- }
|
||||
- } else {
|
||||
- throw new RuntimeException("unhandled event type: "
|
||||
- + event.getEventType());
|
||||
- }
|
||||
- }
|
||||
- if (reader.hasNext())
|
||||
- reader.nextEvent();
|
||||
- return xElem;
|
||||
- }
|
||||
-
|
||||
- public static void copyAttributes(XMLStreamReader reader, Element toElem) {
|
||||
- assert reader.getEventType() == START_ELEMENT;
|
||||
- for (int i = 0; i < reader.getAttributeCount(); i++) {
|
||||
- String prefix = reader.getAttributePrefix(i);
|
||||
- String localName = reader.getAttributeLocalName(i);
|
||||
- String name = getName(prefix, localName);
|
||||
- String uri = reader.getAttributeNamespace(i);
|
||||
- String value = reader.getAttributeValue(i);
|
||||
- Type attrType = getAttributeType(reader.getAttributeType(i));
|
||||
- nu.xom.Attribute xAttr =
|
||||
- new nu.xom.Attribute(name, uri, value, attrType);
|
||||
- toElem.addAttribute(xAttr);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- public static void copyAttributes(StartElement fromElem, Element toElem) {
|
||||
- Iterator<Attribute> attributes = (Iterator<Attribute>) fromElem.getAttributes();
|
||||
- while (attributes.hasNext()) {
|
||||
- Attribute attr = attributes.next();
|
||||
- QName qName = attr.getName();
|
||||
- String name = getName(qName);
|
||||
- String uri = qName.getNamespaceURI();
|
||||
- String value = attr.getValue();
|
||||
- Type attrType = getAttributeType(attr.getDTDType());
|
||||
- nu.xom.Attribute xAttr =
|
||||
- new nu.xom.Attribute(name, uri, value, attrType);
|
||||
- toElem.addAttribute(xAttr);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private static String getName(String prefix, String localName) {
|
||||
- String xPrefix = isNullOrEmpty(prefix) ? "" : prefix + ":";
|
||||
- String prefixedName = xPrefix + localName;
|
||||
- return prefixedName;
|
||||
- }
|
||||
-
|
||||
- private static String getName(QName name) {
|
||||
- String prefix = name.getPrefix();
|
||||
- String xPrefix = isNullOrEmpty(prefix) ? "" : prefix + ":";
|
||||
- String prefixedName = xPrefix + name.getLocalPart();
|
||||
- return prefixedName;
|
||||
- }
|
||||
-
|
||||
- private static Type getAttributeType(String name) {
|
||||
- try {
|
||||
- if (name.equals("ENUMERATED"))
|
||||
- return Type.ENUMERATION;
|
||||
- return (Type) Type.class.getField(name).get(null);
|
||||
- } catch (NoSuchFieldException e) {
|
||||
- throw new RuntimeException("unknown DTD type: " + name);
|
||||
- } catch (IllegalAccessException e) {
|
||||
- throw new RuntimeException(e);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Converts the element and subelements at the reader's current position
|
||||
- * into a xom Element tree
|
||||
- *
|
||||
- * @param reader
|
||||
- * @param transformer
|
||||
- * the provided Transformer must support StAXSource
|
||||
- * @return
|
||||
- * @throws TransformerException
|
||||
- */
|
||||
- static nu.xom.Element buildElement(XMLStreamReader reader,
|
||||
- Transformer transformer) throws TransformerException {
|
||||
- DOMResult result = new DOMResult();
|
||||
- transformer.transform(new StAXSource(reader), result);
|
||||
- Document docNode = (Document) result.getNode();
|
||||
- org.w3c.dom.Element elem =
|
||||
- (org.w3c.dom.Element) docNode.getFirstChild();
|
||||
- nu.xom.Element element = DOMConverter.convert(elem);
|
||||
- return element;
|
||||
- }
|
||||
-
|
||||
-}
|
||||
diff --git zanata-common-util/src/test/java/org/zanata/common/util/ElementBuilderTest.java zanata-common-util/src/test/java/org/zanata/common/util/ElementBuilderTest.java
|
||||
deleted file mode 100644
|
||||
index d9b2b23..0000000
|
||||
--- zanata-common-util/src/test/java/org/zanata/common/util/ElementBuilderTest.java
|
||||
+++ /dev/null
|
||||
@@ -1,73 +0,0 @@
|
||||
-package org.zanata.common.util;
|
||||
-
|
||||
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
|
||||
-
|
||||
-import java.io.IOException;
|
||||
-import java.io.InputStream;
|
||||
-
|
||||
-import javax.xml.stream.XMLEventReader;
|
||||
-import javax.xml.stream.XMLInputFactory;
|
||||
-import javax.xml.stream.XMLStreamReader;
|
||||
-import javax.xml.stream.events.XMLEvent;
|
||||
-import javax.xml.transform.Transformer;
|
||||
-import javax.xml.transform.TransformerFactory;
|
||||
-
|
||||
-import org.junit.Before;
|
||||
-import org.junit.Ignore;
|
||||
-import org.junit.Test;
|
||||
-
|
||||
-public class ElementBuilderTest {
|
||||
-
|
||||
- @Before
|
||||
- public void before() throws IOException {
|
||||
- is = getClass().getResourceAsStream("ElementBuilderTest.xml");
|
||||
- }
|
||||
-
|
||||
- private XMLInputFactory xif = XMLInputFactory.newInstance();
|
||||
- private InputStream is;
|
||||
-
|
||||
- @Test
|
||||
- public void buildElementXMLStreamReader() throws Exception {
|
||||
- XMLStreamReader reader = xif.createXMLStreamReader(is);
|
||||
- while (reader.hasNext()) {
|
||||
- int eventType = reader.next();
|
||||
- if (eventType == START_ELEMENT
|
||||
- && reader.getLocalName().equals("tu")) {
|
||||
- ElementBuilder.buildElement(reader).toXML();
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Test
|
||||
- public void buildElementStartElementXMLEventReader() throws Exception {
|
||||
- XMLEventReader reader = xif.createXMLEventReader(is);
|
||||
- while (reader.hasNext()) {
|
||||
- XMLEvent event = reader.nextEvent();
|
||||
- if (event.isStartElement()
|
||||
- && event.asStartElement().getName().getLocalPart()
|
||||
- .equals("tu")) {
|
||||
- ElementBuilder.buildElement(event.asStartElement(), reader)
|
||||
- .toXML();
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Test
|
||||
- @Ignore
|
||||
- public void buildElementXMLStreamReaderTransformer() throws Exception {
|
||||
- // Nasty way to ensure that we get a Transformer which supports
|
||||
- // StAXSource:
|
||||
- System.setProperty("javax.xml.transform.TransformerFactory",
|
||||
- "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
|
||||
- Transformer t = TransformerFactory.newInstance().newTransformer();
|
||||
-
|
||||
- XMLStreamReader reader = xif.createXMLStreamReader(is);
|
||||
- while (reader.hasNext()) {
|
||||
- int eventType = reader.next();
|
||||
- if (eventType == START_ELEMENT
|
||||
- && reader.getLocalName().equals("tu")) {
|
||||
- ElementBuilder.buildElement(reader, t).toXML();
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
1
sources
1
sources
|
|
@ -1 +0,0 @@
|
|||
c425615b4aa15f2ccebf92dd3324fc33 common-3.3.0.zip
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
%global shortname common
|
||||
|
||||
%global submodule_util zanata-%{shortname}-util
|
||||
%global submodule_po zanata-adapter-po
|
||||
%global submodule_properties zanata-adapter-properties
|
||||
%global submodule_xliff zanata-adapter-xliff
|
||||
%global submodule_glossary zanata-adapter-glossary
|
||||
|
||||
Name: zanata-%{shortname}
|
||||
Version: 3.3.0
|
||||
Release: 4%{?dist}
|
||||
Summary: Zanata common modules
|
||||
|
||||
Group: Development/Libraries
|
||||
License: LGPLv2+
|
||||
URL: https://github.com/zanata/%{name}
|
||||
Source0: https://github.com/zanata/%{name}/archive/%{shortname}-%{version}.zip
|
||||
Patch0: remove-xom.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: maven-local
|
||||
BuildRequires: zanata-parent
|
||||
BuildRequires: mvn(net.sourceforge.findbugs:annotations)
|
||||
BuildRequires: zanata-api
|
||||
BuildRequires: openprops
|
||||
BuildRequires: jgettext
|
||||
BuildRequires: opencsv
|
||||
BuildRequires: jackson
|
||||
BuildRequires: guava
|
||||
BuildRequires: apache-commons-io
|
||||
BuildRequires: apache-commons-codec
|
||||
|
||||
Requires: zanata-api
|
||||
Requires: openprops
|
||||
Requires: jgettext
|
||||
Requires: opencsv
|
||||
Requires: slf4j
|
||||
Requires: jackson
|
||||
Requires: guava
|
||||
Requires: apache-commons-io
|
||||
Requires: apache-commons-codec
|
||||
|
||||
%description
|
||||
Zanata common modules
|
||||
|
||||
|
||||
%package javadoc
|
||||
Summary: Javadocs for %{name}
|
||||
Group: Documentation
|
||||
Requires: jpackage-utils
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description javadoc
|
||||
This package contains the API documentation for %{shortname}.
|
||||
This includes submodules:
|
||||
%{submodule_util},
|
||||
%{submodule_po},
|
||||
%{submodule_properties},
|
||||
%{submodule_xliff} and %{submodule_glossary}
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{shortname}-%{version}
|
||||
%patch0
|
||||
%pom_remove_dep com.google.code.findbugs:annotations %{submodule_util}
|
||||
%pom_xpath_inject "pom:dependencies" "<dependency><groupId>net.sourceforge.findbugs</groupId><artifactId>annotations</artifactId><version>2.0.2</version></dependency>" %{submodule_util}
|
||||
|
||||
%build
|
||||
%mvn_build
|
||||
|
||||
%install
|
||||
%mvn_install
|
||||
|
||||
%files -f .mfiles
|
||||
%dir %{_javadir}/%{name}
|
||||
%doc README.txt COPYING.LESSER COPYING.GPL
|
||||
|
||||
%files javadoc -f .mfiles-javadoc
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Jul 17 2014 Patrick Huang <pahuang@redhat.com> - 3.3.0-4
|
||||
- Remove xom dependency
|
||||
|
||||
* Thu Jun 05 2014 Patrick Huang <pahuang@redhat.com> - 3.3.0-3
|
||||
- Rebuild in f20
|
||||
|
||||
* Mon Jun 02 2014 Patrick Huang <pahuang@redhat.com> - 3.3.0-2
|
||||
- Remove xom version restriction
|
||||
|
||||
* Mon Jun 02 2014 Patrick Huang <pahuang@redhat.com> - 3.3.0-1
|
||||
- Upgrade to latest upstream version
|
||||
|
||||
* Fri Mar 28 2014 Michael Simacek <msimacek@redhat.com> - 3.1.0-6
|
||||
- Use Requires: java-headless rebuild (#1067528)
|
||||
|
||||
* Wed Jan 29 2014 Patrick Huang <pahuang@redhat.com> 3.1.0-5
|
||||
- require xom greater than specific version
|
||||
|
||||
* Wed Jan 29 2014 Patrick Huang <pahuang@redhat.com> 3.1.0-4
|
||||
- rebuild for xom fix
|
||||
|
||||
* Mon Jan 20 2014 Patrick Huang <pahuang@redhat.com> 3.1.0-3
|
||||
- Explicit listing BR and R
|
||||
|
||||
* Fri Jan 17 2014 Patrick Huang <pahuang@redhat.com> 3.1.0-2
|
||||
- Add requires
|
||||
|
||||
* Thu Jan 09 2014 Patrick Huang <pahuang@redhat.com> 3.1.0-1
|
||||
- Latest upstream version
|
||||
|
||||
* Wed Sep 4 2013 Patrick Huang <pahuang@redhat.com> 3.0.2-1
|
||||
- Latest upstream version
|
||||
|
||||
* Thu Aug 22 2013 Patrick Huang <pahuang@redhat.com> 3.0.1-1
|
||||
- Latest upstream version
|
||||
|
||||
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.1-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
* Fri May 3 2013 Patrick Huang <pahuang@redhat.com> 2.2.1-5
|
||||
- Minor cosmetic change
|
||||
|
||||
* Fri May 3 2013 Patrick Huang <pahuang@redhat.com> 2.2.1-4
|
||||
- Minor cosmetic change
|
||||
|
||||
* Fri May 3 2013 Patrick Huang <pahuang@redhat.com> 2.2.1-3
|
||||
- Remove javadoc subpackage require %{?_isa}
|
||||
- Change javadoc installation location
|
||||
- Change license to LGPLv2+
|
||||
|
||||
* Wed May 1 2013 Patrick Huang <pahuang@redhat.com> 2.2.1-2
|
||||
- Add missing pom for f19-
|
||||
|
||||
* Tue Mar 19 2013 Patrick Huang <pahuang@redhat.com> 2.2.1-1
|
||||
- Upstream version update
|
||||
|
||||
* Thu Feb 28 2013 Patrick Huang <pahuang@redhat.com> 2.2.0-1
|
||||
- Upstream version update
|
||||
|
||||
* Mon Feb 11 2013 Patrick Huang <pahuang@redhat.com> 2.1.1-1
|
||||
- Initial RPM package
|
||||
Loading…
Add table
Add a link
Reference in a new issue