In order to access configurations stored in a JNDI directory,
a link to the directory must be created in the configuration
hierachy. The link configuration needs to be of type
org.sape.carbon.services.config.jndi.JNDILinkNodeConfiguration
.
Within a JNDILinkNodeConfiguration
,
there are 5 configuration properties that are used in most
cases. The following table describes them.
Property Name |
Description |
Required (Y/N) |
InitialContextFactory |
The fully qualified class name of the initial
context factory used to create the initial
context. E.g. com.sun.jndi.ldap.LdapCtxFactory
|
Y |
ProviderUrl |
The URL of the server hosting the directory. E.g.
ldap://localhost:389. Other JNDI application may
combine this with the next property,
TargetContectName, but this should not be done
here.
|
Y |
TargetContextName |
The name of the context that is the root of the
configuration hierachy within the directory.
E.g. name=configRoot,dc=example,dc=org
|
Y |
SecurityPrincipal |
The principal name used to authenticate into the
directory server. E.g. cn=Manager,dc=example,dc=org
|
N |
SecurityCredentials |
The credential to be used to authenticate into the
directory server. E.g. password
|
N |
If the JNDI and/or directory provider requires other properties,
they can be passed in via the EnvironmentProperties Map.
Example of a JNDI Link Configuration
<Configuration
ConfigurationInterface="org.sape.carbon.services.config.jndi.JNDILinkNodeConfiguration">
<LinkNodeFactoryClass>org.sape.carbon.services.config.jndi.JNDILinkNodeFactory</LinkNodeFactoryClass>
<InitialContextFactory>com.sun.jndi.ldap.LdapCtxFactory</InitialContextFactory>
<ProviderUrl>ldap://localhost:389</ProviderUrl>
<TargetContextName>name=configRoot,dc=example,dc=org</TargetContextName>
<SecurityPrincipal>cn=Manager,dc=example,dc=org</SecurityPrincipal>
<SecurityCredentials>password</SecurityCredentials>
<!--not normally used, but provided as an example of the EnvironmentProperties Map-->
<EnvironmentPropertiesMap>
<EnvironmentProperties key="java.naming.security.protocol">ssl</EnvironmentProperties>
</EnvironmentPropertiesMap>
</Configuration>
If the above example were stored in a file called "foo.link"
in the root configuration directory, configurations in the
JNDI directory could be accessed by calling
Config.getInstance().fetchConfiguration("/foo/...")
.
|
If the default JNDI attribute names will not work in your
situation, read on, otherwise, skip this section.
The names and values of the attributes that are used by this
service are configurable. Below are the configuration
properties that should be set within the link configuration
in order to change the names and values from their defaults.
Please see the
Design
section for information about where
these are used.
Property Name |
Description |
Default |
NodeTypeAttributeName |
The name of the attribute that determines if a
context is a Folder or a ConfigurationDocument.
|
objectClass |
FolderNodeTypeAttributeValue |
The value of the attribute named by
NodeTypeAttributeName that specifies that a
context is a Folder.
|
configFolder |
DocumentNodeTypeAttributeValue |
The value of the attribute named by
NodeTypeAttributeName that specifies that a
context is a ConfigurationDocument.
|
configDoc |
DocumentTypeAttributeName |
The name of the attribute that determines if a
ConfigurationDocument context is a document or
a link.
|
type |
LinkDocumentTypeAttributeValue |
The value of the attribute named by
LinkDocumentTypeAttributeValue that specifies
that a ConfigurationDocument
context is a link.
|
link |
DocumentDocumentTypeAttributeValue |
The value of the attribute named by
LinkDocumentTypeAttributeValue that specifies
that a ConfigurationDocument
context is a document.
|
doc |
DocumentContectAttributeName |
The name of the attribute that store the content
in a ConfigurationDocument context.
|
content |
NodeNameAttributeName |
The name of the attribute that store the name
of a Node.
|
name |
AttributeNameValueSeparator |
The String that the directory uses to separate
attributes and their values when they are
represented as Strings.
|
= |
|