|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@NotExtensible @ThreadSafety(level=INTERFACE_THREADSAFE) public interface ServerContext
This interface may be used to obtain information about the server in which an extension is running.
Method Summary | |
---|---|
java.lang.Thread |
createThread(ServerThread serverThread,
java.lang.String name)
Creates a new thread to run within the server. |
void |
debugCaught(java.lang.Throwable t)
Writes a debug message indicating that the provided exception has been caught. |
boolean |
debugEnabled()
Indicates whether debugging is enabled in the server. |
void |
debugError(java.lang.String message)
Writes a debug message with an error severity. |
void |
debugInfo(java.lang.String message)
Writes a debug message with an informational severity. |
void |
debugThrown(java.lang.Throwable t)
Writes a debug message indicating that the provided exception will be thrown. |
void |
debugVerbose(java.lang.String message)
Writes a debug message with a verbose severity. |
void |
debugWarning(java.lang.String message)
Writes a debug message with a warning severity. |
void |
deregisterAllMonitorProviders()
Deregisters all the monitor providers that were registered with the server by this instance of ServerContext . |
void |
deregisterChangeListener(RegisteredChangeListener listener)
Deregisters the provided change listener with the server. |
void |
deregisterDiskSpaceConsumer(RegisteredDiskSpaceConsumer consumer)
Deregisters the provided disk space consumer with the server. |
void |
deregisterMonitorProvider(RegisteredMonitorProvider provider)
Deregisters the given monitor provider with the server. |
void |
deregisterShutdownListener(RegisteredServerShutdownListener listener)
Deregisters the provided server shutdown listener with the server. |
void |
deregisterSupportedControlOID(java.lang.String oid)
Deregisters the provided OID with the server so that it will no longer appear in the supportedControl attribute of the server's root DSE. |
java.lang.String |
getBasicProductName()
Retrieves the base name of the server which is generally the full product name without the vendor information. |
com.unboundid.ldap.sdk.LDAPInterface |
getClientConnection(java.lang.String dn,
boolean isClientSecure)
Retrieves a client connection that is authenticated as the specified user. |
com.unboundid.ldap.sdk.LDAPInterface |
getClientRootConnection(boolean isClientSecure)
Retrieves a client connection that is authenticated as a root user and is not subject to access control. |
java.lang.String |
getCompactProductName()
Retrieves the compact name of the server. |
java.lang.String |
getFullProductName()
Retrieves the full name of the server. |
java.lang.String |
getFullVendorName()
Retrieves the full name of the server vendor. |
java.lang.String |
getFullVersion()
Retrieves a string that is the concatenation of the product name, the major, minor, point, and patch version numbers of the server and any any other unique version information. |
java.lang.String |
getInstanceName()
Retrieves the instance name that has been assigned to the server. |
InternalConnection |
getInternalConnection(java.lang.String dn)
Retrieves an internal connection that is authenticated as the specified user. |
InternalConnection |
getInternalRootConnection()
Retrieves an internal connection that is authenticated as a root user that is not subject to access control. |
int |
getMajorVersionNumber()
Retrieves the major version number for the server. |
int |
getMinorVersionNumber()
Retrieves the minor version number for the server. |
java.lang.String |
getPackageName()
Retrieves the package name of the server that is used for defining the server package ZIP file and root directory. |
int |
getPatchVersionNumber()
Retrieves the patch version number for the server. |
int |
getPointVersionNumber()
Retrieves the point version number for the server. |
Schema |
getSchema()
Retrieves a reference to the server schema. |
java.io.File |
getServerRoot()
Retrieves the path to the server root directory. |
java.lang.String |
getShortVendorName()
Retrieves the compact name of the server vendor. |
java.lang.String |
getSourceRevision()
Retrieves a value which identifies the source revision (in the version control system used to hold the server source code) from which the server was built. |
long |
getStartTime()
Retrieves the time that the server was started. |
java.lang.String |
getStartupID()
Retrieves a compact ID that was generated at the time the server was started. |
java.util.UUID |
getStartupUUID()
Retrieves a unique identifier that was generated at the time the server was started. |
ToolExecutor |
getToolExecutor()
Retrieves a ToolExecutor that can be used to internally execute select command line utilities. |
java.lang.String |
getVersionNumber()
Retrieves a string that is the concatenation of the major, minor, point, and patch version numbers of the server. |
java.lang.String |
getVersionQualifier()
Retrieves the version qualifier string for the server. |
boolean |
isDirectoryFunctionalityAvailable()
Indicates whether the extension is running in a server that has Directory Server functionality available. |
boolean |
isDirectoryProxyFunctionalityAvailable()
Indicates whether the extension is running in a server that has Directory Proxy Server functionality available. |
boolean |
isRunning()
Indicates whether the server is currently running. |
boolean |
isShuttingDown()
Indicates whether the server is in the process of shutting down. |
boolean |
isStarting()
Indicates whether the server is in the process of starting up. |
boolean |
isSyncFunctionalityAvailable()
Indicates whether the extension is running in a server that has Synchronization Server functionality available. |
void |
logMessage(LogSeverity severity,
java.lang.String message)
Writes a message to the server error log. |
RegisteredChangeListener |
registerChangeListener(ChangeListener listener,
java.util.Set<com.unboundid.ldap.sdk.ChangeType> changeTypes,
java.util.List<java.lang.String> baseDNs,
com.unboundid.ldap.sdk.Filter filter)
Registers the provided change listener with the server so that it may be notified of any changes matching the provided criteria. |
RegisteredDiskSpaceConsumer |
registerDiskSpaceConsumer(DiskSpaceConsumer consumer)
Registers the provided disk space consumer with the server. |
RegisteredMonitorProvider |
registerMonitorProvider(MonitorProvider provider,
GenericConfig config)
Registers the given monitor provider with the server. |
RegisteredServerShutdownListener |
registerShutdownListener(ServerShutdownListener listener)
Registers the provided listener to be notified when the server shutdown process has begun. |
void |
registerSupportedControlOID(java.lang.String oid)
Registers the provided OID with the server so that it will appear in the supportedControl attribute of the server's root DSE. |
void |
sendAlert(AlertSeverity severity,
java.lang.String message)
Generates an administrative alert notification. |
void |
sendAlert(java.lang.String alertTypeName,
AlertSeverity severity,
java.lang.String alertTypeOID,
java.lang.String message)
Generates an administrative alert notification. |
DegradedAlertType |
sendDegradedAlertNotification(java.lang.String alertTypeName,
AlertSeverity severity,
java.lang.String alertTypeOID,
java.lang.String message)
Generates an administrative alert and updates the server's general monitor entry to list the specified alert type as a degraded alert type. |
UnavailableAlertType |
sendUnavailableAlertNotification(java.lang.String alertTypeName,
AlertSeverity severity,
java.lang.String alertTypeOID,
java.lang.String message)
Generates an administrative alert and updates the server's general monitor entry to list the specified alert type as an unavailable alert type. |
Method Detail |
---|
java.lang.String getShortVendorName()
java.lang.String getFullVendorName()
java.lang.String getCompactProductName()
java.lang.String getPackageName()
java.lang.String getFullProductName()
java.lang.String getBasicProductName()
int getMajorVersionNumber()
int getMinorVersionNumber()
int getPointVersionNumber()
int getPatchVersionNumber()
java.lang.String getVersionNumber()
java.lang.String getFullVersion()
java.lang.String getVersionQualifier()
java.lang.String getSourceRevision()
boolean isStarting()
true
if the server is in the process of starting up, or
false
if not.boolean isRunning()
true
if the server is running, or false
if not.boolean isShuttingDown()
true
if the server is in the process of shutting down, or
false
if not.long getStartTime()
java.lang.String getStartupID()
java.util.UUID getStartupUUID()
java.lang.String getInstanceName()
java.io.File getServerRoot()
ToolExecutor getToolExecutor()
boolean isDirectoryFunctionalityAvailable()
true
if Directory Server functionality is available, or
false
if not.boolean isDirectoryProxyFunctionalityAvailable()
true
if Directory Proxy Server functionality is available,
or false
if not.boolean isSyncFunctionalityAvailable()
true
if Synchronization Server functionality is available,
or false
if not.InternalConnection getInternalRootConnection()
ClientContext
and wish to use the client connection policy
associated with that connection, use the
ClientContext.getInternalRootConnection(boolean)
method.
InternalConnection getInternalConnection(java.lang.String dn) throws com.unboundid.ldap.sdk.LDAPException
ClientContext
and wish to use the client connection policy
associated with that connection, use the
ClientContext.getInternalConnection(String,boolean)
method.
dn
- The DN of the user as whom the connection should be
authenticated. It may be null
or empty if the
connection should be unauthenticated.
com.unboundid.ldap.sdk.LDAPException
- If a problem occurs while attempting to
authenticate as the specified user.com.unboundid.ldap.sdk.LDAPInterface getClientRootConnection(boolean isClientSecure)
isClientSecure
parameter.
isClientSecure
- Whether the external client is connected over a
secure channel.
com.unboundid.ldap.sdk.LDAPInterface getClientConnection(java.lang.String dn, boolean isClientSecure) throws com.unboundid.ldap.sdk.LDAPException
isClientSecure
parameter.
dn
- The DN of the user as whom the connection should be
authenticated. It may be null
or empty if the
connection should be unauthenticated.isClientSecure
- Whether the external client is connected over a
secure channel.
com.unboundid.ldap.sdk.LDAPException
- If a problem occurs while attempting to
authenticate as the specified user.Schema getSchema()
void registerSupportedControlOID(java.lang.String oid)
oid
- The OID to be registered.void deregisterSupportedControlOID(java.lang.String oid)
oid
- The OID to be deregistered.RegisteredChangeListener registerChangeListener(ChangeListener listener, java.util.Set<com.unboundid.ldap.sdk.ChangeType> changeTypes, java.util.List<java.lang.String> baseDNs, com.unboundid.ldap.sdk.Filter filter) throws com.unboundid.ldap.sdk.LDAPException
listener
- The change listener to be registered with the server.
It must not be null
.changeTypes
- The types of changes for which the listener should be
registered. It may be null
or empty to
indicate that the listener should be registered for
all types of changes.baseDNs
- The set of base DNs for which the listener should be
registered. It may be null
or empty to
indicate that the listener should be registered for
changes processed anywhere in the server.filter
- A filter which may be used to restrict the set of
changes for which the listener is notified. If a
filter is provided, then only changes in which the
target entry matches the given filter (either before
or after the change was processed) will be notified.
It may be null
to indicate that the contents
of the entry should not be considered.
com.unboundid.ldap.sdk.LDAPException
- If a problem is encountered while attempting to
register the provided change listener (e.g., if any
of the base DNs cannot be parsed as a valid DN).void deregisterChangeListener(RegisteredChangeListener listener)
listener
- The change listener to be deregistered. It must not be
null
.RegisteredDiskSpaceConsumer registerDiskSpaceConsumer(DiskSpaceConsumer consumer)
consumer
- The disk space consumer to be registered with the server.
It must not be null
.
void deregisterDiskSpaceConsumer(RegisteredDiskSpaceConsumer consumer)
consumer
- The disk space consumer to be deregistered with the
server. It must not be null
.RegisteredServerShutdownListener registerShutdownListener(ServerShutdownListener listener)
listener
- The server shutdown listener to be registered. It must
not be null
.
void deregisterShutdownListener(RegisteredServerShutdownListener listener)
listener
- The server shutdown listener to be deregistered. It must
not be null
.RegisteredMonitorProvider registerMonitorProvider(MonitorProvider provider, GenericConfig config)
IllegalStateException
will be
thrown.
The generated monitor entry will have a DN in the following format:
cn={monitor-instance-name} [from {extension-type}:{extension-name}],
cn=monitor
and it will contain three auto-generated attributes:
ds-extension-monitor-name
, ds-extension-type
, and
ds-extension-name
. Note: the {extension-type} and
{extension-name} are from the extension which owns this ServerContext
instance, not from the given MonitorProvider object.
The specified monitor provider does not need any server-side configuration,
and the configuration-related methods
(initalizeMonitorProvider()
,
finalizeMonitorProvider()
,
defineConfigArguments()
,
isConfigurationAcceptable()
,
applyConfiguration()
) do not need to be implemented because
they will not be called.
When an extension is disabled, all of its registered monitor
providers will automatically deregister themselves from the server.
You can also manually deregister them using
deregisterMonitorProvider(RegisteredMonitorProvider)
or
deregisterAllMonitorProviders()
.
provider
- The monitor provider instance to be registered. It
must not be null
.config
- The configuration object from the extension that is
registering the given monitor provider. This is required so
that the monitor entry can be given a unique DN which
includes the name of the extension that registered it.
void deregisterMonitorProvider(RegisteredMonitorProvider provider)
provider
- The monitor provider instance to be registered. It
must not be null
.void deregisterAllMonitorProviders()
ServerContext
. This can be useful during
cleanup or if you want to clear out all the existing monitor data from a
given extension and register new monitor providers.
This will be called automatically when your extension is unloaded or disabled.
java.lang.Thread createThread(ServerThread serverThread, java.lang.String name)
name
- The name to use for the thread. It must not be
null
or empty.serverThread
- The class providing the logic for the thread. It
must not be null
.
void logMessage(LogSeverity severity, java.lang.String message)
severity
- The severity to use for the log message. It must not be
null
.message
- The message to be logged. It must not be null
.void sendAlert(AlertSeverity severity, java.lang.String message)
severity
- The severity to use for the alert notification. It must
not be null
.message
- The message to be used for the alert notification. It
must not be null
.void sendAlert(java.lang.String alertTypeName, AlertSeverity severity, java.lang.String alertTypeOID, java.lang.String message) throws com.unboundid.ldap.sdk.LDAPException
alertTypeName
- The name to use to identify the alert type. Each
kind of alert must have a distinct name and all
alerts with this alert type must always be used with
the same severity and OID values. Alert type names
must start with a lowercase ASCII letter and must
contain only lowercase ASCII letters, numeric
digits, and dashes.severity
- The severity to use for the alert notification.
It must not be null
.alertTypeOID
- The numeric OID for the alert type. It must not be
null
, and it must be a valid numeric OID.
The same OID must always be used for the associated
alert type, and each different alert type must have
a unique OID.message
- The message to be used for the alert notification.
It must not be null
.
com.unboundid.ldap.sdk.LDAPException
- If the provided information cannot be used to
generate a valid alert (e.g., if the alert type
name does not meet the naming constraints or has
already been used with a different severity and/or
OID, or if the OID has already been used with a
different alert type).DegradedAlertType sendDegradedAlertNotification(java.lang.String alertTypeName, AlertSeverity severity, java.lang.String alertTypeOID, java.lang.String message) throws com.unboundid.ldap.sdk.LDAPException
DegradedAlertType.setResolved()
method should be used
to remove the alert type from the list of degraded alert types.
alertTypeName
- The name to use to identify the alert type. Each
kind of alert must have a distinct name and all
alerts with this alert type must always be used with
the same severity and OID values. Alert type names
must start with a lowercase ASCII letter and must
contain only lowercase ASCII letters, numeric
digits, and dashes.severity
- The severity to use for the alert notification.
It must not be null
.alertTypeOID
- The numeric OID for the alert type. It must not be
null
, and it must be a valid numeric OID.
The same OID must always be used for the associated
alert type, and each different alert type must have
a unique OID.message
- The message to be used for the alert notification.
It must not be null
.
com.unboundid.ldap.sdk.LDAPException
- If the provided information cannot be used to
generate a valid alert (e.g., if the alert type
name does not meet the naming constraints or has
already been used with a different severity and/or
OID, or if the OID has already been used with a
different alert type).UnavailableAlertType sendUnavailableAlertNotification(java.lang.String alertTypeName, AlertSeverity severity, java.lang.String alertTypeOID, java.lang.String message) throws com.unboundid.ldap.sdk.LDAPException
UnavailableAlertType.setResolved()
method should
be used to remove the alert type from the list of unavailable alert types.
alertTypeName
- The name to use to identify the alert type. Each
kind of alert must have a distinct name and all
alerts with this alert type must always be used with
the same severity and OID values. Alert type names
must start with a lowercase ASCII letter and must
contain only lowercase ASCII letters, numeric
digits, and dashes.severity
- The severity to use for the alert notification.
It must not be null
.alertTypeOID
- The numeric OID for the alert type. It must not be
null
, and it must be a valid numeric OID.
The same OID must always be used for the associated
alert type, and each different alert type must have
a unique OID.message
- The message to be used for the alert notification.
It must not be null
.
com.unboundid.ldap.sdk.LDAPException
- If the provided information cannot be used to
generate a valid alert (e.g., if the alert type
name does not meet the naming constraints or has
already been used with a different severity and/or
OID, or if the OID has already been used with a
different alert type).boolean debugEnabled()
true
if debugging is enabled in the server, or
false
if not.void debugCaught(java.lang.Throwable t)
t
- The exception that has been caught.void debugThrown(java.lang.Throwable t)
t
- The exception that will be thrown.void debugError(java.lang.String message)
message
- The message to be debugged.void debugWarning(java.lang.String message)
message
- The message to be debugged.void debugInfo(java.lang.String message)
message
- The message to be debugged.void debugVerbose(java.lang.String message)
message
- The message to be debugged.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |