|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object weblogic.jndi.Environment
public final class Environment
The Environment class represents the properties used to create an initial Context. It provides type-safe methods to set and get common JNDI properties and a convenient way to create a new initial Context. Although this class uses WLInitialContextFactory as its default factory, it may be used to create an initial Context using any legal factory.
Here's an example of how to create an initial context:
Hashtable props = new Hashtable(); props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); props.put(Context.PROVIDER_URL, "t3://weblogic:7001"); props.put(Context.SECURITY_PRINCIPAL, "fred"); props.put(Context.SECURITY_CREDENTIALS, "seafood"); Context ctx = new InitialContext(props);This code can be rewritten using an Environment object as illustrated here:
Environment env = new Environment(); env.setProviderUrl("t3://weblogicServer:7001"); env.setSecurityPrincipal("fred"); env.setSecurityCredentials("seafood"); Context ctx = env.getInitialContext();
Field Summary | |
---|---|
static String |
DEFAULT_INITIAL_CONTEXT_FACTORY
The default (WebLogic) initial context. |
Constructor Summary | |
---|---|
Environment()
Constructs an Environment with default properties, that is, with a WebLogic initial context. |
|
Environment(Hashtable properties)
Constructs an Environment and initializes it with the properties contained in the specified Hashtable. |
Method Summary | |
---|---|
boolean |
getBoolean(String name,
boolean defaultValue)
Gets the value of the specified property as a boolean. |
Context |
getContext()
Returns a context that can be used with this environment. |
Context |
getContext(String contextName)
Returns a subcontext of the initial context with the specified name. |
boolean |
getCreateIntermediateContexts()
Returns the value of the WLContext.CREATE_INTERMEDIATE_CONTEXTS property. |
Hashtable |
getDelegateEnvironment()
Returns the value of the WLContext.DELEGATE_ENVIRONMENT property. |
boolean |
getEnableDefaultUser()
|
boolean |
getEnableServerAffinity()
Returns the value of the WLContext.ENABLE_SERVER_AFFINITY property. |
Context |
getInitialContext()
Returns an initial context based on the properties in an Environment. |
String |
getInitialContextFactory()
Returns the value of Context.INITIAL_CONTEXT_FACTORY. |
boolean |
getPinToPrimaryServer()
Returns the value of the WLContext.PIN_TO_PRIMARY_SERVER property. |
Hashtable |
getProperties()
Returns the properties associated with an Environment as a Hashtable. |
Object |
getProperty(String name)
Returns the value of the specified property. |
Object |
getPropertyFromEnv(String name)
|
weblogic.protocol.ServerIdentity |
getProviderIdentity()
Deprecated. |
String |
getProviderUrl()
Returns the Context.PROVIDER_URL property value. |
boolean |
getReplicateBindings()
Returns the value of the WLContext.REPLICATE_BINDINGS property. |
long |
getRequestTimeout()
Get the request timeout value. |
long |
getRMIClientTimeout()
Get the request timeout value. |
Object |
getSecurityCredentials()
Returns the Context.SECURITY_CREDENTIAL property value. |
String |
getSecurityPrincipal()
Returns the value of the Context.SECURITY_PRINCIPAL property. |
UserInfo |
getSecurityUser()
Returns the UserInfo for the principal assigned to the Context.SECURITY_PRINCIPAL property. |
Object |
getSSLClientCertificate()
Returns an RSA private key and chain of X.509 certificates set for SSL client authentication on the current thread. |
Object |
getSSLClientKeyPassword()
Deprecated. This method will be removed in the next major release. |
TrustManager |
getSSLClientTrustManager()
Returns the custom trust manager on the current thread used for SSL certificate chain validation. |
byte[][] |
getSSLRootCAFingerprints()
Returns the fingerprints of the certificates of trusted authorities associated with the current thread. |
String |
getSSLServerName()
Gets the specified expected name from the current thread of the SSL server. |
String |
getString(String name)
Gets the value of the specified property as a String. |
weblogic.security.subject.AbstractSubject |
getSubject()
Gets the subject that has been associated with this thread, or null if there has not been one. |
void |
loadLocalIdentity(Certificate[] certs,
PrivateKey privateKey)
Loads the local identity onto the current thread given an array of certs and the private key. |
void |
readExternal(ObjectInput in)
|
Object |
removeProperty(String name)
Removes the specified property. |
void |
setBoolean(String name,
boolean value)
Sets the value of the specified property as a boolean. |
void |
setCreateIntermediateContexts(boolean flag)
Set the WLContext.CREATE_INTERMEDIATE_CONTEXTS property to the String equivalent of the boolean argument flag. |
void |
setDelegateEnvironment(Hashtable delegateEnv)
Sets the WLContext.DELEGATE_ENVIRONMENT property to the value of the argument delegateEnv. |
void |
setEnableDefaultUser(boolean defaultUser)
|
void |
setEnableServerAffinity(boolean enable)
Sets the WLContext.ENABLE_SERVER_AFFINITY property to the String equivalent of the boolean argument enable. |
void |
setInitialContextFactory(String factoryName)
Sets the Context.INITIAL_CONTEXT_FACTORY property value to the value of factoryName. |
void |
setPinToPrimaryServer(boolean enable)
Sets the WLContext.PIN_TO_PRIMARY_SERVER property to the String equivalent of the boolean argument enable. |
Object |
setProperty(String name,
Object value)
Sets the specified property. |
void |
setProviderIdentity(weblogic.protocol.ServerIdentity rjvm)
Deprecated. |
void |
setProviderUrl(String url)
Sets the Context.PROVIDER_URL property value to the value of the argument url. |
void |
setProviderURL(String url)
Sets the Context.PROVIDER_URL property |
void |
setReplicateBindings(boolean enable)
Sets the WLContext.REPLICATE_BINDINGS property to the String equivalent of the boolean argument enable. |
void |
setRequestTimeout(long timeout)
Set the request timeout value in milliseconds. |
void |
setRMIClientTimeout(long timeout)
|
void |
setSecurityCredentials(Object credentials)
Sets the value of the Context.SECURITY_CREDENTIAL property to the value of the argument cedentials. |
void |
setSecurityPrincipal(String principal)
Sets the Context.SECURITY_PRINCIPAL property to the value of the argument principal. |
void |
setSecurityUser(UserInfo user)
|
void |
setSSLClientCertificate(InputStream[] chain)
Sets an RSA private key and chain of X.509 certificates for SSL client authentication on the current thread. |
void |
setSSLClientKeyPassword(String pass)
Sets the password for an encrypted RSA private key on the current thread. |
void |
setSSLClientTrustManager(TrustManager trustManager)
Customizes the trust manager on the current thread used for SSL certificate chain validation. |
void |
setSSLRootCAFingerprints(byte[][] fps)
Establishes a set of trusted certificate authorities on the current thread. |
void |
setSSLRootCAFingerprints(String fps)
Establishes a set of trusted certificate authorities on the current thread. |
void |
setSSLServerName(String name)
Sets an expected name on the current thread for the SSL server. |
void |
writeExternal(ObjectOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_INITIAL_CONTEXT_FACTORY
Constructor Detail |
---|
public Environment()
public Environment(Hashtable properties)
properties
- Hashtable containing initial propertiesMethod Detail |
---|
public Hashtable getProperties()
getProperties
in interface ClientEnvironment
public final Context getInitialContext() throws NamingException
NamingException
- if the initial context cannot be obtainedpublic final Context getContext() throws NamingException
ClientEnvironment
getContext
in interface ClientEnvironment
NamingException
public final Context getContext(String contextName) throws NamingException
contextName
- of the context to retrieve
NamingException
- if the initial context cannot be obtainedpublic String getInitialContextFactory() throws IllegalArgumentException
IllegalArgumentException
- if the context name is unavailable or invalid
at runtimeContext.INITIAL_CONTEXT_FACTORY
public final void setInitialContextFactory(String factoryName)
factoryName
- Initial context factory nameContext.INITIAL_CONTEXT_FACTORY
public final String getProviderUrl()
Context.PROVIDER_URL
public final void setProviderUrl(String url)
url
- Provider urlContext.PROVIDER_URL
public final void setProviderURL(String url)
ClientEnvironment
setProviderURL
in interface ClientEnvironment
url
- The url to use with this environmentpublic final Hashtable getDelegateEnvironment() throws IllegalArgumentException
IllegalArgumentException
- if the property is unavailable or invalid
at runtimeWLContext.DELEGATE_ENVIRONMENT
public final void setDelegateEnvironment(Hashtable delegateEnv)
delegateEnv
- Hashtable of propertiesWLContext.DELEGATE_ENVIRONMENT
public final String getSecurityPrincipal() throws IllegalArgumentException
IllegalArgumentException
- if the property is unavailable or invalid
at runtimeContext.SECURITY_PRINCIPAL
public final void setSecurityPrincipal(String principal)
setSecurityPrincipal
in interface ClientEnvironment
principal
- UsernameContext.SECURITY_PRINCIPAL
public final Object getSecurityCredentials() throws IllegalArgumentException
IllegalArgumentException
- if the property is unavailable or invalid
at runtimeContext.SECURITY_PRINCIPAL
public final void setSecurityCredentials(Object credentials)
setSecurityCredentials
in interface ClientEnvironment
credentials
- Certificate, password, or other credentials objectpublic final UserInfo getSecurityUser() throws IllegalArgumentException
IllegalArgumentException
- if the property is unavailable or invalid
at runtimepublic final void setSecurityUser(UserInfo user)
public weblogic.security.subject.AbstractSubject getSubject()
ClientEnvironment
getSubject
in interface ClientEnvironment
public final boolean getCreateIntermediateContexts() throws IllegalArgumentException
IllegalArgumentException
- if the property is unavailable or invalid
at runtimeWLContext.CREATE_INTERMEDIATE_CONTEXTS
public final void setCreateIntermediateContexts(boolean flag) throws IllegalArgumentException
flag
- to turn on use of intermediate contexts
IllegalArgumentException
- if the property is unavailable or invalid
at runtimeWLContext.CREATE_INTERMEDIATE_CONTEXTS
public final boolean getReplicateBindings() throws IllegalArgumentException
IllegalArgumentException
- if the property is unavailable or invalid
at runtimeWLContext.REPLICATE_BINDINGS
public final void setReplicateBindings(boolean enable)
enable
- True to enable replicated bindingsWLContext.REPLICATE_BINDINGS
public final boolean getPinToPrimaryServer() throws IllegalArgumentException
IllegalArgumentException
- if the property is unavailable or invalid
at runtimeWLContext.PIN_TO_PRIMARY_SERVER
public final void setPinToPrimaryServer(boolean enable)
enable
- True to force use of primary serverWLContext.PIN_TO_PRIMARY_SERVER
public final void setEnableServerAffinity(boolean enable)
setEnableServerAffinity
in interface ClientEnvironment
enable
- True to force use of server affinityWLContext.ENABLE_SERVER_AFFINITY
public final boolean getEnableServerAffinity()
IllegalArgumentException
- if the property is unavailable or invalid
at runtimeWLContext.ENABLE_SERVER_AFFINITY
public final void setRequestTimeout(long timeout)
RequestTimeoutException
. A value
of 0 implies that request will never timeout.
timeout
- value in milliseconds.public final long getRequestTimeout()
Environment.setRequestTimeout(long)
public final void setRMIClientTimeout(long timeout)
public final long getRMIClientTimeout()
Environment.setRequestTimeout(long)
public final String getString(String name) throws IllegalArgumentException
name
- Name of property to retrieve
IllegalArgumentException
- if the
property value is not a Stringpublic final boolean getBoolean(String name, boolean defaultValue) throws IllegalArgumentException
name
- Name of property to retrievedefaultValue
- Default value for the property
IllegalArgumentException
- if the context name is unavailable or invalid
at runtime
IllegalArgumentException
- if the
property value is not "true" or "false"public final void setSSLRootCAFingerprints(String fps)
fps
- MD5 fingerprints of certificate(s)public final void setSSLRootCAFingerprints(byte[][] fps)
fps
- MD5 fingerprints of certificatespublic final byte[][] getSSLRootCAFingerprints()
public final void setSSLServerName(String name)
name
- Domain name of an SSL serverpublic final String getSSLServerName()
public final Object getSSLClientCertificate() throws IOException
IOException
PEMInputStream
,
BufferedInputStream
public final void setSSLClientCertificate(InputStream[] chain)
The InputStreams you use must support mark and reset. If you have PEM-encoded data, you can wrap your InputStreams in PEMInputStream classes before passing them in here.
chain
- Array of InputStreams of DER encoded valuesPEMInputStream
,
BufferedInputStream
public final void setSSLClientKeyPassword(String pass)
pass
- Password for private keypublic final Object getSSLClientKeyPassword()
public final void setSSLClientTrustManager(TrustManager trustManager)
trustManager
- Custom trust managerpublic final TrustManager getSSLClientTrustManager()
public final void setBoolean(String name, boolean value)
name
- Name of property to setvalue
- Value to be set as a booleanpublic final Object getProperty(String name)
name
- Name of property to retrieve
public final Object getPropertyFromEnv(String name)
public final Object setProperty(String name, Object value)
name
- Name of property to be setvalue
- Value (as object) to be setpublic final Object removeProperty(String name)
name
- Name of property to remove
public final weblogic.protocol.ServerIdentity getProviderIdentity() throws IllegalArgumentException
IllegalArgumentException
- if the context name is unavailable or invalid
at runtimeWLContext.PROVIDER_RJVM
public final void setProviderIdentity(weblogic.protocol.ServerIdentity rjvm)
rjvm
- ServerIdentityWLContext.PROVIDER_RJVM
public void setEnableDefaultUser(boolean defaultUser)
public boolean getEnableDefaultUser()
public final void loadLocalIdentity(Certificate[] certs, PrivateKey privateKey)
certs
- An array of certificatesprivateKey
- The private keypublic void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs92 Copyright 2006 BEA Systems Inc. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |