Oracle Content Management SDK

oracle.ifs.management.domain
Class Server

java.lang.Object
  |
  +--oracle.ifs.management.domain.Server
All Implemented Interfaces:
ServerInterface
Direct Known Subclasses:
IfsServer

public abstract class Server
extends java.lang.Object
implements ServerInterface

A Server is a managed iFS application.

An application following the the Server pattern can be managed by iFS administration tools. This allows it to be started on an iFS node and dynamically monitored and tuned.

Agents and protocol servers are two types of Server. An agent is an application that runs unattended and performs some operation, either periodically or in response to an IfsEvent. A protocol server opens a java.net.ServerSocket, awaits connections from clients, and performs operations dictated by a protocol specification in response to client requests.

To create a server, you can write a concrete subclass of this Server class. An easier approach, however, is to subclass IfsServer, which provides default implementations for methods, and provides tools for easily writing a thread-safe event-driven or timer-driven application.


Field Summary
static int LEVEL_HIGH
          Verbose logging.
static int LEVEL_LOW
          Minimal logging.
static int LEVEL_MEDIUM
          Typical logging (the default).
static int LEVEL_OFF
          Logging disabled.
 
Fields inherited from interface oracle.ifs.management.domain.ServerInterface
SERVERSTATUS_DISPOSED, SERVERSTATUS_RUNNING, SERVERSTATUS_STARTING, SERVERSTATUS_STOPPED, SERVERSTATUS_STOPPING, SERVERSTATUS_SUSPENDED, SERVERSTATUS_UNKNOWN
 
Constructor Summary
Server()
          Constructs a Server.
 
Method Summary
protected  void deregister()
          Deregisters this Server.
 Credential getCredential(java.lang.String name)
          Gets a Credential for the specified user.
 java.lang.String getName()
          Gets the name of this Server.
 java.lang.String getNodeName()
          Gets the name of the node for this Server.
 java.lang.String getOracleHome()
          Gets the Oracle home directory for this Server's node.
 ParameterTable getParameterTable()
          Gets the configuration parameters for this Server.
 java.lang.String getServiceName()
          Gets the name of the default service for this Server.
 void initialize()
          Initializes this Server.
 void initialize(java.lang.String name, java.lang.String serviceName, java.lang.String schemaPassword, ParameterTable parameterTable, java.io.PrintWriter logWriter, int logLevel)
          Initializes this Server (standalone).
 boolean isLogged(int level)
          Gets whether calling log with the specified logging level would cause a message to be logged.
 void log(int level, java.lang.String message)
          Logs the specified message.
 void log(int level, java.lang.String message, java.lang.Throwable throwable)
          Logs the specified message and throwable, as a single log entry.
 void log(int level, java.lang.Throwable throwable)
          Logs the specified throwable.
static java.lang.String toStatusLabel(int status)
          Gets a localized label for the specified status of a Server, using the default Localizer.
static java.lang.String toStatusLabel(int status, LibrarySessionInterface session)
          Gets a localized label for the specified status of a Server, using the specified session's Localizer.
static java.lang.String toStatusLabel(int serverStatus, Localizer localizer)
          Gets a localized label for the specified status of a Server, using the specified Localizer.
protected  void verifyNotDisposed()
          Verifies this Server has not been disposed.
 
Methods inherited from interface oracle.ifs.management.domain.ServerInterface
dispose, getPriority, getProperties, getProperty, getServerType, getStatus, isAgent, isPropertyReadonly, restart, resume, setPriority, setProperty, start, stop, supportsPriority, supportsSuspendResume, suspend
 

Field Detail


LEVEL_OFF

public static final int LEVEL_OFF
Logging disabled.

LEVEL_LOW

public static final int LEVEL_LOW
Minimal logging.

LEVEL_MEDIUM

public static final int LEVEL_MEDIUM
Typical logging (the default).

LEVEL_HIGH

public static final int LEVEL_HIGH
Verbose logging.
Constructor Detail

Server

public Server()
       throws IfsException
Constructs a Server.

Subclasses should provide a zero-argument constructor.

Throws:
IfsException - (IFS-45200) if the operation fails
Method Detail

initialize

public final void initialize(java.lang.String name,
                             java.lang.String serviceName,
                             java.lang.String schemaPassword,
                             ParameterTable parameterTable,
                             java.io.PrintWriter logWriter,
                             int logLevel)
                      throws IfsException
Initializes this Server (standalone).

This method should be called only when testing a Server outside the domain administration framework, that is, when the Server is not running on an iFS node. For such a standalone Server, call this method immediately after the Server is constructed.

Because they cannot be managed by the domain administration framework, standalone Servers should be used for test purposes only.

Parameters:
name - the name of the Server
serviceName - the name of the default service used by this Server; this service must be already started
schemaPassword - the schema password for this service
parameterTable - the Server configuration parameters
logWriter - the PrintWriter used for logging; if null, log output is sent to System.out
logLevel - the desired logging level
Throws:
IfsException - (IFS-45201) if the operation fails

initialize

public void initialize()
                throws java.lang.Exception
Initializes this Server.

This method is called when the Server is first loaded. Unless overridden, no operation is performed.

If this method throws an exception, loading of the Server is aborted.

Throws:
java.lang.Exception - if the operation fails

getParameterTable

public final ParameterTable getParameterTable()
                                       throws IfsException
Gets the configuration parameters for this Server.

The configuration parameters are provided by the iFS node in loading the Server, and are immutable.

Returns:
the Server configuration parameters
Throws:
IfsException - (IFS-45202) if the operation fails

getCredential

public final Credential getCredential(java.lang.String name)
                               throws IfsException
Gets a Credential for the specified user.

A TokenCredential is returned. In this way, this Server can obtain a valid Credential for any iFS user without that user's password.

The generated TokenCredential is valid for one use or 60 seconds, whichever comes first.

Parameters:
name - the user name
Returns:
the Credential
Throws:
IfsException - (IFS-45206) if the operation fails

getNodeName

public final java.lang.String getNodeName()
                                   throws IfsException
Gets the name of the node for this Server.
Returns:
the node name
Throws:
IfsException - (IFS-45209) if the operation fails

getOracleHome

public java.lang.String getOracleHome()
                               throws IfsException
Gets the Oracle home directory for this Server's node.

The Oracle home directory is specified by the node's IFS.DOMAIN.NODE.OracleHome parameter. (For standalone Servers, the Oracle home directory is specified by the server's parameter named IFS.DOMAIN.NODE.OracleHome.)

Returns:
the Oracle home directory
Throws:
IfsException - (IFS-45208) if the operation fails

log

public void log(int level,
                java.lang.String message)
Logs the specified message.
Parameters:
level - the minimum logging level for the message to be logged
message - the message

log

public void log(int level,
                java.lang.Throwable throwable)
Logs the specified throwable.
Parameters:
level - the minimum logging level for the message to be logged
throwable - the throwable

log

public void log(int level,
                java.lang.String message,
                java.lang.Throwable throwable)
Logs the specified message and throwable, as a single log entry.
Parameters:
level - the minimum logging level for the message to be logged
message - the message
throwable - the throwable

isLogged

public boolean isLogged(int level)
Gets whether calling log with the specified logging level would cause a message to be logged.
Parameters:
level - the logging level
Returns:
whether a message would be logged

verifyNotDisposed

protected final void verifyNotDisposed()
                                throws IfsException
Verifies this Server has not been disposed.

The getStatus method is called to check the status of this Server.

Invoking methods on a disposed Server (other than getStatus, getName and deregister) is illegal and should throw an exception. Call this method to perform that check.

Throws:
IfsException - (IFS-45203) if this Server has been disposed

deregister

protected final void deregister()
                         throws IfsException
Deregisters this Server.

Call this method upon disposing this Server to remove it from the list of Servers for the iFS node.

Throws:
IfsException - (IFS-45205) if the operation fails

getName

public java.lang.String getName()
                         throws IfsException
Gets the name of this Server.
Specified by:
getName in interface ServerInterface
Returns:
the name
Throws:
IfsException - (IFS-45160) if the operation fails

getServiceName

public java.lang.String getServiceName()
                                throws IfsException
Gets the name of the default service for this Server.
Specified by:
getServiceName in interface ServerInterface
Returns:
the service name
Throws:
IfsException - (IFS-45175) if the operation fails

toStatusLabel

public static java.lang.String toStatusLabel(int status)
                                      throws IfsException
Gets a localized label for the specified status of a Server, using the default Localizer.

Equivalent to toStatusLabel(status, Localizer.getDefault()).

Parameters:
status - the status
Returns:
the label
Throws:
IfsException - if the operation fails

toStatusLabel

public static java.lang.String toStatusLabel(int status,
                                             LibrarySessionInterface session)
                                      throws IfsException
Gets a localized label for the specified status of a Server, using the specified session's Localizer.

Equivalent to toStatusLabel(status, session.getLocalizer()).

Parameters:
status - the status
session - the session
Returns:
the label
Throws:
IfsException - if the operation fails

toStatusLabel

public static java.lang.String toStatusLabel(int serverStatus,
                                             Localizer localizer)
                                      throws IfsException
Gets a localized label for the specified status of a Server, using the specified Localizer.

If localizer is null, this method is equivalent to toStatusLabel(status, new Localizer()).

Parameters:
status - the status
localizer - the Localizer
Returns:
the label
Throws:
IfsException - if the operation fails

Oracle Content Management SDK

(c) 2002 Copyright Oracle Corporation. All rights reserved.