Package org.jboss.modules.xml
Class ModuleXmlParser
- java.lang.Object
-
- org.jboss.modules.xml.ModuleXmlParser
-
public final class ModuleXmlParser extends java.lang.Object
A fast, validatingmodule.xml
parser.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ModuleXmlParser.ResourceRootFactory
A factory for resource roots, based on a root path, loader path, and loader name.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
A_ACTIONS
private static java.lang.String
A_EXPORT
private static java.lang.String
A_NAME
private static java.lang.String
A_OPTIONAL
private static java.lang.String
A_PATH
private static java.lang.String
A_PERMISSION
private static java.lang.String
A_SERVICES
private static java.lang.String
A_SLOT
private static java.lang.String
A_TARGET_NAME
private static java.lang.String
A_TARGET_SLOT
private static java.lang.String
A_VALUE
private static java.security.AllPermission
ALL_PERMISSION
private static java.lang.String
D_EXPORT
private static java.lang.String
D_IMPORT
private static java.lang.String
D_NONE
(package private) static java.security.Permissions
DEFAULT_PERMISSION_COLLECTION
private static java.lang.String
E_ARTIFACT
private static java.lang.String
E_DEPENDENCIES
private static java.lang.String
E_EXCLUDE
private static java.lang.String
E_EXCLUDE_SET
private static java.lang.String
E_EXPORTS
private static java.lang.String
E_FILTER
private static java.lang.String
E_GRANT
private static java.lang.String
E_IMPORTS
private static java.lang.String
E_INCLUDE
private static java.lang.String
E_INCLUDE_SET
private static java.lang.String
E_MAIN_CLASS
private static java.lang.String
E_MODULE
private static java.lang.String
E_MODULE_ABSENT
private static java.lang.String
E_MODULE_ALIAS
private static java.lang.String
E_NATIVE_ARTIFACT
private static java.lang.String
E_PATH
private static java.lang.String
E_PATHS
private static java.lang.String
E_PERMISSIONS
private static java.lang.String
E_PROPERTIES
private static java.lang.String
E_PROPERTY
private static java.lang.String
E_RESOURCE_ROOT
private static java.lang.String
E_RESOURCES
private static java.lang.String
E_SYSTEM
private static java.util.List<java.lang.String>
LIST_A_NAME
private static java.util.List<java.lang.String>
LIST_A_NAME_A_SLOT
private static java.util.List<java.lang.String>
LIST_A_NAME_A_TARGET_NAME
private static java.util.List<java.lang.String>
LIST_A_PATH
private static java.util.List<java.lang.String>
LIST_A_PERMISSION_A_NAME
private static java.lang.String
MODULE_1_0
private static java.lang.String
MODULE_1_1
private static java.lang.String
MODULE_1_2
private static java.lang.String
MODULE_1_3
private static java.lang.String
MODULE_1_5
-
Constructor Summary
Constructors Modifier Constructor Description private
ModuleXmlParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
assertNoAttributes(XmlPullParser reader)
private static void
copy(java.io.InputStream in, java.io.OutputStream out)
private static void
createMavenNativeArtifactLoader(MavenResolver mavenResolver, java.lang.String name, XmlPullParser reader, ModuleSpec.Builder specBuilder)
static XmlPullParserException
endOfDocument(XmlPullParser reader)
private static java.security.Permissions
getAllPermission()
private static XmlPullParserException
invalidModuleName(XmlPullParser reader, ModuleIdentifier expected)
private static XmlPullParserException
missingAttributes(XmlPullParser reader, java.util.Set<java.lang.String> required)
private static void
parseArtifact(MavenResolver mavenResolver, XmlPullParser reader, ModuleSpec.Builder specBuilder)
private static void
parseDependencies(XmlPullParser reader, java.util.ArrayList<DependencySpec> dependencies)
private static ModuleSpec
parseDocument(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, java.lang.String rootPath, XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier)
private static void
parseEndDocument(XmlPullParser reader)
private static void
parseFilterList(XmlPullParser reader, MultiplePathFilterBuilder builder)
private static void
parseGrant(XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, java.util.ArrayList<PermissionFactory> list)
private static void
parseMainClass(XmlPullParser reader, ModuleSpec.Builder specBuilder)
private static void
parseModuleAbsentContents(XmlPullParser reader, ModuleIdentifier moduleIdentifier)
private static ModuleSpec
parseModuleAliasContents(XmlPullParser reader, ModuleIdentifier moduleIdentifier)
private static void
parseModuleContents(MavenResolver mavenResolver, XmlPullParser reader, ModuleXmlParser.ResourceRootFactory factory, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ModuleSpec.Builder specBuilder, java.lang.String rootPath)
private static void
parseModuleDependency(XmlPullParser reader, java.util.ArrayList<DependencySpec> dependencies)
static ModuleSpec
parseModuleXml(ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, java.io.File root, java.io.File moduleInfoFile)
Parse amodule.xml
file.static ModuleSpec
parseModuleXml(ModuleXmlParser.ResourceRootFactory factory, java.lang.String rootPath, java.io.InputStream source, java.lang.String moduleInfoFile, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier)
Parse amodule.xml
file.static ModuleSpec
parseModuleXml(ModuleXmlParser.ResourceRootFactory factory, MavenResolver mavenResolver, java.lang.String rootPath, java.io.InputStream source, java.lang.String moduleInfoFile, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier)
Parse amodule.xml
file.private static void
parseNativeArtifact(MavenResolver mavenResolver, XmlPullParser reader, ModuleSpec.Builder specBuilder)
private static void
parseNoContent(XmlPullParser reader)
private static void
parsePath(XmlPullParser reader, boolean include, MultiplePathFilterBuilder builder)
private static void
parsePathName(XmlPullParser reader, java.util.Set<java.lang.String> set)
private static void
parsePermissions(XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ModuleSpec.Builder specBuilder)
private static void
parseProperties(XmlPullParser reader, ModuleSpec.Builder specBuilder)
private static void
parseProperty(XmlPullParser reader, ModuleSpec.Builder specBuilder)
private static void
parseResourceRoot(ModuleXmlParser.ResourceRootFactory factory, java.lang.String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder)
private static void
parseResources(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, java.lang.String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder)
private static ModuleSpec
parseRootElement(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, java.lang.String rootPath, XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier)
private static java.util.Set<java.lang.String>
parseSet(XmlPullParser reader)
private static void
parseSet(XmlPullParser reader, boolean include, MultiplePathFilterBuilder builder)
private static void
parseSystemDependency(XmlPullParser reader, java.util.ArrayList<DependencySpec> dependencies)
private static void
safeClose(java.io.Closeable closeable)
static XmlPullParserException
unexpectedContent(XmlPullParser reader)
private static XmlPullParserException
unknownAttribute(XmlPullParser parser, int index)
private static XmlPullParserException
unknownAttributeValue(XmlPullParser parser, int index)
private static void
unzip(java.io.File src, java.io.File destDir)
private static void
validateAttributeNamespace(XmlPullParser reader, int index)
private static void
validateNamespace(XmlPullParser reader)
-
-
-
Field Detail
-
MODULE_1_0
private static final java.lang.String MODULE_1_0
- See Also:
- Constant Field Values
-
MODULE_1_1
private static final java.lang.String MODULE_1_1
- See Also:
- Constant Field Values
-
MODULE_1_2
private static final java.lang.String MODULE_1_2
- See Also:
- Constant Field Values
-
MODULE_1_3
private static final java.lang.String MODULE_1_3
- See Also:
- Constant Field Values
-
MODULE_1_5
private static final java.lang.String MODULE_1_5
- See Also:
- Constant Field Values
-
E_MODULE
private static final java.lang.String E_MODULE
- See Also:
- Constant Field Values
-
E_ARTIFACT
private static final java.lang.String E_ARTIFACT
- See Also:
- Constant Field Values
-
E_NATIVE_ARTIFACT
private static final java.lang.String E_NATIVE_ARTIFACT
- See Also:
- Constant Field Values
-
E_DEPENDENCIES
private static final java.lang.String E_DEPENDENCIES
- See Also:
- Constant Field Values
-
E_RESOURCES
private static final java.lang.String E_RESOURCES
- See Also:
- Constant Field Values
-
E_MAIN_CLASS
private static final java.lang.String E_MAIN_CLASS
- See Also:
- Constant Field Values
-
E_RESOURCE_ROOT
private static final java.lang.String E_RESOURCE_ROOT
- See Also:
- Constant Field Values
-
E_PATH
private static final java.lang.String E_PATH
- See Also:
- Constant Field Values
-
E_EXPORTS
private static final java.lang.String E_EXPORTS
- See Also:
- Constant Field Values
-
E_IMPORTS
private static final java.lang.String E_IMPORTS
- See Also:
- Constant Field Values
-
E_INCLUDE
private static final java.lang.String E_INCLUDE
- See Also:
- Constant Field Values
-
E_EXCLUDE
private static final java.lang.String E_EXCLUDE
- See Also:
- Constant Field Values
-
E_INCLUDE_SET
private static final java.lang.String E_INCLUDE_SET
- See Also:
- Constant Field Values
-
E_EXCLUDE_SET
private static final java.lang.String E_EXCLUDE_SET
- See Also:
- Constant Field Values
-
E_FILTER
private static final java.lang.String E_FILTER
- See Also:
- Constant Field Values
-
E_SYSTEM
private static final java.lang.String E_SYSTEM
- See Also:
- Constant Field Values
-
E_PATHS
private static final java.lang.String E_PATHS
- See Also:
- Constant Field Values
-
E_MODULE_ALIAS
private static final java.lang.String E_MODULE_ALIAS
- See Also:
- Constant Field Values
-
E_MODULE_ABSENT
private static final java.lang.String E_MODULE_ABSENT
- See Also:
- Constant Field Values
-
E_PROPERTIES
private static final java.lang.String E_PROPERTIES
- See Also:
- Constant Field Values
-
E_PROPERTY
private static final java.lang.String E_PROPERTY
- See Also:
- Constant Field Values
-
E_PERMISSIONS
private static final java.lang.String E_PERMISSIONS
- See Also:
- Constant Field Values
-
E_GRANT
private static final java.lang.String E_GRANT
- See Also:
- Constant Field Values
-
A_NAME
private static final java.lang.String A_NAME
- See Also:
- Constant Field Values
-
A_SLOT
private static final java.lang.String A_SLOT
- See Also:
- Constant Field Values
-
A_EXPORT
private static final java.lang.String A_EXPORT
- See Also:
- Constant Field Values
-
A_SERVICES
private static final java.lang.String A_SERVICES
- See Also:
- Constant Field Values
-
A_PATH
private static final java.lang.String A_PATH
- See Also:
- Constant Field Values
-
A_OPTIONAL
private static final java.lang.String A_OPTIONAL
- See Also:
- Constant Field Values
-
A_TARGET_NAME
private static final java.lang.String A_TARGET_NAME
- See Also:
- Constant Field Values
-
A_TARGET_SLOT
private static final java.lang.String A_TARGET_SLOT
- See Also:
- Constant Field Values
-
A_VALUE
private static final java.lang.String A_VALUE
- See Also:
- Constant Field Values
-
A_PERMISSION
private static final java.lang.String A_PERMISSION
- See Also:
- Constant Field Values
-
A_ACTIONS
private static final java.lang.String A_ACTIONS
- See Also:
- Constant Field Values
-
D_NONE
private static final java.lang.String D_NONE
- See Also:
- Constant Field Values
-
D_IMPORT
private static final java.lang.String D_IMPORT
- See Also:
- Constant Field Values
-
D_EXPORT
private static final java.lang.String D_EXPORT
- See Also:
- Constant Field Values
-
LIST_A_NAME
private static final java.util.List<java.lang.String> LIST_A_NAME
-
LIST_A_PATH
private static final java.util.List<java.lang.String> LIST_A_PATH
-
LIST_A_NAME_A_SLOT
private static final java.util.List<java.lang.String> LIST_A_NAME_A_SLOT
-
LIST_A_NAME_A_TARGET_NAME
private static final java.util.List<java.lang.String> LIST_A_NAME_A_TARGET_NAME
-
LIST_A_PERMISSION_A_NAME
private static final java.util.List<java.lang.String> LIST_A_PERMISSION_A_NAME
-
ALL_PERMISSION
private static final java.security.AllPermission ALL_PERMISSION
-
DEFAULT_PERMISSION_COLLECTION
static final java.security.Permissions DEFAULT_PERMISSION_COLLECTION
-
-
Method Detail
-
parseModuleXml
public static ModuleSpec parseModuleXml(ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, java.io.File root, java.io.File moduleInfoFile) throws ModuleLoadException, java.io.IOException
Parse amodule.xml
file.- Parameters:
moduleLoader
- the module loader to use for dependency specificationsmoduleIdentifier
- the module identifier of the module to loadroot
- the module path rootmoduleInfoFile
- theFile
of themodule.xml
content- Returns:
- a module specification
- Throws:
ModuleLoadException
- if a dependency could not be established or another error occursjava.io.IOException
- if I/O fails
-
parseModuleXml
public static ModuleSpec parseModuleXml(ModuleXmlParser.ResourceRootFactory factory, java.lang.String rootPath, java.io.InputStream source, java.lang.String moduleInfoFile, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) throws ModuleLoadException, java.io.IOException
Parse amodule.xml
file.- Parameters:
factory
- the resource root factory to use (must not benull
)rootPath
- the root path to send in to the resource root factory (must not benull
)source
- a stream of themodule.xml
content (must not benull
)moduleInfoFile
- theFile
of themodule.xml
content (must not benull
)moduleLoader
- the module loader to use for dependency specifications (must not benull
)moduleIdentifier
- the module identifier of the module to load- Returns:
- a module specification
- Throws:
ModuleLoadException
- if a dependency could not be established or another error occursjava.io.IOException
- if I/O fails
-
parseModuleXml
public static ModuleSpec parseModuleXml(ModuleXmlParser.ResourceRootFactory factory, MavenResolver mavenResolver, java.lang.String rootPath, java.io.InputStream source, java.lang.String moduleInfoFile, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) throws ModuleLoadException, java.io.IOException
Parse amodule.xml
file.- Parameters:
factory
- the resource root factory to use (must not benull
)mavenResolver
- the Maven artifact resolver to use (must not benull
)rootPath
- the root path to send in to the resource root factory (must not benull
)source
- a stream of themodule.xml
content (must not benull
)moduleInfoFile
- theFile
of themodule.xml
content (must not benull
)moduleLoader
- the module loader to use for dependency specifications (must not benull
)moduleIdentifier
- the module identifier of the module to load- Returns:
- a module specification
- Throws:
ModuleLoadException
- if a dependency could not be established or another error occursjava.io.IOException
- if I/O fails
-
unexpectedContent
public static XmlPullParserException unexpectedContent(XmlPullParser reader)
-
endOfDocument
public static XmlPullParserException endOfDocument(XmlPullParser reader)
-
invalidModuleName
private static XmlPullParserException invalidModuleName(XmlPullParser reader, ModuleIdentifier expected)
-
missingAttributes
private static XmlPullParserException missingAttributes(XmlPullParser reader, java.util.Set<java.lang.String> required)
-
unknownAttribute
private static XmlPullParserException unknownAttribute(XmlPullParser parser, int index)
-
unknownAttributeValue
private static XmlPullParserException unknownAttributeValue(XmlPullParser parser, int index)
-
validateNamespace
private static void validateNamespace(XmlPullParser reader) throws XmlPullParserException
- Throws:
XmlPullParserException
-
assertNoAttributes
private static void assertNoAttributes(XmlPullParser reader) throws XmlPullParserException
- Throws:
XmlPullParserException
-
validateAttributeNamespace
private static void validateAttributeNamespace(XmlPullParser reader, int index) throws XmlPullParserException
- Throws:
XmlPullParserException
-
parseDocument
private static ModuleSpec parseDocument(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, java.lang.String rootPath, XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseRootElement
private static ModuleSpec parseRootElement(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, java.lang.String rootPath, XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseModuleAliasContents
private static ModuleSpec parseModuleAliasContents(XmlPullParser reader, ModuleIdentifier moduleIdentifier) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseModuleAbsentContents
private static void parseModuleAbsentContents(XmlPullParser reader, ModuleIdentifier moduleIdentifier) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
getAllPermission
private static java.security.Permissions getAllPermission()
-
parseModuleContents
private static void parseModuleContents(MavenResolver mavenResolver, XmlPullParser reader, ModuleXmlParser.ResourceRootFactory factory, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ModuleSpec.Builder specBuilder, java.lang.String rootPath) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseDependencies
private static void parseDependencies(XmlPullParser reader, java.util.ArrayList<DependencySpec> dependencies) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseModuleDependency
private static void parseModuleDependency(XmlPullParser reader, java.util.ArrayList<DependencySpec> dependencies) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseSystemDependency
private static void parseSystemDependency(XmlPullParser reader, java.util.ArrayList<DependencySpec> dependencies) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseMainClass
private static void parseMainClass(XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseResources
private static void parseResources(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, java.lang.String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
createMavenNativeArtifactLoader
private static void createMavenNativeArtifactLoader(MavenResolver mavenResolver, java.lang.String name, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws java.io.IOException, XmlPullParserException
- Throws:
java.io.IOException
XmlPullParserException
-
parseNativeArtifact
private static void parseNativeArtifact(MavenResolver mavenResolver, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseArtifact
private static void parseArtifact(MavenResolver mavenResolver, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseResourceRoot
private static void parseResourceRoot(ModuleXmlParser.ResourceRootFactory factory, java.lang.String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseFilterList
private static void parseFilterList(XmlPullParser reader, MultiplePathFilterBuilder builder) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parsePath
private static void parsePath(XmlPullParser reader, boolean include, MultiplePathFilterBuilder builder) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseSet
private static java.util.Set<java.lang.String> parseSet(XmlPullParser reader) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseSet
private static void parseSet(XmlPullParser reader, boolean include, MultiplePathFilterBuilder builder) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parsePathName
private static void parsePathName(XmlPullParser reader, java.util.Set<java.lang.String> set) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseProperties
private static void parseProperties(XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseProperty
private static void parseProperty(XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parsePermissions
private static void parsePermissions(XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ModuleSpec.Builder specBuilder) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseGrant
private static void parseGrant(XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, java.util.ArrayList<PermissionFactory> list) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseNoContent
private static void parseNoContent(XmlPullParser reader) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
parseEndDocument
private static void parseEndDocument(XmlPullParser reader) throws XmlPullParserException, java.io.IOException
- Throws:
XmlPullParserException
java.io.IOException
-
unzip
private static void unzip(java.io.File src, java.io.File destDir) throws java.io.IOException
- Throws:
java.io.IOException
-
copy
private static void copy(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
safeClose
private static void safeClose(java.io.Closeable closeable)
-
-