Package org.jboss.modules.xml
Class ModuleXmlParser
java.lang.Object
org.jboss.modules.xml.ModuleXmlParser
A fast, validating
module.xml
parser.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A factory for resource roots, based on a root path, loader path, and loader name. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final AllPermission
private static final String
private static final String
private static final String
(package private) static final Permissions
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
assertNoAttributes
(XmlPullParser reader) private static void
copy
(InputStream in, OutputStream out) private static void
createMavenNativeArtifactLoader
(MavenResolver mavenResolver, String name, XmlPullParser reader, ModuleSpec.Builder specBuilder) static XmlPullParserException
endOfDocument
(XmlPullParser reader) private static Permissions
private static XmlPullParserException
invalidModuleName
(XmlPullParser reader, ModuleIdentifier expected) private static XmlPullParserException
missingAttributes
(XmlPullParser reader, Set<String> required) private static void
parseArtifact
(MavenResolver mavenResolver, XmlPullParser reader, ModuleSpec.Builder specBuilder) private static void
parseDependencies
(XmlPullParser reader, ArrayList<DependencySpec> dependencies) private static ModuleSpec
parseDocument
(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, 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, 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, String rootPath) private static void
parseModuleDependency
(XmlPullParser reader, ArrayList<DependencySpec> dependencies) static ModuleSpec
parseModuleXml
(ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, File root, File moduleInfoFile) Parse amodule.xml
file.static ModuleSpec
parseModuleXml
(ModuleXmlParser.ResourceRootFactory factory, String rootPath, InputStream source, String moduleInfoFile, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) Parse amodule.xml
file.static ModuleSpec
parseModuleXml
(ModuleXmlParser.ResourceRootFactory factory, MavenResolver mavenResolver, String rootPath, InputStream source, 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, Set<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, String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder) private static void
parseResources
(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder) private static ModuleSpec
parseRootElement
(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) parseSet
(XmlPullParser reader) private static void
parseSet
(XmlPullParser reader, boolean include, MultiplePathFilterBuilder builder) private static void
parseSystemDependency
(XmlPullParser reader, ArrayList<DependencySpec> dependencies) private static void
static XmlPullParserException
unexpectedContent
(XmlPullParser reader) private static XmlPullParserException
unknownAttribute
(XmlPullParser parser, int index) private static XmlPullParserException
unknownAttributeValue
(XmlPullParser parser, int index) private static void
private static void
validateAttributeNamespace
(XmlPullParser reader, int index) private static void
validateNamespace
(XmlPullParser reader)
-
Field Details
-
MODULE_1_0
- See Also:
-
MODULE_1_1
- See Also:
-
MODULE_1_2
- See Also:
-
MODULE_1_3
- See Also:
-
MODULE_1_5
- See Also:
-
E_MODULE
- See Also:
-
E_ARTIFACT
- See Also:
-
E_NATIVE_ARTIFACT
- See Also:
-
E_DEPENDENCIES
- See Also:
-
E_RESOURCES
- See Also:
-
E_MAIN_CLASS
- See Also:
-
E_RESOURCE_ROOT
- See Also:
-
E_PATH
- See Also:
-
E_EXPORTS
- See Also:
-
E_IMPORTS
- See Also:
-
E_INCLUDE
- See Also:
-
E_EXCLUDE
- See Also:
-
E_INCLUDE_SET
- See Also:
-
E_EXCLUDE_SET
- See Also:
-
E_FILTER
- See Also:
-
E_SYSTEM
- See Also:
-
E_PATHS
- See Also:
-
E_MODULE_ALIAS
- See Also:
-
E_MODULE_ABSENT
- See Also:
-
E_PROPERTIES
- See Also:
-
E_PROPERTY
- See Also:
-
E_PERMISSIONS
- See Also:
-
E_GRANT
- See Also:
-
A_NAME
- See Also:
-
A_SLOT
- See Also:
-
A_EXPORT
- See Also:
-
A_SERVICES
- See Also:
-
A_PATH
- See Also:
-
A_OPTIONAL
- See Also:
-
A_TARGET_NAME
- See Also:
-
A_TARGET_SLOT
- See Also:
-
A_VALUE
- See Also:
-
A_PERMISSION
- See Also:
-
A_ACTIONS
- See Also:
-
D_NONE
- See Also:
-
D_IMPORT
- See Also:
-
D_EXPORT
- See Also:
-
LIST_A_NAME
-
LIST_A_PATH
-
LIST_A_NAME_A_SLOT
-
LIST_A_NAME_A_TARGET_NAME
-
LIST_A_PERMISSION_A_NAME
-
ALL_PERMISSION
-
DEFAULT_PERMISSION_COLLECTION
-
-
Constructor Details
-
ModuleXmlParser
private ModuleXmlParser()
-
-
Method Details
-
parseModuleXml
public static ModuleSpec parseModuleXml(ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, File root, File moduleInfoFile) throws ModuleLoadException, 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 occursIOException
- if I/O fails
-
parseModuleXml
public static ModuleSpec parseModuleXml(ModuleXmlParser.ResourceRootFactory factory, String rootPath, InputStream source, String moduleInfoFile, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) throws ModuleLoadException, 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 occursIOException
- if I/O fails
-
parseModuleXml
public static ModuleSpec parseModuleXml(ModuleXmlParser.ResourceRootFactory factory, MavenResolver mavenResolver, String rootPath, InputStream source, String moduleInfoFile, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) throws ModuleLoadException, 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 occursIOException
- if I/O fails
-
unexpectedContent
-
endOfDocument
-
invalidModuleName
private static XmlPullParserException invalidModuleName(XmlPullParser reader, ModuleIdentifier expected) -
missingAttributes
-
unknownAttribute
-
unknownAttributeValue
-
validateNamespace
- Throws:
XmlPullParserException
-
assertNoAttributes
- 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, String rootPath, XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseRootElement
private static ModuleSpec parseRootElement(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseModuleAliasContents
private static ModuleSpec parseModuleAliasContents(XmlPullParser reader, ModuleIdentifier moduleIdentifier) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseModuleAbsentContents
private static void parseModuleAbsentContents(XmlPullParser reader, ModuleIdentifier moduleIdentifier) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
getAllPermission
-
parseModuleContents
private static void parseModuleContents(MavenResolver mavenResolver, XmlPullParser reader, ModuleXmlParser.ResourceRootFactory factory, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ModuleSpec.Builder specBuilder, String rootPath) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseDependencies
private static void parseDependencies(XmlPullParser reader, ArrayList<DependencySpec> dependencies) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseModuleDependency
private static void parseModuleDependency(XmlPullParser reader, ArrayList<DependencySpec> dependencies) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseSystemDependency
private static void parseSystemDependency(XmlPullParser reader, ArrayList<DependencySpec> dependencies) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseMainClass
private static void parseMainClass(XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseResources
private static void parseResources(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
createMavenNativeArtifactLoader
private static void createMavenNativeArtifactLoader(MavenResolver mavenResolver, String name, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws IOException, XmlPullParserException - Throws:
IOException
XmlPullParserException
-
parseNativeArtifact
private static void parseNativeArtifact(MavenResolver mavenResolver, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseArtifact
private static void parseArtifact(MavenResolver mavenResolver, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseResourceRoot
private static void parseResourceRoot(ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseFilterList
private static void parseFilterList(XmlPullParser reader, MultiplePathFilterBuilder builder) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parsePath
private static void parsePath(XmlPullParser reader, boolean include, MultiplePathFilterBuilder builder) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseSet
private static Set<String> parseSet(XmlPullParser reader) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseSet
private static void parseSet(XmlPullParser reader, boolean include, MultiplePathFilterBuilder builder) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parsePathName
private static void parsePathName(XmlPullParser reader, Set<String> set) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseProperties
private static void parseProperties(XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseProperty
private static void parseProperty(XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parsePermissions
private static void parsePermissions(XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseGrant
private static void parseGrant(XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ArrayList<PermissionFactory> list) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
parseNoContent
- Throws:
XmlPullParserException
IOException
-
parseEndDocument
private static void parseEndDocument(XmlPullParser reader) throws XmlPullParserException, IOException - Throws:
XmlPullParserException
IOException
-
unzip
- Throws:
IOException
-
copy
- Throws:
IOException
-
safeClose
-