Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WFLY-4559 Introduce a new version of jboss-all.xml schema for Weld
- Loading branch information
Showing
6 changed files
with
153 additions
and
36 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
weld/src/main/java/org/jboss/as/weld/AbstractWeldJBossAllParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2015, Red Hat, Inc., and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jboss.as.weld; | ||
|
||
import org.jboss.staxmapper.XMLExtendedStreamReader; | ||
|
||
abstract class AbstractWeldJBossAllParser { | ||
|
||
protected Boolean getAttributeAsBoolean(XMLExtendedStreamReader reader, String attributeName) { | ||
for (int i = 0; i < reader.getAttributeCount(); i++) { | ||
final String name = reader.getAttributeLocalName(i); | ||
final String value = reader.getAttributeValue(i); | ||
if (attributeName.equals(name)) { | ||
return Boolean.valueOf(value); | ||
} | ||
} | ||
return null; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
weld/src/main/java/org/jboss/as/weld/WeldJBossAll10Parser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2013, Red Hat Inc., and individual contributors as indicated | ||
* by the @authors tag. See the copyright.txt 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.weld; | ||
|
||
import static org.jboss.as.weld.WeldResourceDefinition.NON_PORTABLE_MODE_ATTRIBUTE_NAME; | ||
import static org.jboss.as.weld.WeldResourceDefinition.REQUIRE_BEAN_DESCRIPTOR_ATTRIBUTE_NAME; | ||
|
||
import javax.xml.namespace.QName; | ||
import javax.xml.stream.XMLStreamException; | ||
|
||
import org.jboss.as.server.deployment.DeploymentUnit; | ||
import org.jboss.as.server.deployment.jbossallxml.JBossAllXMLParser; | ||
import org.jboss.staxmapper.XMLExtendedStreamReader; | ||
|
||
/** | ||
* Parses <code>jboss-all.xml</code> and creates {@link WeldJBossAllConfiguration} holding the parsed configuration. | ||
* | ||
* @author Jozef Hartinger | ||
* | ||
*/ | ||
class WeldJBossAll10Parser extends AbstractWeldJBossAllParser implements JBossAllXMLParser<WeldJBossAllConfiguration> { | ||
|
||
public static final String NAMESPACE = "urn:jboss:weld:1.0"; | ||
public static final QName ROOT_ELEMENT = new QName(NAMESPACE, "weld"); | ||
public static final WeldJBossAll10Parser INSTANCE = new WeldJBossAll10Parser(); | ||
|
||
private WeldJBossAll10Parser() { | ||
} | ||
|
||
@Override | ||
public WeldJBossAllConfiguration parse(XMLExtendedStreamReader reader, DeploymentUnit deploymentUnit) throws XMLStreamException { | ||
Boolean requireBeanDescriptor = getAttributeAsBoolean(reader, REQUIRE_BEAN_DESCRIPTOR_ATTRIBUTE_NAME); | ||
Boolean nonPortableMode = getAttributeAsBoolean(reader, NON_PORTABLE_MODE_ATTRIBUTE_NAME); | ||
return new WeldJBossAllConfiguration(requireBeanDescriptor, nonPortableMode, false); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
~ JBoss, Home of Professional Open Source. | ||
~ 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. | ||
--> | ||
|
||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
targetNamespace="urn:jboss:weld:1.1" | ||
xmlns="urn:jboss:weld:1.1" | ||
elementFormDefault="qualified" | ||
attributeFormDefault="unqualified" | ||
version="1.1"> | ||
|
||
<xs:element name="weld" type="configuration"/> | ||
|
||
<xs:complexType name="configuration"> | ||
<xs:attribute name="require-bean-descriptor" type="xs:boolean" default="false"> | ||
<xs:annotation> | ||
<xs:documentation>If true then implicit bean archives without bean descriptor file (beans.xml) are ignored by Weld</xs:documentation> | ||
</xs:annotation> | ||
</xs:attribute> | ||
<xs:attribute name="non-portable-mode" type="xs:boolean" default="false"> | ||
<xs:annotation> | ||
<xs:documentation>If true then the non-portable mode is enabled. The non-portable mode is suggested by the specification to overcome problems with legacy applications that do not use CDI SPI properly and may be rejected by more strict validation in CDI 1.1.</xs:documentation> | ||
</xs:annotation> | ||
</xs:attribute> | ||
<xs:attribute name="development-mode" type="xs:boolean" default="false"> | ||
<xs:annotation> | ||
<xs:documentation>Weld comes with a special mode for application development. When the development mode is enabled, certain built-in tools, which facilitate the development of CDI applications, are available. Setting this attribute to true activates the development mode.</xs:documentation> | ||
</xs:annotation> | ||
</xs:attribute> | ||
</xs:complexType> | ||
|
||
</xs:schema> |