@Service @PerLookup public final class Environment extends Object implements Externalizable, ServerEnvironment
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();| Modifier and Type | Field and Description | 
|---|---|
| static String | DEFAULT_INITIAL_CONTEXT_FACTORY | 
| static String | LOCAL_URL_PROTOCOL | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | getBoolean(String name,
          boolean defaultValue)Gets the value of the specified property as a boolean. | 
| String | getClusterProviderUrl() | 
| long | getConnectionTimeout()Get the request timeout value. | 
| 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. | 
| boolean | getForceResolveDNSName()Returns the value of the Context.FORCE_RESOLVE_DNS_NAME
 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) | 
| String | getProviderUrl()Returns the Context.PROVIDER_URL property value. | 
| boolean | getReplicateBindings()Returns the value of the WLContext.REPLICATE_BINDINGS
 property. | 
| long | getRequestTimeout()Deprecated. 
 - Use setConnectionTimeout() instead | 
| long | getResponseReadTimeout()Get the request timeout value. | 
| long | getRMIClientTimeout()Deprecated. 
 - Use getResponseReadTimeout instead. | 
| Object | getSecurityCredentials()Returns the Context.SECURITY_CREDENTIAL property value. | 
| String | getSecurityIdentityDomain()Returns the WLContext.IDENTITY_DOMAIN property value. | 
| String | getSecurityPrincipal()Returns the value of 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. | 
| 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 | setConnectionTimeout(long timeout)Set the request timeout value in milliseconds. | 
| 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 | 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)Deprecated.   | 
| void | setResponseReadTimeout(long timeout) | 
| void | setRMIClientTimeout(long timeout)Deprecated. 
 - Use setResponseReadTimeout() instead | 
| void | setSecurityCredentials(Object password)Sets the value of the Context.SECURITY_CREDENTIAL
 property to the value of the argument password. | 
| void | setSecurityIdentityDomain(String idd)Sets the value of the WLContext.IDENTITY_DOMAIN
 property to the value of the argument idd. | 
| void | setSecurityPrincipal(String principal)Sets the Context.SECURITY_PRINCIPAL property to
 the value of the argument principal. | 
| void | setSSLClientCertificate(InputStream[] chain)Deprecated. 
 As of 12.2.1.1.0, use  Environment.loadLocalIdentity(Certificate[], PrivateKey) | 
| void | setSSLClientKeyPassword(String pass)Deprecated. 
 As of 12.2.1.1.0, see  Environment.loadLocalIdentity(Certificate[], PrivateKey) | 
| void | setSSLClientTrustManager(TrustManager trustManager)Customizes the trust manager on the current thread used for SSL
 certificate chain validation. | 
| void | setSSLContext(SSLContext sslctx)Accept SSLContext from client | 
| 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) | 
public static final String DEFAULT_INITIAL_CONTEXT_FACTORY
public static final String LOCAL_URL_PROTOCOL
public Hashtable getProperties()
getProperties in interface ClientEnvironmentpublic final Context getInitialContext() throws NamingException
getInitialContext in interface ServerEnvironmentNamingException - if the initial context cannot be obtainedpublic final Context getContext() throws NamingException
ClientEnvironmentgetContext in interface ClientEnvironmentNamingExceptionpublic final Context getContext(String contextName) throws NamingException
contextName - of the context to retrieveNamingException - if the initial context cannot be obtainedpublic final String getClusterProviderUrl()
public String getInitialContextFactory() throws IllegalArgumentException
IllegalArgumentException - if the context name is unavailable or invalid
                          at runtimeContext.INITIAL_CONTEXT_FACTORYpublic final void setInitialContextFactory(String factoryName)
setInitialContextFactory in interface ServerEnvironmentfactoryName - Initial context factory nameContext.INITIAL_CONTEXT_FACTORYpublic final String getProviderUrl()
getProviderUrl in interface ServerEnvironmentContext.PROVIDER_URLpublic final void setProviderUrl(String url)
setProviderUrl in interface ServerEnvironmenturl - Provider urlContext.PROVIDER_URLpublic final void setProviderURL(String url)
ClientEnvironmentsetProviderURL in interface ClientEnvironmenturl - The url to use with this environmentpublic final Hashtable getDelegateEnvironment() throws IllegalArgumentException
IllegalArgumentException - if the property is unavailable or invalid
                          at runtimeWLContext.DELEGATE_ENVIRONMENTpublic final void setDelegateEnvironment(Hashtable delegateEnv)
delegateEnv - Hashtable of propertiesWLContext.DELEGATE_ENVIRONMENTpublic final boolean getForceResolveDNSName()
                                     throws IllegalArgumentException
IllegalArgumentException - if the property is unavailable or invalid
                          at runtimeWLContext.FORCE_RESOLVE_DNS_NAMEpublic final String getSecurityPrincipal() throws IllegalArgumentException
IllegalArgumentException - if the property is unavailable or invalid
                          at runtimeContext.SECURITY_PRINCIPALpublic final void setSecurityPrincipal(String principal)
setSecurityPrincipal in interface ClientEnvironmentprincipal - UsernameContext.SECURITY_PRINCIPALpublic final Object getSecurityCredentials() throws IllegalArgumentException
IllegalArgumentException - if the property is unavailable or invalid
                          at runtimeContext.SECURITY_PRINCIPALpublic final void setSecurityCredentials(Object password)
setSecurityCredentials in interface ClientEnvironmentpassword - Password (String)Context.SECURITY_CREDENTIALSpublic final String getSecurityIdentityDomain() throws IllegalArgumentException
IllegalArgumentException - if the property is unavailable or invalid
                          at runtimeWLContext.IDENTITY_DOMAINpublic final void setSecurityIdentityDomain(String idd)
idd - Identity Domain (String)WLContext.IDENTITY_DOMAINpublic final boolean getCreateIntermediateContexts()
                                            throws IllegalArgumentException
IllegalArgumentException - if the property is unavailable or invalid
                          at runtimeWLContext.CREATE_INTERMEDIATE_CONTEXTSpublic final void setCreateIntermediateContexts(boolean flag)
                                         throws IllegalArgumentException
setCreateIntermediateContexts in interface ServerEnvironmentflag - to turn on use of intermediate contextsIllegalArgumentException - if the property is unavailable or invalid
                          at runtimeWLContext.CREATE_INTERMEDIATE_CONTEXTSpublic final boolean getReplicateBindings()
                                   throws IllegalArgumentException
IllegalArgumentException - if the property is unavailable or invalid
                          at runtimeWLContext.REPLICATE_BINDINGSpublic final void setReplicateBindings(boolean enable)
setReplicateBindings in interface ServerEnvironmentenable - True to enable replicated bindingsWLContext.REPLICATE_BINDINGSpublic final boolean getPinToPrimaryServer()
                                    throws IllegalArgumentException
IllegalArgumentException - if the property is unavailable or invalid
                          at runtimeWLContext.PIN_TO_PRIMARY_SERVERpublic final void setPinToPrimaryServer(boolean enable)
enable - True to force use of primary serverWLContext.PIN_TO_PRIMARY_SERVERpublic final void setEnableServerAffinity(boolean enable)
setEnableServerAffinity in interface ClientEnvironmentenable - True to force use of server affinityWLContext.ENABLE_SERVER_AFFINITYpublic final boolean getEnableServerAffinity()
IllegalArgumentException - if the property is unavailable or invalid
                          at runtimeWLContext.ENABLE_SERVER_AFFINITYpublic final void setRequestTimeout(long timeout)
RequestTimeoutException. A value
 of 0 implies that request will never timeout.timeout - value in milliseconds.public final long getRequestTimeout()
public final void setConnectionTimeout(long timeout)
RequestTimeoutException. A value
 of 0 implies that request will never timeout.timeout - value in milliseconds.public final long getConnectionTimeout()
public final void setRMIClientTimeout(long timeout)
timeout - public final long getRMIClientTimeout()
public final void setResponseReadTimeout(long timeout)
public final long getResponseReadTimeout()
public final String getString(String name) throws IllegalArgumentException
name - Name of property to retrieveIllegalArgumentException - 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 propertyIllegalArgumentException - if the context name is unavailable or invalid
                          at runtimeIllegalArgumentException - 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
IOExceptionPEMInputStream, 
BufferedInputStream@Deprecated public final void setSSLClientCertificate(InputStream[] chain)
Environment.loadLocalIdentity(Certificate[], PrivateKey)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@Deprecated public final void setSSLClientKeyPassword(String pass)
Environment.loadLocalIdentity(Certificate[], PrivateKey)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 retrievepublic final Object setProperty(String name, Object value)
setProperty in interface ServerEnvironmentname - Name of property to be setvalue - Value (as object) to be setpublic final Object removeProperty(String name)
name - Name of property to removepublic void setEnableDefaultUser(boolean defaultUser)
setEnableDefaultUser in interface ServerEnvironmentpublic boolean getEnableDefaultUser()
getEnableDefaultUser in interface ServerEnvironmentpublic final void loadLocalIdentity(Certificate[] certs, PrivateKey privateKey)
certs - An array of certificatesprivateKey - The private keypublic final void setSSLContext(SSLContext sslctx)
sslctx - SSLContextpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundException