Top Description Fields Constructors Methods
org.wildfly.client.config

public Class ClientConfiguration

extends Object
Class Inheritance
Static Imports
java.lang.Boolean.FALSE, javax.xml.stream.XMLStreamConstants.START_ELEMENT, org.wildfly.client.config.ConfigurationXMLStreamReader.eventToString, org.wildfly.client.config._private.ConfigMessages.msg

The entry point for generic client configuration.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private final URI
private final ExceptionSupplier<InputStream, IOException>
private static final String
private final XMLInputFactory

Constructor Summary

AccessConstructor and Description
pack-priv
ClientConfiguration(final XMLInputFactory xmlInputFactory, final URI configurationUri, final ExceptionSupplier<InputStream, IOException> streamSupplier)

pack-priv
ClientConfiguration(final XMLInputFactory xmlInputFactory, final URI configurationUri)

Method Summary

Modifier and TypeMethod and Description
private static XMLInputFactory
public URI

Returns:

the URI from which the configuration is being read
getConfigurationUri
()

Get the URI from which the configuration is being read.

private static ClassLoader
public static ClientConfiguration

Returns:

the client configuration instance
getInstance
(URI
the configuration URI
configurationUri
)

Get a client configuration instance for a certain URI.

public static ClientConfiguration

Returns:

the client configuration instance
getInstance
(URI
the configuration URI
configurationUri
,
ExceptionSupplier<InputStream, IOException> streamSupplier)

Get a client configuration instance for a certain URI, with streams provided by the given supplier.

public static ClientConfiguration

Returns:

the client configuration instance, or null if no configuration is found
getInstance
()

Get a client configuration instance from the current environment.

public static ClientConfiguration

Returns:

the client configuration instance, or null if no configuration is found
getInstance
(ClassLoader
the class loader from which to load the configuration resource
classLoader
)

Get a client configuration instance loaded from a file called wildfly-config.xml, either from the root of the specified class loader or within the META-INF folder.

pack-priv XMLInputFactory
pack-priv static ConfigurationXMLStreamReader
openUri(final URI uri, final XMLInputFactory xmlInputFactory)

pack-priv static ConfigurationXMLStreamReader
openUri(final URI uri, final XMLInputFactory xmlInputFactory, final InputStream inputStream)

pack-priv static URI
propertyUrlToUri(String wildFlyConfig)

public ConfigurationXMLStreamReader

Returns:

a reader which returns the first matching element
readConfiguration
(Set<String>
the recognized namespaces
recognizedNamespaces
)

Get a stream reader over a configuration.

private InputStream
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configurationUriback to summary
private final URI configurationUri
streamSupplierback to summary
private final ExceptionSupplier<InputStream, IOException> streamSupplier
WILDFLY_CLIENT_1_0back to summary
private static final String WILDFLY_CLIENT_1_0
xmlInputFactoryback to summary
private final XMLInputFactory xmlInputFactory

Constructor Detail

ClientConfigurationback to summary
pack-priv ClientConfiguration(final XMLInputFactory xmlInputFactory, final URI configurationUri, final ExceptionSupplier<InputStream, IOException> streamSupplier)
ClientConfigurationback to summary
pack-priv ClientConfiguration(final XMLInputFactory xmlInputFactory, final URI configurationUri)

Method Detail

createXmlInputFactoryback to summary
private static XMLInputFactory createXmlInputFactory()
getConfigurationUriback to summary
public URI getConfigurationUri()

Get the URI from which the configuration is being read.

Returns:URI

the URI from which the configuration is being read

getContextClassLoaderback to summary
private static ClassLoader getContextClassLoader()
getInstanceback to summary
public static ClientConfiguration getInstance(URI configurationUri)

Get a client configuration instance for a certain URI.

Parameters
configurationUri:URI

the configuration URI

Returns:ClientConfiguration

the client configuration instance

getInstanceback to summary
public static ClientConfiguration getInstance(URI configurationUri, ExceptionSupplier<InputStream, IOException> streamSupplier)

Get a client configuration instance for a certain URI, with streams provided by the given supplier.

Parameters
configurationUri:URI

the configuration URI

Returns:ClientConfiguration

the client configuration instance

getInstanceback to summary
public static ClientConfiguration getInstance()

Get a client configuration instance from the current environment. First, the system property wildfly.config.url is checked. If present, the configuration file is taken from that URL (which is resolved against the current working directory if it is a relative URL or a bare path). If the property is not given, the current thread's context class loader is consulted for a file called wildfly-config.xml, either in the root of the class loader or within the META-INF folder. If no such resource is found, the same search is done against the class loader of this library. Finally, if no configurations are found or are loadable, null is returned.

Returns:ClientConfiguration

the client configuration instance, or null if no configuration is found

getInstanceback to summary
public static ClientConfiguration getInstance(ClassLoader classLoader)

Get a client configuration instance loaded from a file called wildfly-config.xml, either from the root of the specified class loader or within the META-INF folder. If no configurations are found or are loadable, null is returned.

Parameters
classLoader:ClassLoader

the class loader from which to load the configuration resource

Returns:ClientConfiguration

the client configuration instance, or null if no configuration is found

getXmlInputFactoryback to summary
pack-priv XMLInputFactory getXmlInputFactory()
openUriback to summary
pack-priv static ConfigurationXMLStreamReader openUri(final URI uri, final XMLInputFactory xmlInputFactory) throws ConfigXMLParseException
openUriback to summary
pack-priv static ConfigurationXMLStreamReader openUri(final URI uri, final XMLInputFactory xmlInputFactory, final InputStream inputStream) throws ConfigXMLParseException
propertyUrlToUriback to summary
pack-priv static URI propertyUrlToUri(String wildFlyConfig)
readConfigurationback to summary
public ConfigurationXMLStreamReader readConfiguration(Set<String> recognizedNamespaces) throws ConfigXMLParseException

Get a stream reader over a configuration. The configuration returned will be the first element within the root configuration element which has a namespace corresponding to one of the given namespaces.

Parameters
recognizedNamespaces:Set<String>

the recognized namespaces

Returns:ConfigurationXMLStreamReader

a reader which returns the first matching element

Exceptions
ConfigXMLParseException:
if a read error occurs
streamOpenerback to summary
private InputStream streamOpener() throws IOException