Skip to content

Commit

Permalink
Separate legacy parser -- just warning / info atm.
Browse files Browse the repository at this point in the history
  • Loading branch information
alesj authored and n1hility committed Nov 9, 2011
1 parent cc78bb7 commit 7bfbdd9
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import org.jboss.as.pojo.descriptor.KernelDeploymentXmlDescriptor;
import org.jboss.as.pojo.descriptor.KernelDeploymentXmlDescriptorParser;
import org.jboss.as.pojo.descriptor.LegacyKernelDeploymentXmlDescriptorParser;
import org.jboss.as.server.deployment.Attachments;
import org.jboss.as.server.deployment.DeploymentPhaseContext;
import org.jboss.as.server.deployment.DeploymentUnit;
Expand Down Expand Up @@ -60,8 +61,10 @@ public class KernelDeploymentParsingProcessor implements DeploymentUnitProcessor
public KernelDeploymentParsingProcessor() {
final KernelDeploymentXmlDescriptorParser parser = new KernelDeploymentXmlDescriptorParser();
xmlMapper.registerRootElement(new QName(KernelDeploymentXmlDescriptorParser.NAMESPACE, "deployment"), parser);
xmlMapper.registerRootElement(new QName(KernelDeploymentXmlDescriptorParser.MC_NAMESPACE_1_0, "deployment"), parser);
xmlMapper.registerRootElement(new QName(KernelDeploymentXmlDescriptorParser.MC_NAMESPACE_2_0, "deployment"), parser);
// old MC parser -- just a warning / info atm
final LegacyKernelDeploymentXmlDescriptorParser legacy = new LegacyKernelDeploymentXmlDescriptorParser();
xmlMapper.registerRootElement(new QName(LegacyKernelDeploymentXmlDescriptorParser.MC_NAMESPACE_1_0, "deployment"), legacy);
xmlMapper.registerRootElement(new QName(LegacyKernelDeploymentXmlDescriptorParser.MC_NAMESPACE_2_0, "deployment"), legacy);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
*/
public class KernelDeploymentXmlDescriptorParser implements XMLElementReader<ParseResult<KernelDeploymentXmlDescriptor>>, XMLStreamConstants {
public static final String NAMESPACE = "urn:jboss:pojo:7.0";
public static final String MC_NAMESPACE_1_0 = "urn:jboss:bean-deployer:1.0";
public static final String MC_NAMESPACE_2_0 = "urn:jboss:bean-deployer:2.0";

private enum Element {
BEAN("bean"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2010, 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.as.pojo.descriptor;

import org.jboss.as.pojo.ParseResult;
import org.jboss.logging.Logger;
import org.jboss.staxmapper.XMLExtendedStreamReader;

import javax.xml.stream.XMLStreamException;

/**
* Parse legacy (1.0 and 2.0 schema) Microcontainer jboss-beans.xml.
*
* @author <a href="mailto:[email protected]">Ales Justin</a>
*/
public class LegacyKernelDeploymentXmlDescriptorParser extends KernelDeploymentXmlDescriptorParser {
private static final Logger log = Logger.getLogger(LegacyKernelDeploymentXmlDescriptorParser.class);

public static final String MC_NAMESPACE_1_0 = "urn:jboss:bean-deployer:1.0";
public static final String MC_NAMESPACE_2_0 = "urn:jboss:bean-deployer:2.0";

@Override
public void readElement(XMLExtendedStreamReader reader, ParseResult<KernelDeploymentXmlDescriptor> value) throws XMLStreamException {
log.info("Found legacy bean/pojo namespace: " + reader.getNamespaceURI() + " - might be missing some xml features (potential exceptions).");
super.readElement(reader, value);
}
}

0 comments on commit 7bfbdd9

Please sign in to comment.