# AdminService.java

    /*
    ** Module   : AdminService.java
    ** Abstract : AdminService defines the remote server administration interface.
    **
    ** Copyright (c) 2017-2025, Golden Code Development Corporation.
    **
    ** -#- -I- --Date-- ------------------------------Description----------------------------------
    ** 001 HC  20170116 Initial version.
    ** 002 GBB 20230825 Adding OS users methods.
    ** 003 GBB 20241010 Adding appservers methods.
    ** 004 GBB 20250403 Adding terminateSessions.
    */
    /*
    ** This program is free software: you can redistribute it and/or modify
    ** it under the terms of the GNU Affero General Public License as
    ** published by the Free Software Foundation, either version 3 of the
    ** License, or (at your option) any later version.
    **
    ** This program is distributed in the hope that it will be useful,
    ** but WITHOUT ANY WARRANTY; without even the implied warranty of
    ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ** GNU Affero General Public License for more details.
    **
    ** You may find a copy of the GNU Affero GPL version 3 at the following
    ** location: https://www.gnu.org/licenses/agpl-3.0.en.html
    **
    ** Additional terms under GNU Affero GPL version 3 section 7:
    **
    **   Under Section 7 of the GNU Affero GPL version 3, the following additional
    **   terms apply to the works covered under the License.  These additional terms
    **   are non-permissive additional terms allowed under Section 7 of the GNU
    **   Affero GPL version 3 and may not be removed by you.
    **
    **   0. Attribution Requirement.
    **
    **     You must preserve all legal notices or author attributions in the covered
    **     work or Appropriate Legal Notices displayed by works containing the covered
    **     work.  You may not remove from the covered work any author or developer
    **     credit already included within the covered work.
    **
    **   1. No License To Use Trademarks.
    **
    **     This license does not grant any license or rights to use the trademarks
    **     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
    **     of Golden Code Development Corporation. You are not authorized to use the
    **     name Golden Code, FWD, or the names of any author or contributor, for
    **     publicity purposes without written authorization.
    **
    **   2. No Misrepresentation of Affiliation.
    **
    **     You may not represent yourself as Golden Code Development Corporation or FWD.
    **
    **     You may not represent yourself for publicity purposes as associated with
    **     Golden Code Development Corporation, FWD, or any author or contributor to
    **     the covered work, without written authorization.
    **
    **   3. No Misrepresentation of Source or Origin.
    **
    **     You may not represent the covered work as solely your work.  All modified
    **     versions of the covered work must be marked in a reasonable way to make it
    **     clear that the modified work is not originating from Golden Code Development
    **     Corporation or FWD.  All modified versions must contain the notices of
    **     attribution required in this license.
    */

    package com.goldencode.p2j.admin.shared;

    import java.io.*;
    import java.util.*;

    import com.goldencode.p2j.admin.*;
    import com.google.gwt.user.client.rpc.*;
    import com.google.gwt.core.client.GWT;
    import com.google.gwt.view.client.*;

    /**
     * Defines the remote server administration interface.
     */
    @RemoteServiceRelativePath("AdminService")
    public interface AdminService
    extends RemoteService
    {
       /**
        * Returns the server's name.
        *
        * @return   This server's name
        */
       public String getServerName();

       /**
        * Tells whether the server can modify the directory.
        * Only the master server can. The others have read-only access to
        * the directory.
        *
        * @return   <code>true</code> if it can
        */
       public boolean isMaster();

       /**
        * Sets the live server's directory as the target.
        *
        * @param   stayCurrent
        *          if <code>true</code>, all operations affect the most current
        *          generation of the security cache, otherwise they affect
        *          the generation attached to the admin session
        *
        * @return  security cache generation serial number
        */
       public int setTargetLive(boolean stayCurrent);

       /**
        * Sets the specified directory file as the offline target.
        * The file can't be the live directory file.
        *
        * @param   name
        *          name of a directory file to use as the target
        *
        * @param   create
        *          <code>true</code> means a new directory file should be created,
        *          otherwise the named directory file should exist.
        *
        * @return  <code>true</code> if the new target was set successfully
        */
       public boolean setTargetFile(String name, boolean create);

       /**
        * Refreshes the current security cache if the target is the live directory
        * and only if there were changes performed since the last call to the
        * targetRefresh().
        *
        * @return  Security cache generation number. The same number as before
        *          means the cache was not refreshed.
        */
       public int targetRefresh();

       /**
        * Check if there is pending security cache refresh.
        *
        * @return   <code>true</code> if refresh is pending and <code>false</code>
        *           is there is no pending refresh or current user has not enough
        *           rights to perform it.
        */
       public boolean isRefreshPending();

       /**
        * Check if current user can perform a refresh.
        *
        * @return   <code>true</code> user has enough rights to perform refresh.
        */
       public boolean canRefresh();

       /**
        * Returns an array of messages accumulated since the previous call or
        * all messages since the last message cleanup.
        * Messages can be retrieved multiple times. New messages are moved to the
        * saved messages category after the first retrieval.
        *
        * @param all
        *           if <code>true</code>, then old and new messages are retrieved,
        *           otherwise new messages only
        *
        * @return   array of messages, that can be empty
        */
       public String[][] getMessages(boolean all);

       /**
        * Returns the most recent server message without changing its state
        * on the server.
        *
        * @return   message or <code>null</code> if nothing is generated
        */
       public String peekMessage();

       /**
        * Clears the old messages saved on the server, if any.
        * New messages are not affected and will be returned with the next call
        * to getMessages().
        */
       public void clearMessages();

       /**
        * Returns the configuration information about the administration interface
        * itself.
        * This information should be used to get access to the custom admin
        * extensions
        *
        * @return   container with admin related configuration information
        */
       public AdminDef getAdminDef();

       /**
        * Returns the admin permissions profile for an arbitrary set of resource
        * instance names.
        *
        * @param name
        *        array of admin non-leaf resource instance names to query
        *
        * @return permissions for the given names or <code>null</code>
        */
       public AdminProfile[] getProfile(String[] name);

       /**
        * Returns the admin permissions profile for an arbitrary set of permissions
        * for a resource instance name.
        *
        * @param name
        *        admin leaf resource instance name to query
        *
        * @param perm
        *        array of permissions to query
        *
        * @return permissions for the given name or <code>null</code>
        */
       public AdminProfile[] getProfile(String name, int[] perm);

       //
       // Live System Console API
       //

       /**
        * Backup the directory into a new file.
        *
        * @param    newfile
        *           name of a backup file to create
        *
        * @return   <code>true</code> if backup was successful.
        */
       public boolean backupDirectory(String newfile);

       /**
        * Lock directory for rereading from the file.
        *
        * @param    seconds
        *           Seconds to wait before lock will expire.
        *
        * @return   <code>true</code> if lock was successful.
        */
       public boolean lockForRereadDir(int seconds);

       /**
        * Reread the directory file into the backend's cache after obtaining
        * a refresh lock.
        *
        * @return   error code. Following error codes are possible:
        *           <ol>
        *           <li>{@link AdminConstants#ERR_NO_LOCK} - is returned when no lock is present</li>
        *           <li>{@link AdminConstants#ERR_LOCK_EXPIRED}- is returned if lock is present
        *           but it is expired or belongs to other thread.</li>
        *           <li>{@link AdminConstants#ERR_CANT_REFRESH_BACKEND} - is returned when
        *           backend can't update directory.</li>
        *           <li>{@link AdminConstants#ERR_ILLEGAL} - is returned when no rights etc</li>
        *           </ol>
        */
       public int rereadDirectory();

       /**
        * Cancel (possibly) planned refreshing operation.
        */
       public void cancelRereadDir();

       /**
        * Creates a report of all current user and process sessions.
        *
        * @return   Session descriptors suitable for reporting purposes or
        *           <code>null</code> if insufficient rights exist to obtain the
        *           list.
        */
       public SessionInfo[] getSessionList();

       /**
        * Forcibly terminate the specified session.
        *
        * @param    sid
        *           Session identifier.
        */
       public void terminateSession(int sid);

       /**
        * Creates a report of all record locks for the server.
        *
        * @return   Record lock descriptors suitable for reporting purposes or
        *           <code>null</code> if insufficient rights exist to obtain the
        *           list.
        */
       public RecordLockInfo[] getRecordLockList();

       /**
        * Get the list of databases managed by this P2J server.
        *
        * @return  Names of databases managed by this P2J server.
        */
       public String[] getDatabases();

       /**
        * Get the list of tables of the given database.
        *
        * @param   database
        *          Target database.
        *
        * @return  See above.
        *          Names of the tables of the given database.
        */
       public String[] getDatabaseTables(String database);

       /**
        * Lock the specified records. Locks are obtained in a single batch.<p>
        * You can unlock records using {@link #unlockRecords()}.
        *
        * @param   records
        *          Records to lock.
        *
        * @return  <code>true</code> if records were successfully locked.
        */
       public boolean lockRecords(RecordInfo[] records);

       /**
        * Unlock the records which has been previously locked in the given context
        * using {@link #lockRecords}.
        *
        * @return <code>true</code> if records were successfully unlocked.
        */
       public boolean unlockRecords();

       /**
        * Gets the records which have been previously locked in the given context
        * using {@link #lockRecords}.
        *
        * @return   Locked records in the given context.
        */
       public RecordInfo[] getLockRecords();

       /**
        * Shuts the server down.
        *
        * @return  <code>true</code> if successful
        */
       public boolean shutdown();

       //
       // General Server Configuration API
       //

       /**
        * Returns an array of resource plugin names.
        *
        * @return   All defined resource plugin names
        */
       public String[] listResourceNames();

       /**
        * Returns the registered resource type name for the given resource plugin.
        *
        * @param name
        *        plugin name
        *
        * @return registered resource type name or <code>null</code> if no match
        */
       public String getResourceType(String name);

       /**
        * Modifies resource name definitions.
        *
        * @param   additions
        *          array of resource names to add or <code>null</code>
        *          if no additions are specified
        * @param   deletions
        *          array of resource names to delete or <code>null</code>
        *          if no deletions are specified
        * @return  boolean success indicator
        */
       public boolean changeResourceNames(String[] additions, String[] deletions);

       /**
        * Gets authentication configuration, which includes authentication mode,
        * password aging and security tracing level.
        *
        * @return   an instance with all current authentication values
        */
       public AuthConfigDef getAuthConfig();

       /**
        * Sets authentication configuration from the specified instance, which
        * includes authentication mode, password aging and security tracing level.
        *
        * @param   authConfig
        *          an instance loaded with the required configuration
        *
        * @return  boolean success indicator
        */
       public boolean setAuthConfig(AuthConfigDef authConfig);

       /**
        * Returns an array of defined holidays.
        *
        * @return   All defined holidays
        */
       public Date[] listHolidays();

       /**
        * Modifies defined holidays.
        *
        * @param   additions
        *          array of dates to add or <code>null</code>
        *          if no additions are specified
        * @param   deletions
        *          array of dates to delete or <code>null</code>
        *          if no deletions are specified
        *
        * @return  boolean success indicator
        */
       public boolean changeHolidays(Date[] additions, Date[] deletions);

       /**
        * Gets the audit.
        *
        * @return   The audit
        */
       public AuditDef getAudit();

       /**
        * Sets the audit.
        *
        * @param    audit
        *           The audit
        *
        * @return   True, iff this action is completed successfully
        */
       public boolean setAudit(AuditDef audit);

       //
       // Accounts Management API
       //

       /**
        * Returns an array of defined group names.
        *
        * @return   All defined group accounts or <code>null</code>
        */
       public TaggedName[] listGroups();

       /**
        * Check the group account existence.
        *
        * @param    name
        *           group name
        *
        * @return   minimum group information (name, description)
        *           or <code>null</code> if the named group does not exist
        */
       public TaggedName checkGroup(String name);

       /**
        * Returns the group definition for the specified group name.
        *
        * @param    name
        *           group name
        *
        * @return   group definition or <code>null</code> if no such group
        */
       public GroupDef getGroup(String name);

       /**
        * Changes the group definition for the named group.
        *
        * @param    group
        *           group definition
        *
        * @return   <code>true</code> if successfully changed the group
        */
       public boolean setGroup(GroupDef group);

       /**
        * Adds new group account definition.
        *
        * @param    group
        *           group definition for a new account
        *
        * @return   <code>true</code> if successfully added the group
        */
       public boolean addGroup(GroupDef group);

       /**
        * Deletes a group account definition.
        * The account is deleted. All references to this group are deleted from
        * the user accounts and from ACLs.
        *
        * @param    name
        *           group name for the group being deleted
        *
        * @return   <code>true</code> if successfully deleted the group
        */
       public boolean deleteGroup(String name);

       /**
        * Clones an existing group account into a new one.
        * Users of the source group become also the users of the clone.
        * ACLs are modified to give the source group's rights to the clone, if
        * this option is requested.
        *
        * @param    nameFrom
        *           group name for the source group
        *
        * @param    nameTo
        *           group name for the clone
        *
        * @param    acls
        *           <code>true</code> tells to clone ACLs as well
        *
        * @return   <code>true</code> if successfully cloned the group
        */
       public boolean cloneGroup(String nameFrom, String nameTo, boolean acls);

       /**
        * Enumerates the users of a named group.
        *
        * @param    name
        *           group name
        *
        * @return   array of user names, that may be empty, or <code>null</code>
        *           if there is no such group
        */
       public TaggedName[] listGroupUsers(String name);

       /**
        * Changes the group by adding and/or removing users.
        *
        * @param    name
        *           group name
        *
        * @param    additions
        *           array of user names to be added to the group; may be empty
        *
        * @param    deletions
        *           array of user names to be excluded from the group;
        *           may be empty
        *
        * @return   <code>true</code> if successfully changed the group
        */
       public boolean changeGroupUsers(String name, String[] additions,
                                              String[] deletions);

       /**
        * Returns an array of defined user account names and their owners.
        *
        * @return   All defined user accounts or <code>null</code>
        */
       public TaggedName[] listUsers();

       /**
        * Check the user account existence.
        *
        * @param    name
        *           user account name
        *
        * @return   minimum user account information (name, person)
        *           or <code>null</code> if the named account does not exist
        */
       public TaggedName checkUser(String name);

       /**
        * Returns the user account definition for the specified account name.
        *
        * @param    name
        *           user account name
        *
        * @return   user account definition or <code>null</code> if no such user
        */
       public UserDef getUser(String name);

       /**
        * Changes the user account definition for the named account.
        * Optional fields are synchronized with the directory. Password aging
        * information is set only if a password is set.
        * Any existing custom account extensions remain unchanged.
        *
        * @param    user
        *           user account definition
        *
        * @return   <code>true</code> if successfully changed the account
        */
       public boolean setUser(UserDef user);

       /**
        * Changes the user account definition for the named account.
        * Optional fields are synchronized with the directory. Password aging
        * information is set only if a password is set.
        *
        * @param    user
        *           user account definition
        *
        * @param    ext
        *           optional extension container for custom account extensions
        *
        * @return   <code>true</code> if successfully changed the account
        */
       public boolean setUser(UserDef user, Serializable ext);

       /**
        * Adds new user account definition.
        *
        * @param    user
        *           user account definition
        *
        * @param    ext
        *           optional extension container for custom account extensions
        *
        * @return   <code>true</code> if successfully added the account
        */
       public boolean addUser(UserDef user, Serializable ext);

       /**
        * Deletes a user account definition.
        * The account is deleted. All references to this account are deleted from
        * the ACLs, but the associated user certificate is left untouched.
        *
        * @param    name
        *           user account name being deleted
        *
        * @return   <code>true</code> if successfully deleted the account
        */
       public boolean deleteUser(String name);

       /**
        * Clones an existing user account into a new one, password included.
        * ACLs are modified to give the source user rights to the clone, if
        * this option is requested.
        *
        * @param    nameFrom
        *           user account name for the source
        *
        * @param    nameTo
        *           user account name for the clone
        *
        * @param    acls
        *           <code>true</code> tells to clone ACLs as well
        *
        * @return   <code>true</code> if successfully cloned the user account
        */
       public boolean cloneUser(String nameFrom, String nameTo, boolean acls);

       /**
        * Clones an existing user account into a new one and assigns the provided
        * password to the clone.
        * ACLs are modified to give the source user rights to the clone, if
        * this option is requested.
        *
        * @param    nameFrom
        *           user account name for the source
        *
        * @param    nameTo
        *           user account name for the clone
        *
        * @param    acls
        *           <code>true</code> tells to clone ACLs as well
        *
        * @param    newPassword
        *           a replacement password for the clone
        *
        * @return   <code>true</code> if successfully cloned the user account
        */
       public boolean cloneUser(String nameFrom, String nameTo, boolean acls,
                                String newPassword);

       /**
        * Enumerates the groups the named user is part of.
        *
        * @param    name
        *           user account name
        *
        * @return   array of tagged group names, that may be empty,
        *           or <code>null</code> if there is no such user etc
        */
       public TaggedName[] listUserGroups(String name);

       /**
        * Returns an array of defined OS user names and their hashed passwords.
        *
        * @return   All defined OS users or <code>null</code>
        */
       public TaggedName[] listOsUsers();

       /**
        * Check the user account existence.
        *
        * @param    name
        *           Os user account name
        *
        * @return   Minimum OS user account information  or <code>null</code> if the account doesn't exist
        */
       public TaggedName checkOsUser(String name);

       /**
        * Returns the OS user account definition for the specified account name.
        *
        * @param    name
        *           OS user account name
        *
        * @return   OS user account definition or <code>null</code> if no such user
        */
       public OsUserDef getOsUser(String name);

       /**
        * Deletes an OS user account definition. The account is deleted. All
        * references to this account are deleted from the ACLs, but the associated
        * user certificate is left untouched.
        *
        * @param    name
        *           OS user account name being deleted
        *
        * @return   {@code true} if successfully deleted the account
        */
       public boolean deleteOsUser(String name);

       /**
        * Adds the OS user.
        *
        * @param    user
        *           the user
        *
        * @return   <code>true</code> if successfully added the user
        */
       public boolean addOsUser(OsUserDef user);

       /**
        * Sets the OS user.
        *
        * @param    user
        *           the user
        *
        * @return   <code>true</code> if successfully changed the user
        */
       public boolean setOsUser(OsUserDef user);

       /**
        * Returns an array of defined FWD user names, associated with the OS user.
        *
        * @param    osUser
        *           The OS user name
        *
        * @return   The associated FWD users or <code>null</code>
        */
       public TaggedName[] listAssociatedFwdUsers(String osUser);

       /**
        * Returns an array of defined process names with their descriptions.
        *
        * @return   All defined processes accounts or <code>null</code>
        */
       public TaggedName[] listProcesses();

       /**
        * Check the process account existence.
        *
        * @param    name
        *           process account name
        *
        * @return   minimum process account information (name, description)
        *           or <code>null</code> if the named account does not exist
        */
       public TaggedName checkProcess(String name);

       /**
        * Returns the process definition for the specified process name.
        *
        * @param    name
        *           process name
        *
        * @return   process definition or <code>null</code> if no such process
        */
       public ProcessDef getProcess(String name);

       /**
        * Changes the process definition for the named process.
        * Any existing custom account extensions remain unchanged.
        *
        * @param    process
        *           process definition
        *
        * @return   <code>true</code> if successfully changed the process
        */
       public boolean setProcess(ProcessDef process);

       /**
        * Changes the process definition for the named process.
        *
        * @param    process
        *           process definition
        *
        * @param    ext
        *           optional extension container for custom account extensions
        *
        * @return   <code>true</code> if successfully changed the process
        */
       public boolean setProcess(ProcessDef process, Serializable ext);

       /**
        * Adds new process account definition.
        *
        * @param    process
        *           process definition for a new account
        *
        * @param    ext
        *           optional extension container for custom account extensions
        *
        * @return   <code>true</code> if successfully added the process
        */
       public boolean addProcess(ProcessDef process, Serializable ext);

       /**
        * Deletes a process account definition.
        * The account is deleted. All references to this process are deleted from
        * the ACLs, but the associated process certificate is left untouched.
        *
        * @param    name
        *           process account name being deleted
        *
        * @return   <code>true</code> if successfully deleted the process
        */
       public boolean deleteProcess(String name);

       /**
        * Clones an existing process account into a new one.
        * Master server flag is always false for the clone.
        * ACLs are modified to give the source process' rights to the clone, if
        * this option is requested.
        *
        * @param    nameFrom
        *           process name for the source
        *
        * @param    nameTo
        *           process name for the clone
        *
        * @param    acls
        *           <code>true</code> tells to clone ACLs as well
        *
        * @return   <code>true</code> if successfully cloned the process
        */
       public boolean cloneProcess(String nameFrom, String nameTo, boolean acls);

       /**
        * Returns an array of defined Certificate Authority certificates
        * with their distinctive names.
        *
        * @param unusedOnly
        *        if <code>true</code>, lists unused certificates only, otherwise
        *        all certificates
        *
        * @return   All defined CA certificates or <code>null</code>
        */
       public TaggedName[] listAuthCerts(boolean unusedOnly);

       /**
        * Returns an array of defined peer (non-CA) certificates
        * with their distinctive names.
        *
        * @param unusedOnly
        *        if <code>true</code>, lists unused certificates only, otherwise
        *        all certificates
        *
        * @return   All defined peer certificates or <code>null</code>
        */
       public TaggedName[] listPeerCerts(boolean unusedOnly);

       /**
        * Returns an array of user account names with their description for users
        * sharing this certificate.
        *
        * @param alias certificate alias name
        *
        * @return all user accounts referring to this certificate or
        *         <code>null</code>
        */
       public TaggedName[] getCertUsers(String alias);

       /**
        * Returns an array of process account names with their description for
        * processes sharing this certificate.
        *
        * @param alias certificate alias name
        *
        * @return all process accounts referring to this certificate or
        *         <code>null</code>
        */
       public TaggedName[] getCertProcesses(String alias);

       /**
        * Returns an array of all account names with their description for accounts
        * sharing this certificate.
        *
        * @param alias certificate alias name
        *
        * @return all accounts referring to this certificate or
        *         <code>null</code>
        */
       public TaggedName[] getCertAccounts(String alias);

       /**
        * Returns a DER-encoded certificate like those found in *.PEM files.
        *
        * @param alias  the alias of the certificate to get
        *
        * @return the encoded certificate or <code>null</code>
        */
       public CertDef getCert(String alias);

       /**
        * Replaces an existing certificate with the given one.
        *
        * @param cert encoded certificate
        *
        * @return <code>true</code> if replaced, <code>false</code> if errors
        */
       public boolean setCert(CertDef cert);

       /**
        * Adds a new certificate according to its definition.
        *
        * @param cert encoded certificate
        *
        * @return <code>true</code> if added, <code>false</code> if errors
        */
       public boolean addCert(CertDef cert);

       /**
        * Changes the certificate's alias.
        *
        * @param aliasFrom current certificate's alias
        *
        * @param aliasTo new certificate's alias
        *
        * @return <code>true</code> if changed, <code>false</code> if errors
        */
       public boolean moveCert(String aliasFrom, String aliasTo);

       /**
        * Searches the CA directory for an alias of the certificate by the
        * distinctive name of the subject.
        *
        * @param dn distinctive name
        *
        * @return alias of the certificate if exists, or <code>null</code>.
        */
       public String searchCert(String dn);

       /**
        * Deletes an existing certificate conditionally or unconditionally.
        *
        * @param alias  the alias of the certificate being deleted
        *
        * @param force if <code>true</code>, the certificate is deleted even if
        *              in use
        *
        * @return <code>true</code> if deleted, <code>false</code> if errors
        *
        */
       public boolean deleteCert(String alias, boolean force);

       //
       // Access Control List Management API
       //

       /**
        * Locates all instances of ACLs in the directory and returns their names.
        * The shared instance has an empty name.
        * <p>
        * ACL instances are the directory branches that store ACLs. The shared
        * instance is the one found under <code>/security/acl</code> branch.
        * Private instances are found under <code>/security/acls/<i>name</i></code>
        * branches.
        *
        * @return array of ACL instance names; may be empty
        */
       public String[] listAclInstances();

       /**
        * Locates all instances of ACLs in the directory and returns their names
        * for those instances which have ACLs defined for the specified resource
        * type.
        * The shared instance has an empty name.
        * <p>
        * ACL instances are the directory branches that store ACLs. The shared
        * instance is the one found under <code>/security/acl</code> branch.
        * Private instances are found under <code>/security/acls/<i>name</i></code>
        * branches.
        *
        * @param resourceType
        *        name of the resource of interest
        *
        * @return array of ACL instance names; may be empty
        */
       public String[] listAclInstances(String resourceType);

       /**
        * Lists resource names for which the specified ACL instance has ACLs
        * defined.
        *
        * @param instanceName
        *        name of the ACL instance; empty string for the shared one
        *
        * @return array of resource type names; may be empty
        */
       public String[] listInstanceAcls(String instanceName);

       /**
        * Gets the full ACL definition information from the directory for the
        * specified ACL instance and resource type.
        *
        * @param resourceType
        *        name of the resource of interest; can't be <code>null</code>
        *
        * @param instanceName
        *        name of the ACL instance; empty string for the shared one;
        *        can't be <code>null</code>
        *
        * @return ACL definition or <code>null</code>
        */
       public AclDef getAcl(String resourceType, String instanceName);

       /**
        * Gets the full ACL definition information from the directory for the
        * specified ACL instance or all of them.
        *
        * @param instanceName
        *        name of the ACL instance; empty string for the shared one;
        *        if <code>null</code>, all ACLs are returned and some may be
        *        combined
        *
        * @return an array of ACL definitions, one per resource type and instance,
        *         or <code>null</code>
        */
       public AclDef[] getAllAcls(String instanceName);

       /**
        * Gets the combined ACL definition information from the directory for the
        * specified resource type.
        * The combination is done according to the regular server's rules taking
        * the private instance for the live server and the shared one.
        *
        * @param resourceType
        *        name of the resource of interest; can't be <code>null</code>
        *
        * @return ACL definition or <code>null</code>
        */
       public AclDef getEffectiveAcls(String resourceType);

       /**
        * Adds new set of ACLs based on the contents of the given ACL definition.
        * Both the target ACL instance and resource part will be created if they
        * don't exist.
        *
        * @param resourceType
        *        name of the resource to add the ACL for
        *
        * @param acl
        *        ACL definition, that should come fully defined, including the
        *        instance name.
        *
        * @param subjMap
        *        a map to translate numeric subject IDs back to names
        *
        * @return <code>true</code> if added, <code>false</code> if errors
        */
       public boolean addAcl(String resourceType, Acl acl,
                             Map<Integer, String> subjMap);

       /**
        * Conditionally edits the existing ACL based on the contents of the given
        * ACL and the selected conditions.
        *
        * @param resourceType
        *        name of the resource to set the ACL for
        *
        * @param acl
        *        ACL definition
        *
        * @param subjMap
        *        a map to translate numeric subject IDs back to names;
        *        needed only when setSubjects is <code>true</code> and can be
        *        <code>null</code> all other times
        *
        * @param setInstance
        *        <code>true</code> if setting the resource instance name
        *
        * @param setInstanceMode
        *        <code>true</code> if setting the resource instance name mode
        *
        * @param setSubjects
        *        <code>true</code> if setting the subjects IDs
        *
        * @param setRights
        *        <code>true</code> if setting the rights for this ACL
        *
        * @return <code>true</code> if set, <code>false</code> if errors
        */
       public boolean setAcl(String resourceType, Acl acl,
                             Map<Integer, String> subjMap,
                             boolean setInstance, boolean setInstanceMode,
                             boolean setSubjects, boolean setRights);

       /**
        * Moves the specified ACL to another ACL instance, private or shared.
        * The target instance will be created, if it doesn't exist.
        *
        * @param resourceType
        *        name of the resource of interest
        *
        * @param instanceName
        *        name of the source ACL instance; empty string for the shared one
        *
        * @param oid
        *        ACL object ID that selects the ACL to move
        *
        * @param newInstanceName
        *        name of the target ACL instance; empty string for the shared one
        *
        * @return <code>true</code> if moved, <code>false</code> if errors
        */
       public boolean moveAcl(String resourceType, String instanceName, int oid,
                              String newInstanceName);

       /**
        * Moves the specified ACL to another position within the same ACL instance.
        *
        * @param resourceType
        *        name of the resource of interest
        *
        * @param instanceName
        *        name of the source ACL instance; empty string for the shared one
        *
        * @param oid
        *        ACL object ID that selects the ACL to move
        *
        * @param newOid
        *        new ACL object ID
        *
        * @return <code>true</code> if moved, <code>false</code> if errors
        */
       public boolean moveAcl(String resourceType, String instanceName, int oid,
                              int newOid);

       /**
        * Deletes the specified ACL from the specified ACL instance.
        *
        * @param resourceType
        *        name of the resource of interest
        *
        * @param instanceName
        *        name of the source ACL instance; empty string for the shared one
        *
        * @param oid
        *        ACL object ID that selects the ACL to delete
        *
        * @return <code>true</code> if deleted, <code>false</code> if errors
        */
       public boolean deleteAcl(String resourceType, String instanceName, int oid);

       /**
        * Clones the specified ACL to another position within the same ACL instance.
        *
        * @param resourceType
        *        name of the resource of interest
        *
        * @param instanceName
        *        name of the source ACL instance; empty string for the shared one
        *
        * @param oid
        *        ACL object ID that selects the ACL to clone
        *
        * @param cloneOid
        *        ACL object ID for the clone
        *
        * @return <code>true</code> if cloned, <code>false</code> if errors
        */
       public boolean cloneAcl(String resourceType, String instanceName, int oid,
                               int cloneOid);

       /**
        * Assigns new object IDs sequentially for all ACLs in the given ACL instance
        * and resource type.
        *
        * @param resourceType
        *        name of the resource of interest
        *
        * @param instanceName
        *        name of the source ACL instance; empty string for the shared one
        *
        * @param start
        *        the starting number
        *
        * @param step
        *        the increment
        *
        * @return <code>true</code> if success, <code>false</code> if errors
        */
       public boolean resequenceAcls(String resourceType, String instanceName,
                                     int start, int step);

       //
       // Access Control List Management API extension that we may need later
       //

       /**
        * Creates an empty container for the specified ACL instance.
        * The instance should not exist.
        *
        * @param instanceName
        *        name of the ACL instance; empty string for the shared one
        *
        * @return <code>true</code> if created, <code>false</code> if errors
        */
       public boolean addAclInstance(String instanceName);

       /**
        * Deletes entire ACL instance from the directory.
        * The instance should exist.
        *
        * @param instanceName
        *        name of the ACL instance; empty string for the shared one
        *
        * @return <code>true</code> if deleted, <code>false</code> if errors
        */
       public boolean deleteAclInstance(String instanceName);

       /**
        * Deletes the resource specific part of an ACL instance from the directory.
        * The instance and the resource part should exist.
        *
        * @param resourceType
        *        name of the resource of interest
        *
        * @param instanceName
        *        name of the ACL instance; empty string for the shared one
        *
        * @return <code>true</code> if deleted, <code>false</code> if errors
        */
       public boolean deleteAclInstance(String resourceType, String instanceName);

       /**
        * Clones entire ACL instance.
        * The source ACL instance should exist. The target ACL instance should not
        * exist.
        *
        * @param instanceFrom
        *        name of the source ACL instance; empty string for the shared one
        *
        * @param instanceTo
        *        name of the target ACL instance; empty string for the shared one
        *
        * @return <code>true</code> if cloned, <code>false</code> if errors
        */
       public boolean cloneAclInstance(String instanceFrom, String instanceTo);

       /**
        * Clones the resource specific part of an ACL instance.
        * The source ACL instance and the resource part should exist.
        * The target ACL instance should exist.
        * The resource part in the target ACL instance should NOT exist.
        *
        * @param resourceType
        *        name of the resource of interest
        *
        * @param instanceFrom
        *        name of the source ACL instance; empty string for the shared one
        *
        * @param instanceTo
        *        name of the target ACL instance; empty string for the shared one
        *
        * @return <code>true</code> if cloned, <code>false</code> if errors
        */
       public boolean cloneAclInstance(String resourceType, String instanceFrom,
                                       String instanceTo);

       /**
        * Moves entire ACL instance.
        * The source ACL instance should exist. The target ACL instance should not
        * exist.
        *
        * @param instanceFrom
        *        name of the source ACL instance; empty string for the shared one
        *
        * @param instanceTo
        *        name of the target ACL instance; empty string for the shared one
        *
        * @return <code>true</code> if moved, <code>false</code> if errors
        */
       public boolean moveAclInstance(String instanceFrom, String instanceTo);

       /**
        * Moves the resource specific part of an ACL instance.
        * The source ACL instance and the resource part should exist.
        * The target ACL instance should exist.
        * The resource part in the target ACL instance should NOT exist.
        *
        * @param resourceType
        *        name of the resource of interest
        *
        * @param instanceFrom
        *        name of the source ACL instance; empty string for the shared one
        *
        * @param instanceTo
        *        name of the target ACL instance; empty string for the shared one
        *
        * @return <code>true</code> if moved, <code>false</code> if errors
        */
       public boolean moveAclInstance(String resourceType, String instanceFrom,
                                      String instanceTo);

       //
       // Per Server Runtime configuration: default or named
       //

       /**
        * Returns the list of all server instances found in the directory
        * under the "/server" node. The "default" instance is returned as
        * an empty string.
        *
        * @return array of server names
        */
       public String[] listServers();

       /**
        * Returns the list of server instances under the "/server" node, that
        * have the specified container (or nested chain of) as a child.
        *
        * @param containers
        *        one or more container names separated by "/"
        *
        * @return array of server names holding the named containers
        */
       public String[] listServers(String containers);

       /**
        * Get the list of available auth plugins.
        *
        * @return  the list of available auth plugins encoded into tagged names or
        *          <code>null</code> if no plugins are available.
        */
       public TaggedName[] listAuthPlugins();

       /**
        * Preforms bulk update of authentication settings of the accounts of the
        * specified type.
        *
        * @param  targetAccounts
        *         Type of accounts to update. <code>Account.ACC_USER</code> and
        *         <code>Account.ACC_GROUP</code> are supported.
        * @param  excludedAccounts
        *         The list of IDs of the accounts that should NOT be updated. Can
        *         be <code>null</code>.
        * @param  authMode
        *         Authentication mode to set.
        * @param  authPlugin
        *         Authentication plugin to set.
        *
        * @return the number of updated accounts or <code>-1</code> if an error
        *         has occured.
        */
       public int bulkAuthModeUpdate(int targetAccounts,
                                     String[] excludedAccounts,
                                     int authMode,
                                     String authPlugin);

       /**
        * Get the list of registered jars (which represent customer libs).
        *
        * @return the list of registered jar, each returned
        *         <code>TaggedName</code> represents a single jar and contains jar
        *         file name, fully qualified class name of the active hook (it
        *         may be <code>null</code>) and value indicating whether active
        *         hook class matches stored hook class which is
        *         <code>"true"</code> if they match.
        */
       public TaggedName[] getRegisteredJars();

       /**
        * Get the list of jars, which reside in the customer libs directory,
        * but haven't been registered yet and do not present in the server
        * classpath.
        *
        * @return the list of the names of unregistered jar files available for
        *         registration.
        */
       public String[] getUnregisteredJars();

       /**
        * Get the list of classes which reside into the specified jar file and
        * implement the {@link com.goldencode.p2j.main.InitTermListener}
        * interface. These classes can be used as "hook" classes which should
        * be called after the jar representing a customer lib was successfully
        * registered, to initialize it.
        *
        * @param  jar
        *         The name of the target jar file.
        *
        * @return the list of fully qualified names of the classes which reside
        *         into the specified jar and implement the
        *         {@link com.goldencode.p2j.main.InitTermListener} interface.
        */
       public String[] getAvailableJarHookClasses(String jar);

       /**
        * Get hook class specified in the directory for the target jar.
        *
        * @param  jar
        *         The name of the target jar file (should be loaded).
        *
        * @return fully qualified class name of the hook specified in the
        *         directory for the target jar or <code>null</code> if the jar has
        *         no hook specified.
        */
       public String getStoredJarHookClass(String jar);

       /**
        * Register the specified jar file (which represent a customer lib). Also,
        * a "hook" class can be registered for this jar, this class will be called
        * after the jar was successfully registered, to initialize it.
        *
        * @param  jar
        *         The name of the jar file to register.
        * @param  hookClass
        *         Fully qualified name of the "hook" class for this jar, can be
        *         <code>null</code>.
        * @param  storeInDirectory
        *         If <code>true</code> then the jar is registered in the
        *         directory, else only runtime registration is performed.
        *
        * @return operation result.
        */
       public JarOpErrorCode registerJar(String jar,
                                         String hookClass,
                                         boolean storeInDirectory);

       /**
        * Remove registration for the specified jar.
        *
        * @param jar
        *        Jar file which registration should be removed.
        * @param  force
        *         If it is <code>true</code> then any sessions that have executed
        *         API(s) associated to this jar are forcibly terminated. If this
        *         parameter is <code>false</code> then, if the jar has any
        *         sessions that have executed API(s) associated to it, the
        *         function returns
        *         {@link JarOpErrorCode#ACTIVE_SESSIONS_PRESENT}.
        * @param  removeFromDirectory
        *         If <code>true</code> then the jar registration is removed from
        *         the directory, else only runtime deregistration is performed.
        *
        * @return operation result.
        */
       public JarOpErrorCode deregisterJar(String jar,
                                           boolean force,
                                           boolean removeFromDirectory);

       /**
        * Remove jar registration from the directory.
        *
        * @param  jar
        *         The name of the jar to be deregistered.
        * @param  storedHookClass
        *         The name of the hook class which is stored for this jar in the
        *         directory or <code>null</code> if no hook is defined for this
        *         jar.
        *
        * @return operation result code.
        */
       public JarOpErrorCode deregisterJarFromDirectory(String jar,
                                                        String storedHookClass);

       /**
        * Change the server-wide or global hook class of the specific jar.
        *
        * @param  jar
        *         The name of the target jar file.
        * @param  hookClass
        *         The new hook class for the target jar. <code>null</code>
        *         indicates that no hook class should be specified.
        *
        * @return operation result.
        */
       public JarOpErrorCode changeJarHookClass(String jar, String hookClass);

       /**
        * Get the list of APIs registered for the specified jar.
        *
        * @param  jar
        *         The name of the target jar file.
        *
        * @return the list of APIs registered for the specified jar, each returned
        *         TaggedName represents a single API and contains fully qualified
        *         name of the interface and fully qualified name of the
        *         implementation class.
        */
       public TaggedName[] getRegisteredJarAPIs(String jar);

       /**
        * Get the list of interfaces available in the specified jar file.
        *
        * @param  jar
        *         The name of the target jar file.
        * @param  showRegistered
        *         If <code>true</code> then resulting list contains interfaces
        *         that have already have been registered for an API for the given
        *         jar (assuming that each API is defined using an unique
        *         interface).
        *
        * @return the list of fully qualified names of interfaces available in the
        *         specified jar file.
        */
       public String[] getAvailableJarAPIInterfaces(String jar,
                                                    boolean showRegistered);

       /**
        * Get the list of classes which reside in the specified jar and
        * statically implement all methods defined by the specified interface.
        *
        * @param  jar
        *         The name of the target jar file.
        * @param  interfaceClass
        *         Fully qualified name of the target interface.
        *
        * @return the list of fully qualified names of classes which reside in the
        *         specified jar and statically implement all methods defined by
        *         the specified interface.
        */
       public String[] getAvailableJarAPIImplClasses(String jar,
                                                     String interfaceClass);

       /**
        * Register API specified by the given interface and implementation class.
        *
        * @param  interfaceClass
        *         Fully qualified name of the interface which defines the target
        *         API.
        * @param  implementationClass
        *         Fully qualified name of the class which implements the target
        *         API.
        *
        * @return operation result.
        */
       public JarOpErrorCode registerJarAPI(String interfaceClass,
                                            String implementationClass);

       /**
        * Remove registration of the specified API in the specified jar.
        *
        * @param  jar
        *         The name of the target jar file.
        * @param  interfaceClass
        *         Fully qualified name of the interface which defines the target
        *         API.
        * @param  force
        *         If it is <code>true</code> then any sessions that have executed
        *         the target API are forcibly terminated. If this parameter is
        *         <code>false</code> then, if the jar has any
        *         sessions that have executed API(s) associated to it, the
        *         function returns
        *         {@link JarOpErrorCode#ACTIVE_SESSIONS_PRESENT}.
        *
        * @return operation result.
        */
       public JarOpErrorCode deregisterJarAPI(String jar,
                                              String interfaceClass,
                                              boolean force);

       /**
        * Make the current server use server-wide or global hooks, optionally
        * copying or moving hooks from one scope to another.
        *
        * @param  serverWide
        *         if <code>true</code> then server-wide hooks should be used,
        *         else global hooks should be used.
        * @param  move
        *         if <code>true</code> then existing hooks are copied/moved from
        *         one scope to another, otherwise they don't.
        *
        * @return operation result.
        */
       public JarOpErrorCode changeJarHooksType(boolean serverWide,
                                                    boolean move);

       /**
        * Get the list of all active sessions which have executed the specified
        * API or API(s) associated to the specified jar.
        *
        * @param   jar
        *          The name of the target jar file.
        * @param   apiInterfaceClass
        *          Fully qualified name of the interface which defines the target
        *          API. Can be <code>null</code> if you want to get sessions of
        *          all APIs of the target jar.
        *
        * @return  the list of all active sessions which have executed the
        *          specified API or API(s) associated to the specified jar.
        */
       public SessionInfo[] getActiveSessions(String jar,
                                              String apiInterfaceClass);

       /**
        * Returns information whether server-wide or global hooks are used for
        * the current server.
        *
        * @return <code>true</code> if server-wide hooks are used,
        *         <code>false</code> if global hooks are used, <code>null</code>
        *         if you have insufficient access rights.
        */
       public Boolean isUsingServerWideHooks();

       /**
        * Allows to determine whether
        * {@link com.goldencode.p2j.classloader.MultiClassLoader} is used as the
        * system class loader.
        *
        * @return <code>true</code> if
        *         {@link com.goldencode.p2j.classloader.MultiClassLoader} is used
        *         as the system class loader, <code>false</code> if the standard
        *         class loader is used, <code>null</code> if you do not have
        *         enough permissions
        */
       public Boolean isUsingMultiClassLoader();

       /**
        * Get information about managed libraries directory (path to it and
        * information whether it exists).
        *
        * @return TaggedName which contains fully qualified path to the managed
        *         libraries directory and string value which is
        *         <code>"true"</code> if this directory exists and is accessible.
        *         If you do not have admin rights, <code>null</code> is returned.
        */
       public TaggedName getManagedLibsDirInformation();

       /**
        * Returns the list of logging instances.
        *
        * @return   The list of logging instances.
        */
       public String[] listLoggingInstances();

       /**
        * Returns the logging definition by the given name.
        *
        * @param    name
        *           The given name
        *
        * @return   The target logging definition.
        */
       public LoggingDef getLogging(String name);

       /**
        * Sets the logging definition.
        *
        * @param    logging
        *           The logging definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean setLogging(LoggingDef logging);

       /**
        * Adds the logging definition for the given name
        *
        * @param    name
        *           The given name
        * @param    logging
        *           The logging definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean addLogging(String name, LoggingDef logging);

       /**
        * Clones the logging definition from the source to the target.
        *
        * @param    nameFrom
        *           The source name
        * @param    nameTo
        *           The target name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean cloneLogging(String nameFrom, String nameTo);

       /**
        * Moves the logging definition from the source to the target.
        *
        * @param    nameFrom
        *           The source name
        * @param    nameTo
        *           The target name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean moveLogging(String nameFrom, String nameTo);

       /**
        * Deletes the logging definition of the given name.
        *
        * @param    name
        *           The given name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean deleteLogging(String name);

       /**
        * Returns the list of export instances.
        *
        * @return   The string array of export instances.
        */
       public String[] listExportsInstances();

       /**
        * Returns the export definition by the given export instance name.
        *
        * @param    name
        *           The given export instance name
        *
        * @return   The export definition
        */
       public ExportsDef getExports(String name);

       /**
        * Sets the export definition.
        *
        * @param    logging
        *           The export definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean setExports(ExportsDef logging);

       /**
        * Adds the export definition for the given name
        *
        * @param    name
        *           The given name
        * @param    logging
        *           The export definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean addExports(String name, ExportsDef logging);

       /**
        * Clones the export definition from the source to the target.
        *
        * @param    nameFrom
        *           The source name
        * @param    nameTo
        *           The target name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean cloneExports(String nameFrom, String nameTo);

       /**
        * Moves the export definition from the source to the target.
        *
        * @param    nameFrom
        *           The source name
        * @param    nameTo
        *           The target name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean moveExports(String nameFrom, String nameTo);

       /**
        * Deletes the export definition of the given name.
        *
        * @param    name
        *           The given name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean deleteExports(String name);

       /**
        * Returns the list of startup instances.
        *
        * @return   The string array of startup instances.
        */
       public String[] listStartupInstances();

       /**
        * Returns the startup definition by the given startup instance name.
        *
        * @param    name
        *           The given startup instance name
        *
        * @return   The startup definition
        */
       public StartupDef getStartup(String name);

       /**
        * Sets the startup definition.
        *
        * @param    startup
        *           The startup definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean setStartup(StartupDef startup);

       /**
        * Adds the startup definition for the given instance name
        *
        * @param    name
        *           The given name
        * @param    startup
        *           The startup definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean addStartup(String name, StartupDef startup);

       /**
        * Clones the startup definition from the source to the target.
        *
        * @param    nameFrom
        *           The source name
        * @param    nameTo
        *           The target name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean cloneStartup(String nameFrom, String nameTo);

       /**
        * Moves the startup definition from the source to the target.
        *
        * @param    nameFrom
        *           The source name
        * @param    nameTo
        *           The target name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean moveStartup(String nameFrom, String nameTo);

       /**
        * Deletes the startup definition of the given name.
        *
        * @param    name
        *           The given name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean deleteStartup(String name);

       /**
        * Returns the list of persistence instances.
        *
        * @return   The string array of persistence instances.
        */
       public String[] listPersistenceInstances();

       /**
        * Returns the persistence definition by the given persistence instance name.
        *
        * @param    name
        *           The given persistence instance name
        *
        * @return   The persistence definition
        */
       public PersistenceDef getPersistence(String name);

       /**
        * Sets the persistence definition.
        *
        * @param    persistence
        *           The persistence definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean setPersistence(PersistenceDef persistence);

       /**
        * Adds the persistence definition for the given instance name
        *
        * @param    name
        *           The given name
        * @param    persistence
        *           The persistence definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean addPersistence(String name, PersistenceDef persistence);

       /**
        * Clones the persistence definition from the source to the target.
        *
        * @param    nameFrom
        *           The source name
        * @param    nameTo
        *           The target name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean clonePersistence(String nameFrom, String nameTo);

       /**
        * Moves the persistence definition from the source to the target.
        *
        * @param    nameFrom
        *           The source name
        * @param    nameTo
        *           The target name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean movePersistence(String nameFrom, String nameTo);

       /**
        * Deletes the persistence definition of the given name.
        *
        * @param    name
        *           The given name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean deletePersistence(String name);

       /**
        * Returns the list of database instances.
        *
        * @return   The string array of database instances.
        */
       public String[] listDatabaseInstances();

       /**
        * Returns the database definition by the given database instance name.
        *
        * @param    name
        *           The given database instance name
        *
        * @return   The database definition
        */
       public DatabaseDef getDatabase(String name);

       /**
        * Sets the database definition.
        *
        * @param    database
        *           The database definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean setDatabase(DatabaseDef database);

       /**
        * Adds the database definition for the given instance name
        *
        * @param    name
        *           The given name
        * @param    database
        *           The database definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean addDatabase(String name, DatabaseDef database);

       /**
        * Clones the database definition from the source to the target.
        *
        * @param    nameFrom
        *           The source name
        * @param    nameTo
        *           The target name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean cloneDatabase(String nameFrom, String nameTo);

       /**
        * Moves the database definition from the source to the target.
        *
        * @param    nameFrom
        *           The source name
        * @param    nameTo
        *           The target name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean moveDatabase(String nameFrom, String nameTo);

       /**
        * Deletes the database definition of the given database name.
        *
        * @param    name
        *           The given database name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean deleteDatabase(String name);

       //
       // Per Account/Server Runtime configuration: default or named
       //

       /**
        * Returns the list of runtime names.
        *
        * @return   The string array of runtime names.
        */
       public String[] listRuntimeNames();

       /**
        * Returns the list of runtime servers.
        *
        * @return   The string array of runtime servers.
        */
       public String[] listRuntimeServers();

       /**
        * Returns the list of runtime accounts names.
        *
        * @return   The string array of runtime accounts names.
        */
       public String[] listRuntimeAccounts();

       /**
        * Returns the list of target runtime names for the given account and the given item name.
        *
        * @param    account
        *           The given account
        * @param    itemName
        *           The given item name
        *
        * @return   The string array of target runtime names
        */
       public String[] searchRuntimeByAccount(String account, String itemName);

       /**
        * Returns the runtime definition for the given server and account names.
        *
        * @param    serverName
        *           The given server name
        * @param    accountName
        *           The given account name
        *
        * @return   The runtime definition
        */
       public RuntimeDef getRuntime(String serverName, String accountName);

       /**
        * Sets the runtime definition.
        *
        * @param    runtime
        *           The runtime definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean setRuntime(RuntimeDef runtime);

       /**
        * Adds the runtime definition for the given server and account names.
        *
        * @param    serverName
        *           The given server name
        * @param    accountName
        *           The given account name
        * @param    runtime
        *           The runtime definition
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean addRuntime(String     serverName,
                                 String     accountName,
                                 RuntimeDef runtime);

       /**
        * Clones the runtime definition from the source to the target.
        *
        * @param    serverNameFrom
        *           The source server name
        * @param    accountNameFrom
        *           The source account name
        * @param    serverNameTo
        *           The target server name
        * @param    accountNameTo
        *           The target account name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean cloneRuntime(String serverNameFrom,
                                   String accountNameFrom,
                                   String serverNameTo,
                                   String accountNameTo);

       /**
        * Moves the runtime definition from the source to the target.
        *
        * @param    serverNameFrom
        *           The source server name
        * @param    accountNameFrom
        *           The source account name
        * @param    serverNameTo
        *           The target server name
        * @param    accountNameTo
        *           The target account name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean moveRuntime(String serverNameFrom,
                                  String accountNameFrom,
                                  String serverNameTo,
                                  String accountNameTo);

       /**
        * Deletes the runtime definition for the given server and account names.
        *
        * @param    serverName
        *           The given server name
        * @param    accountName
        *           The given account name
        *
        * @return   boolean indicating the success of this operation.
        */
       public boolean deleteRuntime(String serverName, String accountName);

       /**
        * Given a certificate alias, it will compute the certificate signing chain.
        *
        * @param    alias
        *           The certificate from which to start chain building
        *
        * @return   a list of (alias, DN) entries, where root certificate is on first position
        */
       public TaggedName[] getCertificateHierarchy(String alias);

       /**
        * Validate the given certificate, by its PEM data.
        *
        * @param    cert
        *           The PEM representation of the certificate
        *
        * @return   a value representing certificate validity state.
        */
       public int validateCertificate(CertDef cert);

       /**
        * Get a map of the owner or issuer Distinctive Name properties.
        *
        * @param    cd
        *           The certificate definition from which the info will be extracted.
        * @param    owner
        *           <code>true</code> if the owner property should be retrieved;
        *           <code>false</code> for the issuer property.
        *
        * @return   A map with certificate properties or <code>null</code> if the certificate PEM data
        *           could not be loaded.
        */
       public Map<String, String> getCertificateDNProperties(CertDef cd, boolean owner);

       /**
        * Get the value of the specified property, from the Distinctive Name entry associated
        * with the owner or issuer.
        *
        * @param    cd
        *           The certificate definition from which the info will be extracted.
        * @param    prop
        *           The property name
        * @param    owner
        *           <code>true</code> if the owner property should be retrieved;
        *           <code>false</code> for the issuer property.
        *
        * @return   The value for the specified property.
        */
       public String getCertificateDNProperty(CertDef cd, String prop, boolean owner);

       /**
        * Loads the X509 certificate from the specified definition and returns
        * a map with properties for:
        * <ul>
        *    <li>
        *       {@link CertificateUtils#CERT_OWNER} - this property will keep a Map of Distinctive
        *       Name properties for the owner
        *    </li>
        *    <li>
        *       {@link CertificateUtils#CERT_ISSUER} - this property will keep a Map of Distinctive
        *       Name properties for the issuer
        *    </li>
        *    <li>
        *       {@link CertificateUtils#CERT_VALIDITY_NOT_BEFORE} - the date from which this
        *       certificate starts to be valid.
        *    </li>
        *    <li>
        *       {@link CertificateUtils#CERT_VALIDITY_NOT_AFTER} - the date from which this
        *       certificate's validity period ends.
        *    </li>
        * </ul>
        *
        * @param    cd
        *           The certificate definition from which the info will be extracted.
        *
        * @return   A map with certificate properties or <code>null</code> if the certificate PEM data
        *           could not be loaded.
        */
       public Map<String, Object> getCertificateProperties(CertDef cd);

       /**
        * Check if the given certificate is self-signed.
        *
        * @param    cert
        *           The certificate which should be checked.
        *
        * @return   <code>true</code> if this certificate is self-signed
        */
       public Boolean isSelfSigned(CertDef cert);

       /**
        * Gets report preview.
        *
        * @param    reportRequest
        *           Holds all required data to build the target report
        * @param    range
        *           The preview range
        *
        * @return   The report preview object that holds the requested page range and the number of
        *           all available pages for this preview.
        *
        * @throws   IOException
        *           The IO exception if there is a failed IO operation
        */
       public ReportPreview getPreviewImages(ReportRequest reportRequest, Range range)
       throws IOException;

       /**
        * Returns the map of report parameters to their values saved in the directory.
        *
        * @return   The report parameters map
        */
       public Map<String, Object> getReportParametersMap();

       /**
        * Returns the current application version.
        *
        * @return   String presentation of the current application version number.
        */
       public String getVersionInfo();

       public Float forceFloatSerialization();

       /**
        * Returns the list of appserver processes.
        *
        * @return   Array of appserver definitions.
        */
       public AppserverInfo[] getAppserverList();

       /**
        * Returns the list of appserver agents.
        *
        * @param    appserver
        *           The appserver name
        *
        * @return   Array of appserver agent definitions.
        */
       public AppserverInfo.AgentInfo[] getAppserverAgents(String appserver);

       /**
        * Restarts all agents of the appserver and returns the refreshed list of appserver agents.
        *
        * @param    appserver
        *           The appserver name
        *
        * @return   Array of appserver agent definitions.
        */
       public AppserverInfo.AgentInfo[] restartAgents(String appserver);

       /**
        * Trims the agents of the appserver and returns the refreshed list of appserver agents.
        *
        * @param    appserver
        *           The appserver name
        *
        * @return   Array of appserver agent definitions.
        */
       public AppserverInfo.AgentInfo[] trimAgents(String appserver);

       /**
        * Starts a new agent for the appserver and returns the refreshed list of appserver agents.
        *
        * @param    appserver
        *           The appserver name
        *
        * @return   Array of appserver agent definitions.
        */
       public AppserverInfo.AgentInfo[] startAppserver(String appserver);

       /**
        * Terminates the selected agents of the appserver and returns the refreshed list of appserver agents.
        *
        * @param    appserver
        *           The appserver name
        * @param    agentIds
        *           The list of agent ids
        *
        * @return   Array of appserver agent definitions.
        */
       public AppserverInfo.AgentInfo[] terminateAgents(String appserver, int[] agentIds);

       /**
        * Terminates the selected sessions of the appserver and returns the refreshed list of appserver agents.
        *
        * @param    appserver
        *           The appserver name
        * @param    sessions
        *           The list of sessions to be terminated
        */
       public AppserverInfo.AgentInfo[] terminateSessions(String appserver, MultiSessionAgentSessionDef[] sessions);

       /**
        * Utility/Convenience class.
        * Use AdminService.App.getInstance() to access static instance of AdminServiceAsync
        */
       public static class App
       {
          private static final AdminServiceAsync ourInstance = (AdminServiceAsync) GWT.create(AdminService.class);

          /**
           * Gets the single instance of App.
           *
           * @return   single instance of App
           */
          public static AdminServiceAsync getInstance()
          {
             return ourInstance;
          }
       }
    }