weblogic.jndi
Class Environment

java.lang.Object
|
+--weblogic.jndi.Environment

public final class Environment

extends java.lang.Object

implements java.io.Externalizable

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.

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

setEnableServerAffinity(boolean enable)
Sets the WLContext.ENABLE_SERVER_AFFINITY property to the String
equivalent of the boolean argument enable.

void

setIgnoreTrustValidation(boolean ignoreTrustValidation)
This will create an instance of NullTrustManager and
set's it to the current Environment so that trustvalidation
goes through for scenarios like applet etc.,

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.

DEFAULT_INITIAL_CONTEXT_FACTORY

public static final java.lang.String DEFAULT_INITIAL_CONTEXT_FACTORY

The default (WebLogic) initial context.

Constructor Detail

Environment

public Environment()

Constructs an Environment with default properties, that is,
with a WebLogic initial context. If unset, the properties
for principal and credentials default to guest/guest, and
the provider URL defaults to "t3://localhost:7001".

Environment

public Environment(java.util.Hashtable properties)

Constructs an Environment and initializes it with the properties
contained in the specified Hashtable.

Parameters:

properties - Hashtable containing initial properties

Method Detail

getProperties

public java.util.Hashtable getProperties()

Returns the properties associated with an Environment as
a Hashtable.

Returns:

Hashtable

getInitialContext

public final javax.naming.Context getInitialContext()
throws javax.naming.NamingException

Returns an initial context based on the properties in an
Environment.

Returns:

Initial context

Throws:

javax.naming.NamingException - if the initial context cannot be obtained

getInitialContextFactory

Returns the value of Context.INITIAL_CONTEXT_FACTORY.
If the property has not been set and is not defined as a
system property, returns the default initial context factory
(weblogic.jndi.WLInitialConextFactory).

Returns:

Context factory name

Throws:

java.lang.IllegalArgumentException - if the context name is unavailable or invalid
at runtime

See Also:

Context.INITIAL_CONTEXT_FACTORY

setInitialContextFactory

public final void setInitialContextFactory(java.lang.String factoryName)

Sets the Context.INITIAL_CONTEXT_FACTORY property value
to the value of factoryName.

Parameters:

factoryName - Initial context factory name

See Also:

Context.INITIAL_CONTEXT_FACTORY

getProviderUrl

public final java.lang.String getProviderUrl()

Returns the Context.PROVIDER_URL property value.
Note that this property need not be set to create a WLContext from
code running on the server.

Returns:

Provider URL

See Also:

Context.PROVIDER_URL

setProviderUrl

public final void setProviderUrl(java.lang.String url)

Sets the Context.PROVIDER_URL property value to
the value of the argument url.

Parameters:

url - Provider url

See Also:

Context.PROVIDER_URL

getDelegateEnvironment

public final java.util.Hashtable getDelegateEnvironment()
throws java.lang.IllegalArgumentException

Returns the value of the WLContext.DELEGATE_ENVIRONMENT
property.

Returns:

Hashtable of properties for delegate environment

Throws:

java.lang.IllegalArgumentException - if the property is unavailable or invalid
at runtime

getBoolean

Gets the value of the specified property as a boolean.
Returns the argument defaultValue as a default
if the property is not available or invalid.

Parameters:

name - Name of property to retrieve

defaultValue - Default value for the property

Returns:

True if the property value is true

Throws:

java.lang.IllegalArgumentException - if the context name is unavailable or invalid
at runtime

java.lang.IllegalArgumentException - if the
property value is not "true" or "false"

setSSLRootCAFingerprints

public final void setSSLRootCAFingerprints(java.lang.String fps)

Establishes a set of trusted certificate authorities. The value
specified is a set of fingerprints (MD5) of the authority's
certificates encoded as a comma-separated string of hex values.

Parameters:

fps - MD5 fingerprints of certificate(s)

setSSLRootCAFingerprints

public final void setSSLRootCAFingerprints(byte[][] fps)

Establishes a set of trusted certificate authorities. The value
specified is a set of fingerprints (MD5) of the authorities'
certificates encoded as a byte[][] value.

Parameters:

fps - MD5 fingerprints of certificates

getSSLRootCAFingerprints

public final byte[][] getSSLRootCAFingerprints()

Returns the fingerprints of the certificates of trusted
authorities associated with an Environment.

Returns:

Encoded byte array of authorities' certificates

setIgnoreTrustValidation

public void setIgnoreTrustValidation(boolean ignoreTrustValidation)

This will create an instance of NullTrustManager and
set's it to the current Environment so that trustvalidation
goes through for scenarios like applet etc.,

Parameters:

ignoreTrustValidation - boolean

setSSLServerName

public final void setSSLServerName(java.lang.String name)

Sets an expected name for the SSL server. It will be compared
against the common name field in the certificate presented by the
SSL server. This is typically the WebLogic Server's DNS name, e.g.,
www.weblogic.com.

Parameters:

name - Domain name of an SSL server

getSSLServerName

public final java.lang.String getSSLServerName()

Gets the specified expected name of the SSL server. If non-null,
it will be compared against the common name field in the
certificate presented by the SSL server. This is typically the
WebLogic Server's DNS name, e.g., www.weblogic.com.

Returns:

Domain name of an SSL server

getSSLClientCertificate

public final java.lang.Object getSSLClientCertificate()
throws java.io.IOException

Sets an RSA private key and chain of X.509 certificates for SSL
client authentication. The array of input streams passed as an
argument are DER encoded values, the first of which is a private
key, followed by X.509 certificates. All but the first of the
certificates are issuer certificates for the previous
certificate.

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.

setSSLClientCertificate

public final void setSSLClientCertificate(java.io.InputStream[] chain)

Sets an RSA private key and chain of X.509 certificates for SSL
client authentication. The array of input streams passed as an
argument are DER encoded values, the first of which is a private
key, followed by X.509 certificates. All but the first of the
certificates are issuer certificates for the previous
certificate.

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.