|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weblogic.jndi.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 java.lang.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(java.util.Hashtable properties)
Constructs an Environment and initializes it with the properties contained in the specified Hashtable. |
Method Summary | |
boolean |
getBoolean(java.lang.String name,
boolean defaultValue)
Gets the value of the specified property as a boolean. |
javax.naming.Context |
getContext(java.lang.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. |
java.util.Hashtable |
getDelegateEnvironment()
Returns the value of the WLContext.DELEGATE_ENVIRONMENT property. |
javax.naming.Context |
getInitialContext()
Returns an initial context based on the properties in an Environment. |
java.lang.String |
getInitialContextFactory()
Returns the value of Context.INITIAL_CONTEXT_FACTORY. |
boolean |
getPinToPrimaryServer()
Returns the value of the WLContext.PIN_TO_PRIMARY_SERVER property. |
java.util.Hashtable |
getProperties()
Returns the properties associated with an Environment as a Hashtable. |
java.lang.Object |
getProperty(java.lang.String name)
Returns the value of the specified property. |
weblogic.rjvm.RJVM |
getProviderRJVM()
Gets the value of the PROVIDER_RJVM property, which is the RJVM associated with an Environment. |
java.lang.String |
getProviderUrl()
Returns the Context.PROVIDER_URL property value. |
boolean |
getReplicateBindings()
Returns the value of the WLContext.REPLICATE_BINDINGS property. |
java.lang.Object |
getSecurityCredentials()
Returns the Context.SECURITY_CREDENTIAL property value. |
java.lang.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. |
java.lang.Object |
getSSLClientCertificate()
Sets an RSA private key and chain of X.509 certificates for SSL client authentication. |
java.lang.Object |
getSSLClientKeyPassword()
Deprecated. This method will be removed in the next major release. |
byte[][] |
getSSLRootCAFingerprints()
Returns the fingerprints of the certificates of trusted authorities associated with an Environment. |
java.lang.String |
getSSLServerName()
Gets the specified expected name of the SSL server. |
java.lang.String |
getString(java.lang.String name)
Gets the value of the specified property as a String. |
void |
readExternal(java.io.ObjectInput in)
|
java.lang.Object |
removeProperty(java.lang.String name)
Removes the specified property. |
void |
setBoolean(java.lang.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(java.util.Hashtable delegateEnv)
Sets the WLContext.DELEGATE_ENVIRONMENT property to the value of the argument delegateEnv. |
void |
setInitialContextFactory(java.lang.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. |
java.lang.Object |
setProperty(java.lang.String name,
java.lang.Object value)
Sets the specified property. |
void |
setProviderRJVM(weblogic.rjvm.RJVM rjvm)
Sets PROVIDER_RJVM property associated with an Environment. |
void |
setProviderUrl(java.lang.String url)
Sets the Context.PROVIDER_URL property value to the value of the argument url. |
void |
setReplicateBindings(boolean enable)
Sets the WLContext.REPLICATE_BINDINGS property to the String equivalent of the boolean argument enable. |
void |
setSecurityCredentials(java.lang.Object credentials)
Sets the value of the Context.SECURITY_CREDENTIAL property to the value of the argument cedentials. |
void |
setSecurityPrincipal(java.lang.String principal)
Sets the Context.SECURITY_PRINCIPAL property to the value of the argument principal. |
void |
setSecurityUser(UserInfo user)
|
void |
setSSLClientCertificate(java.io.InputStream[] chain)
Sets an RSA private key and chain of X.509 certificates for SSL client authentication. |
void |
setSSLClientKeyPassword(java.lang.String pass)
Sets the password for an encrypted RSA private key If you aren't using an encrypted private key then you don't need to set this value. |
void |
setSSLRootCAFingerprints(byte[][] fps)
Establishes a set of trusted certificate authorities. |
void |
setSSLRootCAFingerprints(java.lang.String fps)
Establishes a set of trusted certificate authorities. |
void |
setSSLServerName(java.lang.String name)
Sets an expected name for the SSL server. |
void |
writeExternal(java.io.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 java.lang.String DEFAULT_INITIAL_CONTEXT_FACTORY
Constructor Detail |
public Environment()
public Environment(java.util.Hashtable properties)
properties
- Hashtable containing initial propertiesMethod Detail |
public java.util.Hashtable getProperties()
public final javax.naming.Context getInitialContext() throws javax.naming.NamingException
public final javax.naming.Context getContext(java.lang.String contextName) throws javax.naming.NamingException
Name
- of the context to retrievepublic java.lang.String getInitialContextFactory() throws java.lang.IllegalArgumentException
Context.INITIAL_CONTEXT_FACTORY
public final void setInitialContextFactory(java.lang.String factoryName)
factoryName
- Initial context factory nameContext.INITIAL_CONTEXT_FACTORY
public final java.lang.String getProviderUrl()
Context.PROVIDER_URL
public final void setProviderUrl(java.lang.String url)
url
- Provider urlContext.PROVIDER_URL
public final java.util.Hashtable getDelegateEnvironment() throws java.lang.IllegalArgumentException
WLContext.DELEGATE_ENVIRONMENT
public final void setDelegateEnvironment(java.util.Hashtable delegateEnv)
delegateEnv
- Hashtable of propertiesWLContext.DELEGATE_ENVIRONMENT
public final java.lang.String getSecurityPrincipal() throws java.lang.IllegalArgumentException
Context.SECURITY_PRINCIPAL
public final void setSecurityPrincipal(java.lang.String principal)
principal
- UsernameContext.SECURITY_PRINCIPAL
public final java.lang.Object getSecurityCredentials() throws java.lang.IllegalArgumentException
Context.SECURITY_PRINCIPAL
public final void setSecurityCredentials(java.lang.Object credentials)
credentials
- Certificate, password, or other credentials objectpublic final UserInfo getSecurityUser() throws java.lang.IllegalArgumentException
public final void setSecurityUser(UserInfo user)
public final boolean getCreateIntermediateContexts() throws java.lang.IllegalArgumentException
WLContext.CREATE_INTERMEDIATE_CONTEXTS
public final void setCreateIntermediateContexts(boolean flag) throws java.lang.IllegalArgumentException
True
- to turn on use of intermediate contextsWLContext.CREATE_INTERMEDIATE_CONTEXTS
public final boolean getReplicateBindings() throws java.lang.IllegalArgumentException
WLContext.REPLICATE_BINDINGS
public final void setReplicateBindings(boolean enable)
enable
- True to enable replicated bindingsWLContext.REPLICATE_BINDINGS
public final boolean getPinToPrimaryServer() throws java.lang.IllegalArgumentException
WLContext.PIN_TO_PRIMARY_SERVER
public final void setPinToPrimaryServer(boolean enable)
enable
- True to force use of primary serverWLContext.PIN_TO_PRIMARY_SERVER
public final java.lang.String getString(java.lang.String name) throws java.lang.IllegalArgumentException
name
- Name of property to retrievepublic final boolean getBoolean(java.lang.String name, boolean defaultValue) throws java.lang.IllegalArgumentException
name
- Name of property to retrievedefaultValue
- Default value for the propertypublic final void setSSLRootCAFingerprints(java.lang.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(java.lang.String name)
name
- Domain name of an SSL serverpublic final java.lang.String getSSLServerName()
public final java.lang.Object getSSLClientCertificate() throws java.io.IOException
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 setSSLClientCertificate(java.io.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(java.lang.String pass)
password
- Password for private keypublic final java.lang.Object getSSLClientKeyPassword()
public final void setBoolean(java.lang.String name, boolean value)
name
- Name of property to setvalue
- Value to be set as a booleanpublic final java.lang.Object getProperty(java.lang.String name)
name
- Name of property to retrievepublic final java.lang.Object setProperty(java.lang.String name, java.lang.Object value)
name
- Name of property to be setvalue
- Value (as object) to be setpublic final java.lang.Object removeProperty(java.lang.String name)
name
- Name of property to removepublic final weblogic.rjvm.RJVM getProviderRJVM() throws java.lang.IllegalArgumentException
WLContext.PROVIDER_RJVM
public final void setProviderRJVM(weblogic.rjvm.RJVM rjvm)
rjvm
- RJVMWLContext.PROVIDER_RJVM
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs60 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |