[jboss-cvs] JBossAS SVN: r106787 - in projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata: jbossra/jbossra10 and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 16 11:44:28 EDT 2010
Author: maeste
Date: 2010-07-16 11:44:27 -0400 (Fri, 16 Jul 2010)
New Revision: 106787
Added:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/jbossra10/Tag.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/package.html
Modified:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/JbossRaParser.java
Log:
JBJCA-385: checkstyle
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/JbossRaParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/JbossRaParser.java 2010-07-16 15:42:56 UTC (rev 106786)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/JbossRaParser.java 2010-07-16 15:44:27 UTC (rev 106787)
@@ -24,7 +24,15 @@
import org.jboss.jca.common.metadata.MetadataParser;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.jboss.as.model.Domain;
+import org.jboss.as.model.Element;
+
/**
* A JbossRaParser.
*
@@ -44,7 +52,35 @@
@Override
public JbossRa parse(File xmlFile) throws Exception
{
- return null;
+ XMLInputFactory inputFactory=XMLInputFactory.newInstance();
+ InputStream input=new FileInputStream(xmlFile);
+ XMLStreamReader reader =inputFactory.createXMLStreamReader(input);
+
+ while (reader.hasNext()) {
+ switch (reader.nextTag()) {
+ case END_ELEMENT: {
+ // should mean we're done, so ignore it.
+ break;
+ }
+ case START_ELEMENT: {
+ if (Domain.NAMESPACES.contains(reader.getNamespaceURI())) {
+ switch (Element.forName(reader.getLocalName())) {
+ case SERVER_GROUPS: {
+ readServerGroupsElement(reader, domain);
+ break;
+ }
+ default: throw unexpectedElement(reader);
+ }
+ } else {
+ // handle foreign root elements
+ reader.handleAny(domain);
+ }
+ break;
+ }
+ default: throw new IllegalStateException();
+ }
+ }
+
}
}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/jbossra10/Tag.java (from rev 106786, projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/JbossRaParser.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/jbossra10/Tag.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/jbossra10/Tag.java 2010-07-16 15:44:27 UTC (rev 106787)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, 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.jboss.jca.common.metadata.jbossra.jbossra10;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+public enum Tag {
+// always first
+ UNKNOWN(null),
+
+ // domain 1.0 attributes in alpha order
+ NAME("name"),
+
+
+ ;
+
+ private final String name;
+
+ Tag(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the local name of this element.
+ *
+ * @return the local name
+ */
+ public String getLocalName() {
+ return name;
+ }
+
+ private static final Map<String, Tag> MAP;
+
+ static {
+ final Map<String, Tag> map = new HashMap<String, Tag>();
+ for (Tag element : values()) {
+ final String name = element.getLocalName();
+ if (name != null) map.put(name, element);
+ }
+ MAP = map;
+ }
+
+ public static Tag forName(String localName) {
+ final Tag element = MAP.get(localName);
+ return element == null ? UNKNOWN : element;
+ }
+
+}
Added: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/package.html
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/package.html (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/package.html 2010-07-16 15:44:27 UTC (rev 106787)
@@ -0,0 +1,3 @@
+<body>
+This package contains common metadatas fand parser for connector_1_*.xsd
+</body>
More information about the jboss-cvs-commits
mailing list