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 interfaceA factory for resource roots, based on a root path, loader path, and loader name. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final AllPermissionprivate static final Stringprivate static final Stringprivate static final String(package private) static final Permissionsprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidassertNoAttributes(XmlPullParser reader) private static voidcopy(InputStream in, OutputStream out) private static voidcreateMavenNativeArtifactLoader(MavenResolver mavenResolver, String name, XmlPullParser reader, ModuleSpec.Builder specBuilder) static XmlPullParserExceptionendOfDocument(XmlPullParser reader) private static Permissionsprivate static XmlPullParserExceptioninvalidModuleName(XmlPullParser reader, ModuleIdentifier expected) private static XmlPullParserExceptionmissingAttributes(XmlPullParser reader, Set<String> required) private static voidparseArtifact(MavenResolver mavenResolver, XmlPullParser reader, ModuleSpec.Builder specBuilder) private static voidparseDependencies(XmlPullParser reader, ArrayList<DependencySpec> dependencies) private static ModuleSpecparseDocument(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) private static voidparseEndDocument(XmlPullParser reader) private static voidparseFilterList(XmlPullParser reader, MultiplePathFilterBuilder builder) private static voidparseGrant(XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ArrayList<PermissionFactory> list) private static voidparseMainClass(XmlPullParser reader, ModuleSpec.Builder specBuilder) private static voidparseModuleAbsentContents(XmlPullParser reader, ModuleIdentifier moduleIdentifier) private static ModuleSpecparseModuleAliasContents(XmlPullParser reader, ModuleIdentifier moduleIdentifier) private static voidparseModuleContents(MavenResolver mavenResolver, XmlPullParser reader, ModuleXmlParser.ResourceRootFactory factory, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ModuleSpec.Builder specBuilder, String rootPath) private static voidparseModuleDependency(XmlPullParser reader, ArrayList<DependencySpec> dependencies) static ModuleSpecparseModuleXml(ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, File root, File moduleInfoFile) Parse amodule.xmlfile.static ModuleSpecparseModuleXml(ModuleXmlParser.ResourceRootFactory factory, String rootPath, InputStream source, String moduleInfoFile, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) Parse amodule.xmlfile.static ModuleSpecparseModuleXml(ModuleXmlParser.ResourceRootFactory factory, MavenResolver mavenResolver, String rootPath, InputStream source, String moduleInfoFile, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) Parse amodule.xmlfile.private static voidparseNativeArtifact(MavenResolver mavenResolver, XmlPullParser reader, ModuleSpec.Builder specBuilder) private static voidparseNoContent(XmlPullParser reader) private static voidparsePath(XmlPullParser reader, boolean include, MultiplePathFilterBuilder builder) private static voidparsePathName(XmlPullParser reader, Set<String> set) private static voidparsePermissions(XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ModuleSpec.Builder specBuilder) private static voidparseProperties(XmlPullParser reader, ModuleSpec.Builder specBuilder) private static voidparseProperty(XmlPullParser reader, ModuleSpec.Builder specBuilder) private static voidparseResourceRoot(ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder) private static voidparseResources(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder) private static ModuleSpecparseRootElement(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) parseSet(XmlPullParser reader) private static voidparseSet(XmlPullParser reader, boolean include, MultiplePathFilterBuilder builder) private static voidparseSystemDependency(XmlPullParser reader, ArrayList<DependencySpec> dependencies) private static voidstatic XmlPullParserExceptionunexpectedContent(XmlPullParser reader) private static XmlPullParserExceptionunknownAttribute(XmlPullParser parser, int index) private static XmlPullParserExceptionunknownAttributeValue(XmlPullParser parser, int index) private static voidprivate static voidvalidateAttributeNamespace(XmlPullParser reader, int index) private static voidvalidateNamespace(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.xmlfile.- Parameters:
moduleLoader- the module loader to use for dependency specificationsmoduleIdentifier- the module identifier of the module to loadroot- the module path rootmoduleInfoFile- theFileof themodule.xmlcontent- 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.xmlfile.- 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.xmlcontent (must not benull)moduleInfoFile- theFileof themodule.xmlcontent (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.xmlfile.- 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.xmlcontent (must not benull)moduleInfoFile- theFileof themodule.xmlcontent (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:
XmlPullParserExceptionIOException
-
parseRootElement
private static ModuleSpec parseRootElement(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseModuleAliasContents
private static ModuleSpec parseModuleAliasContents(XmlPullParser reader, ModuleIdentifier moduleIdentifier) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseModuleAbsentContents
private static void parseModuleAbsentContents(XmlPullParser reader, ModuleIdentifier moduleIdentifier) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
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:
XmlPullParserExceptionIOException
-
parseDependencies
private static void parseDependencies(XmlPullParser reader, ArrayList<DependencySpec> dependencies) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseModuleDependency
private static void parseModuleDependency(XmlPullParser reader, ArrayList<DependencySpec> dependencies) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseSystemDependency
private static void parseSystemDependency(XmlPullParser reader, ArrayList<DependencySpec> dependencies) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseMainClass
private static void parseMainClass(XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseResources
private static void parseResources(MavenResolver mavenResolver, ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
createMavenNativeArtifactLoader
private static void createMavenNativeArtifactLoader(MavenResolver mavenResolver, String name, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws IOException, XmlPullParserException - Throws:
IOExceptionXmlPullParserException
-
parseNativeArtifact
private static void parseNativeArtifact(MavenResolver mavenResolver, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseArtifact
private static void parseArtifact(MavenResolver mavenResolver, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseResourceRoot
private static void parseResourceRoot(ModuleXmlParser.ResourceRootFactory factory, String rootPath, XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseFilterList
private static void parseFilterList(XmlPullParser reader, MultiplePathFilterBuilder builder) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parsePath
private static void parsePath(XmlPullParser reader, boolean include, MultiplePathFilterBuilder builder) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseSet
private static Set<String> parseSet(XmlPullParser reader) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseSet
private static void parseSet(XmlPullParser reader, boolean include, MultiplePathFilterBuilder builder) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parsePathName
private static void parsePathName(XmlPullParser reader, Set<String> set) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseProperties
private static void parseProperties(XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseProperty
private static void parseProperty(XmlPullParser reader, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parsePermissions
private static void parsePermissions(XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ModuleSpec.Builder specBuilder) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseGrant
private static void parseGrant(XmlPullParser reader, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, ArrayList<PermissionFactory> list) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
parseNoContent
- Throws:
XmlPullParserExceptionIOException
-
parseEndDocument
private static void parseEndDocument(XmlPullParser reader) throws XmlPullParserException, IOException - Throws:
XmlPullParserExceptionIOException
-
unzip
- Throws:
IOException
-
copy
- Throws:
IOException
-
safeClose
-