@Status(stage=PRODUCTION, unitTests=ABSENT) @Review(by="Kees Schotanus", at="2009-09-28") public final class ApplicationServerUtil extends Object
GlobalSettings
.Modifier and Type | Method and Description |
---|---|
static ApplicationServerUtilInterface |
createApplicationServerUtilInstance()
Creates a new application server utility class for the current
application server.
|
static InitialContext |
getInitialContext()
Creates and returns an initial context.
|
static DataSource |
lookupDataSource(Context context,
String name)
Convenience method for looking up a data source.
|
static UserTransaction |
lookupUserTransaction(Context context)
Looks up the user transaction.
|
static void |
main(String[] args)
For test purposes only.
|
public static ApplicationServerUtilInterface createApplicationServerUtilInstance()
GlobalSettings
.IllegalStateException
- When no, an unknown or unsupported
application server is fetched from the GlobalSettings
or when
the corresponding utility class could not be loaded.public static InitialContext getInitialContext() throws NamingException
NamingException
- When an initial context could not be looked up.
Level.ERROR
.public static DataSource lookupDataSource(Context context, String name) throws NamingException
context
- The JNDI Context to use for the lookup.name
- The name of the data source that must be looked up.IllegalArgumentException
- When the supplied name is empty.NamingException
- When the supplied data source could not be
looked up.NullPointerException
- When the supplied context or name is null.public static UserTransaction lookupUserTransaction(Context context) throws NamingException
GlobalSettings
to get the
currently used application server.context
- The JNDI Context to use for the lookup.NamingException
- When the transaction could not be looked up.NullPointerException
- When the supplied context is null.public static void main(String[] args) throws NamingException
args
- Not used.NamingException
- When the LDAP context could not be obtained.Copyright © 2008–2018. All rights reserved.