public class AdminServerImpl
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
AdminServerImpl.WorkArea
Stores global data relating to the state of the current context.
|
Modifier and Type | Field and Description |
---|---|
private static RecordInfo[] |
EMPTY_LOCK_LIST
Defines the empty locks array.
|
private static int |
LOCK_ACQUIRE_INTERVAL
Interval (in milliseconds) between lock acquisition attempts.
|
private static int |
LOCK_ACQUIRE_MAXIMUM_WAIT_TIME
Maximum timeout (in milliseconds) before give up on acquiring a lock.
|
private static java.util.logging.Logger |
LOG
Anonymous log instance.
|
private static java.lang.Integer |
refreshGlobal
Global refresh counter.
|
private static java.lang.Object |
refreshMutex
Synchronization object for refresh counters.
|
private static java.text.MessageFormat |
REPORT_SETTINGS
The report settings template to build the node id of the given report parameter.
|
private static SecurityManager |
sm
instance of the security manager
|
private static ContextLocal<AdminServerImpl.WorkArea> |
workArea
Context-local global data area for admin session state
|
Constructor and Description |
---|
AdminServerImpl() |
Modifier and Type | Method and Description |
---|---|
static boolean |
addAcl(java.lang.String resourceType,
Acl acl,
java.util.Map<java.lang.Integer,java.lang.String> subjMap)
Adds new set of ACLs based on the contents of the given ACL definition.
|
static boolean |
addAclInstance(java.lang.String instanceName)
Creates an empty container for the specified ACL instance.
|
static boolean |
addCert(CertDef cert)
Adds a new certificate according to its definition.
|
static boolean |
addDatabase(java.lang.String name,
DatabaseDef logging) |
static boolean |
addExports(java.lang.String name,
ExportsDef logging) |
static boolean |
addGroup(GroupDef group)
Adds new group account definition.
|
static boolean |
addLogging(java.lang.String name,
LoggingDef logging) |
private static JarOpErrorCode |
addNodeStrings(DirectoryService ds,
java.lang.String nodeId,
java.lang.String[] values)
Add the strings to the strings node (assuming that the node contains
unique string values).
|
static boolean |
addPersistence(java.lang.String name,
PersistenceDef persistence) |
static boolean |
addProcess(ProcessDef process,
java.io.Serializable ext)
Adds new process account definition.
|
static boolean |
addRuntime(java.lang.String serverName,
java.lang.String accountName,
RuntimeDef runtime) |
static boolean |
addStartup(java.lang.String name,
StartupDef logging) |
static boolean |
addUser(UserDef user,
java.io.Serializable ext)
Adds new user account definition.
|
static boolean |
backupDirectory(java.lang.String newfile)
Backup the directory into a new file.
|
static int |
bulkAuthModeUpdate(int targetAccounts,
java.lang.String[] excludedAccounts,
int authMode,
java.lang.String authPlugin)
Preforms bulk update of authentication settings of the accounts of the
specified type.
|
static void |
cancelRereadDir()
Cancel (possibly) planned refreshing operation.
|
static boolean |
canRefresh()
Check if current user can perform a refresh.
|
static boolean |
changeGroupUsers(java.lang.String name,
java.lang.String[] additions,
java.lang.String[] deletions)
Changes the group by adding and/or removing users.
|
static boolean |
changeHolidays(date[] additions,
date[] deletions)
Modifies defined holidays.
|
static JarOpErrorCode |
changeJarHookClass(java.lang.String jar,
java.lang.String hookClass)
Change the server-wide or global hook class of the specific jar.
|
static JarOpErrorCode |
changeJarHooksType(boolean serverWide,
boolean move)
Make the current server use server-wide or global hooks, optionally
copying or moving hooks from one scope to another.
|
static boolean |
changeResourceNames(java.lang.String[] additions,
java.lang.String[] deletions)
Modifies resource name definitions.
|
static TaggedName |
checkGroup(java.lang.String name)
Check the group account existence.
|
static TaggedName |
checkProcess(java.lang.String name)
Check the process account existence.
|
static TaggedName |
checkUser(java.lang.String name)
Check the user account existence.
|
static void |
clearMessages()
Clears the old messages saved on the server, if any.
|
static boolean |
cloneAcl(java.lang.String resourceType,
java.lang.String instanceName,
int oid,
int cloneOid)
Clones the specified ACL to another position within the same ACL
instance.
|
static boolean |
cloneAclInstance(java.lang.String instanceFrom,
java.lang.String instanceTo)
Clones entire ACL instance.
|
static boolean |
cloneAclInstance(java.lang.String resourceType,
java.lang.String instanceFrom,
java.lang.String instanceTo)
Clones the resource specific part of an ACL instance.
|
static boolean |
cloneDatabase(java.lang.String nameFrom,
java.lang.String nameTo) |
static boolean |
cloneExports(java.lang.String nameFrom,
java.lang.String nameTo) |
static boolean |
cloneGroup(java.lang.String nameFrom,
java.lang.String nameTo,
boolean acls)
Clones an existing group account into a new one.
|
static boolean |
cloneLogging(java.lang.String nameFrom,
java.lang.String nameTo) |
static boolean |
clonePersistence(java.lang.String nameFrom,
java.lang.String nameTo) |
static boolean |
cloneProcess(java.lang.String nameFrom,
java.lang.String nameTo,
boolean acls)
Clones an existing process account into a new one.
|
static boolean |
cloneRuntime(java.lang.String serverNameFrom,
java.lang.String accountNameFrom,
java.lang.String serverNameTo,
java.lang.String accountNameTo) |
static boolean |
cloneStartup(java.lang.String nameFrom,
java.lang.String nameTo) |
static boolean |
cloneUser(java.lang.String nameFrom,
java.lang.String nameTo,
boolean acls)
Clones an existing user account into a new one, password included.
|
static boolean |
cloneUser(java.lang.String nameFrom,
java.lang.String nameTo,
boolean acls,
byte[] newPassword)
Clones an existing user account into a new one and assigns the provided
password to the clone.
|
static boolean |
deleteAcl(java.lang.String resourceType,
java.lang.String instanceName,
int oid)
Deletes the specified ACL from the specified ACL instance.
|
static boolean |
deleteAclInstance(java.lang.String instanceName)
Deletes entire ACL instance from the directory.
|
static boolean |
deleteAclInstance(java.lang.String resourceType,
java.lang.String instanceName)
Deletes the resource specific part of an ACL instance from the
directory.
|
static boolean |
deleteCert(java.lang.String alias,
boolean force)
Deletes an existing certificate conditionally or unconditionally.
|
static boolean |
deleteDatabase(java.lang.String name) |
static boolean |
deleteExports(java.lang.String name) |
static boolean |
deleteGroup(java.lang.String name)
Deletes a group account definition.
|
static boolean |
deleteLogging(java.lang.String name) |
static boolean |
deletePersistence(java.lang.String name) |
static boolean |
deleteProcess(java.lang.String name)
Deletes a process account definition.
|
static boolean |
deleteRuntime(java.lang.String serverName,
java.lang.String accountName) |
static boolean |
deleteStartup(java.lang.String name) |
static boolean |
deleteUser(java.lang.String name)
Deletes a user account definition.
|
static JarOpErrorCode |
deregisterJar(java.lang.String jar,
boolean force,
boolean removeFromDirectory)
Remove registration for the specified jar.
|
static JarOpErrorCode |
deregisterJarAPI(java.lang.String jar,
java.lang.String interfaceClass,
boolean force)
Remove registration of the specified API in the specified jar.
|
static JarOpErrorCode |
deregisterJarFromDirectory(java.lang.String jar,
java.lang.String storedHookClass)
Remove jar registration from the directory.
|
static AclDef |
getAcl(java.lang.String resourceType,
java.lang.String instanceName)
Gets the full ACL definition information from the directory for the
specified ACL instance and resource type.
|
static SessionInfo[] |
getActiveSessions(java.lang.String jar,
java.lang.String apiInterfaceClass)
Get the list of all active sessions which have executed the specified
API or API(s) associated to the specified jar.
|
static AdminDef |
getAdminDef()
Returns the configuration information about the administration interface
itself.
|
static AclDef[] |
getAllAcls(java.lang.String instanceName)
Gets the full ACL definition information from the directory for the
specified ACL instance or all of them.
|
static AuditDef |
getAudit() |
static AuthConfigDef |
getAuthConfig()
Gets authentication configuration, which includes authentication mode,
password aging and security tracing level.
|
static java.lang.String[] |
getAvailableJarAPIImplClasses(java.lang.String jar,
java.lang.String interfaceClass)
Get the list of classes which reside in the specified jar and
statically implement all methods defined by the specified interface.
|
static java.lang.String[] |
getAvailableJarAPIInterfaces(java.lang.String jar,
boolean showRegistered)
Get the list of interfaces available in the specified jar file.
|
static java.lang.String[] |
getAvailableJarHookClasses(java.lang.String jar)
Get the list of classes which reside into the specified jar file and
implement the
InitTermListener
interface. |
static CertDef |
getCert(java.lang.String alias)
Returns a DER-encoded certificate like those found in *.PEM files.
|
static TaggedName[] |
getCertAccounts(java.lang.String alias)
Returns an array of all account names with their description for
accounts sharing this certificate.
|
static java.util.Map<java.lang.String,java.lang.String> |
getCertificateDNProperties(CertDef cd,
boolean owner)
Get a map of the owner or issuer Distinctive Name properties.
|
static java.lang.String |
getCertificateDNProperty(CertDef cd,
java.lang.String prop,
boolean owner)
Get the value of the specified property, from the Distinctive Name entry associated with
the owner or issuer.
|
static TaggedName[] |
getCertificateHierarchy(java.lang.String alias)
Given a certificate alias, it will compute the certificate signing chain.
|
static java.util.Map<java.lang.String,java.lang.Object> |
getCertificateProperties(CertDef cd)
Loads the X509 certificate from the specified definition and returns
a map with properties for:
CertificateUtils.CERT_OWNER - this property will keep a Map of Distinctive
Name properties for the owner
CertificateUtils.CERT_ISSUER - this property will keep a Map of Distinctive
Name properties for the issuer
CertificateUtils.CERT_VALIDITY_NOT_BEFORE - the date from which this
certificate starts to be valid. |
static TaggedName[] |
getCertProcesses(java.lang.String alias)
Returns an array of process account names with their description for
processes sharing this certificate.
|
static TaggedName[] |
getCertUsers(java.lang.String alias)
Returns an array of user account names with their description for users
sharing this certificate.
|
static DatabaseDef |
getDatabase(java.lang.String name) |
static java.lang.String[] |
getDatabases()
Get the list of primary databases managed by this P2J server.
|
static java.lang.String[] |
getDatabaseTables(java.lang.String database)
Get the list of tables of the given database.
|
static DirectoryService |
getDirectoryService()
Return the current
DirectoryService instance. |
static DirectoryService |
getDirectoryServiceChecked()
Get directory service with permission check.
|
static AclDef |
getEffectiveAcls(java.lang.String resourceType)
Gets the combined ACL definition information from the directory for the
specified resource type.
|
static ExportsDef |
getExports(java.lang.String name) |
private static float |
getFloatReportSettings(DirectoryService dirService,
ReportParameters parameter,
float defValue,
java.util.Map<java.lang.String,java.lang.Object> map)
Gets the report parameter value saved at the directory if it has been set, otherwise returns
the default value.
|
static GroupDef |
getGroup(java.lang.String name)
Returns the group definition for the specified group name.
|
private static int |
getIntReportSettings(DirectoryService dirService,
ReportParameters parameter,
int defValue,
java.util.Map<java.lang.String,java.lang.Object> map)
Gets the report parameter value saved at the directory if it has been set, otherwise returns
the default value.
|
static RecordInfo[] |
getLockRecords()
Gets records that have been previously locked in the given context using
lockRecords(com.goldencode.p2j.admin.RecordInfo[]) . |
static LoggingDef |
getLogging(java.lang.String name) |
static TaggedName |
getManagedLibsDirInformation()
Get information about managed libraries directory (path to it and
information whether it exists).
|
static java.lang.String[][] |
getMessages(boolean all)
Returns an array of messages accumulated since the previous call or all
messages since the last message cleanup.
|
static PersistenceDef |
getPersistence(java.lang.String name) |
static ProcessDef |
getProcess(java.lang.String name)
Returns the process definition for the specified process name.
|
static AdminProfile[] |
getProfile(java.lang.String[] name)
Returns the admin permissions profile for an arbitrary set of resource
instance names.
|
static AdminProfile[] |
getProfile(java.lang.String name,
int[] perm)
Returns the admin permissions profile for an arbitrary set of
permissions for a resource instance name.
|
static RecordLockInfo[] |
getRecordLockList()
Creates a report of all record locks for the server.
|
static TaggedName[] |
getRegisteredJarAPIs(java.lang.String jar)
Get the list of APIs registered for the specified jar.
|
static TaggedName[] |
getRegisteredJars()
Get the list of registered jars (which represent customer libs).
|
static java.util.Map<java.lang.String,java.lang.Object> |
getReportParametersMap()
Returns the map of report parameters to their values saved in the directory.
|
static java.lang.String |
getResourceType(java.lang.String name)
Returns the registered resource type name for the given resource plugin.
|
static RuntimeDef |
getRuntime(java.lang.String serverName,
java.lang.String accountName) |
static SecurityAdmin |
getSecurityAdmin()
Return the current
SecurityAdmin instance. |
static java.lang.String |
getServerName()
Returns the server's name.
|
static SessionInfo[] |
getSessionList()
Creates a report of all current user and process sessions.
|
static StartupDef |
getStartup(java.lang.String name) |
static java.lang.String |
getStoredJarHookClass(java.lang.String jar)
Get hook class specified in the directory for the target jar.
|
private static java.lang.String |
getStringReportSettings(DirectoryService dirService,
ReportParameters parameter,
java.lang.String defValue,
java.util.Map<java.lang.String,java.lang.Object> map)
Gets the report parameter value saved at the directory if it has been set, otherwise returns
the default value.
|
static java.lang.String[] |
getUnregisteredJars()
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.
|
static UserDef |
getUser(java.lang.String name)
Returns the user account definition for the specified account name.
|
static void |
initialize()
Initializes this component.
|
static boolean |
isMaster()
Tells whether the server can modify the directory.
|
static boolean |
isRefreshPending()
Check if there is pending security cache refresh.
|
static java.lang.Boolean |
isSelfSigned(CertDef cert)
Check if the given certificate is self-signed.
|
static java.lang.Boolean |
isUsingMultiClassLoader()
Allows to determine whether
MultiClassLoader is used as the
system class loader. |
static java.lang.Boolean |
isUsingServerWideHooks()
Returns information whether server-wide or global hooks are used for
the current server.
|
static java.lang.String[] |
listAclInstances()
Locates all instances of ACLs in the directory and returns their names.
|
static java.lang.String[] |
listAclInstances(java.lang.String resourceType)
Locates all instances of ACLs in the directory and returns their names
for those instances which have ACLs defined for the specified resource
type.
|
static TaggedName[] |
listAuthCerts(boolean unusedOnly)
Returns an array of defined Certificate Authority certificates with
their distinctive names.
|
static TaggedName[] |
listAuthPlugins()
Get the list of available auth plugins.
|
static java.lang.String[] |
listDatabaseInstances() |
static java.lang.String[] |
listExportsInstances() |
static TaggedName[] |
listGroups()
Returns an array of defined group names.
|
static TaggedName[] |
listGroupUsers(java.lang.String name)
Enumerates the users of a named group.
|
static date[] |
listHolidays()
Returns an array of defined holidays.
|
static java.lang.String[] |
listInstanceAcls(java.lang.String instanceName)
Lists resource names for which the specified ACL instance has ACLs
defined.
|
static java.lang.String[] |
listLoggingInstances() |
static TaggedName[] |
listPeerCerts(boolean unusedOnly)
Returns an array of defined peer (non-CA) certificates with their
distinctive names.
|
static java.lang.String[] |
listPersistenceInstances() |
static TaggedName[] |
listProcesses()
Returns an array of defined process names with their descriptions.
|
static java.lang.String[] |
listResourceNames()
Returns an array of resource plugin names.
|
static java.lang.String[] |
listRuntimeAccounts() |
static java.lang.String[] |
listRuntimeNames() |
static java.lang.String[] |
listRuntimeServers() |
static java.lang.String[] |
listServers()
Returns the list of all server instances found in the directory under
the "/server" node.
|
static java.lang.String[] |
listServers(java.lang.String containers)
Returns the list of server instances under the "/server" node, that have
the specified container (or nested chain of) as a child.
|
static java.lang.String[] |
listStartupInstances() |
static TaggedName[] |
listUserGroups(java.lang.String name)
Enumerates the groups the named user is part of.
|
static TaggedName[] |
listUsers()
Returns an array of defined user account names and their owners.
|
static boolean |
lockForRereadDir(int seconds)
Lock directory for rereading from the file.
|
static boolean |
lockRecords(RecordInfo[] records)
Lock the specified records.
|
private static void |
log(java.util.logging.Level level,
java.lang.String message)
Logs messages.
|
static void |
message(java.lang.String... msg)
Utility method to store server messages for later retrieval by clients.
|
static boolean |
moveAcl(java.lang.String resourceType,
java.lang.String instanceName,
int oid,
int newOid)
Moves the specified ACL to another position within the same ACL
instance.
|
static boolean |
moveAcl(java.lang.String resourceType,
java.lang.String instanceName,
int oid,
java.lang.String newInstanceName)
Moves the specified ACL to another ACL instance, private or shared.
|
static boolean |
moveAclInstance(java.lang.String instanceFrom,
java.lang.String instanceTo)
Moves entire ACL instance.
|
static boolean |
moveAclInstance(java.lang.String resourceType,
java.lang.String instanceFrom,
java.lang.String instanceTo)
Moves the resource specific part of an ACL instance.
|
static boolean |
moveCert(java.lang.String aliasFrom,
java.lang.String aliasTo)
Changes the certificate's alias.
|
static boolean |
moveDatabase(java.lang.String nameFrom,
java.lang.String nameTo) |
static boolean |
moveExports(java.lang.String nameFrom,
java.lang.String nameTo) |
static boolean |
moveLogging(java.lang.String nameFrom,
java.lang.String nameTo) |
static boolean |
movePersistence(java.lang.String nameFrom,
java.lang.String nameTo) |
static boolean |
moveRuntime(java.lang.String serverNameFrom,
java.lang.String accountNameFrom,
java.lang.String serverNameTo,
java.lang.String accountNameTo) |
static boolean |
moveStartup(java.lang.String nameFrom,
java.lang.String nameTo) |
static java.lang.String |
peekMessage()
Returns the most recent server message without changing its state on the
server.
|
static void |
refreshPlugin(java.lang.String name)
Refresh specified plugin.
|
static JarOpErrorCode |
registerJar(java.lang.String jar,
java.lang.String hookClass,
boolean storeInDirectory)
Register the specified jar file (which represent a customer lib).
|
static JarOpErrorCode |
registerJarAPI(java.lang.String interfaceClass,
java.lang.String implementationClass)
Register API specified by the given interface and implementation class.
|
private static JarOpErrorCode |
removeNodeStrings(DirectoryService ds,
java.lang.String nodeId,
java.lang.String[] values)
Remove the strings from the strings node (assuming that the node
contains unique string values).
|
static int |
rereadDirectory()
Reread the directory file into the backend's cache after obtaining
a refresh lock.
|
static boolean |
resequenceAcls(java.lang.String resourceType,
java.lang.String instanceName,
int start,
int step)
Assigns new object IDs sequentially for all ACLs in the given ACL
instance and resource type.
|
static java.lang.String |
searchCert(java.lang.String dn)
Searches the CA directory for an alias of the certificate by the
distinctive name of the subject.
|
static java.lang.String[] |
searchRuntimeByAccount(java.lang.String account,
java.lang.String itemName) |
static boolean |
setAcl(java.lang.String resourceType,
Acl acl,
java.util.Map<java.lang.Integer,java.lang.String> subjMap,
boolean setInstance,
boolean setInstanceMode,
boolean setSubjects,
boolean setRights)
Conditionally edits the existing ACL based on the contents of the given
ACL and the selected conditions.
|
static boolean |
setAudit(AuditDef audit) |
static boolean |
setAuthConfig(AuthConfigDef authConfig)
Sets authentication configuration from the specified instance, which
includes authentication mode, password aging and security tracing level.
|
static boolean |
setCert(CertDef cert)
Replaces an existing certificate with the given one.
|
static boolean |
setDatabase(DatabaseDef database) |
static boolean |
setExports(ExportsDef logging) |
static boolean |
setGroup(GroupDef group)
Changes the group definition for the named group.
|
static boolean |
setLogging(LoggingDef logging) |
static boolean |
setPersistence(PersistenceDef persistence) |
static boolean |
setProcess(ProcessDef process)
Changes the process definition for the named process.
|
static boolean |
setProcess(ProcessDef process,
java.io.Serializable ext)
Changes the process definition for the named process.
|
static boolean |
setRuntime(RuntimeDef runtime) |
static boolean |
setStartup(StartupDef startup) |
static boolean |
setTargetFile(java.lang.String name,
boolean create)
Sets the specified directory file as the offline target.
|
static int |
setTargetLive(boolean stayCurrent)
Sets the live server's directory as the target.
|
static boolean |
setUser(UserDef user)
Changes the user account definition for the named account.
|
static boolean |
setUser(UserDef user,
java.io.Serializable ext)
Changes the user account definition for the named account.
|
static boolean |
shutdown()
Shuts the server down.
|
static int |
targetRefresh()
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().
|
static void |
terminateSession(int sid)
Forcibly terminate the specified session.
|
static JarOpErrorCode |
terminateSessions(java.lang.String jar,
java.lang.String iface)
Terminate all active sessions which have invoked APIs in that jar or
the given exported interface, if
iface is not
null . |
private static JarOpErrorCode |
toJarOpErrorCode(ErrorCode code)
Converts
ErrorCode to JarOpErrorCode . |
static boolean |
unlockRecords()
Unlock the records which has been previously locked in the given context
using
lockRecords(com.goldencode.p2j.admin.RecordInfo[]) . |
static int |
validateCertificate(CertDef cert)
Validate the given certificate, by its PEM data.
|
private static ContextLocal<AdminServerImpl.WorkArea> workArea
private static java.util.logging.Logger LOG
private static SecurityManager sm
private static final int LOCK_ACQUIRE_MAXIMUM_WAIT_TIME
private static final int LOCK_ACQUIRE_INTERVAL
private static final RecordInfo[] EMPTY_LOCK_LIST
private static java.lang.Integer refreshGlobal
private static final java.lang.Object refreshMutex
private static final java.text.MessageFormat REPORT_SETTINGS
public static void initialize()
private static void log(java.util.logging.Level level, java.lang.String message)
level
- level of this messagemessage
- text to be displayedpublic static java.lang.String getServerName()
null
public static boolean isMaster()
true
if it canpublic static int setTargetLive(boolean stayCurrent)
stayCurrent
- if true
, all operations affect the most current
generation of the security cache, otherwise they affect the
generation attached to the admin sessionpublic static boolean setTargetFile(java.lang.String name, boolean create)
name
- name of a directory file to use as the targetcreate
- true
means a new directory file should be
created, otherwise the named directory file should exist.true
if the new target was set successfullypublic static int targetRefresh()
public static java.lang.String[][] getMessages(boolean all)
all
- if true
, then old and new messages are retrieved,
otherwise new messages onlypublic static java.lang.String peekMessage()
null
if nothing is generatedpublic static void clearMessages()
public static AdminDef getAdminDef()
public static boolean isRefreshPending()
true
if refresh is pending and false
is there is no pending refresh or current user has not enough
rights to perform it.public static boolean canRefresh()
true
user has enough rights to perform refresh.public static AdminProfile[] getProfile(java.lang.String[] name)
name
- array of admin resource instance names to querynull
public static AdminProfile[] getProfile(java.lang.String name, int[] perm)
name
- admin leaf resource instance name to queryperm
- array of permissions to querynull
public static boolean backupDirectory(java.lang.String newfile)
newfile
- name of a backup file to createtrue
if backup was successful.public static boolean lockForRereadDir(int seconds)
seconds
- Seconds to wait before lock will expire.true
if lock was successful.public static int rereadDirectory()
public static void cancelRereadDir()
public static SessionInfo[] getSessionList()
null
if insufficient rights exist to obtain the
list.public static void terminateSession(int sid)
sid
- Session identifier.public static RecordLockInfo[] getRecordLockList()
null
if insufficient rights exist to obtain the
list.public static java.lang.String[] getDatabases()
public static java.lang.String[] getDatabaseTables(java.lang.String database)
database
- Target database.public static boolean lockRecords(RecordInfo[] records)
You can unlock records using unlockRecords()
.
records
- Records to lock.true
if records were successfully locked.public static RecordInfo[] getLockRecords()
lockRecords(com.goldencode.p2j.admin.RecordInfo[])
.
While the records were locked by the admin UI, they could be changed by the external tools,
so the state of these records into the Hibernate cache is refreshed before records have
been collected.public static boolean unlockRecords()
lockRecords(com.goldencode.p2j.admin.RecordInfo[])
. While the records were locked by the admin
UI, they could be changed by the external tools, so the state of these
records into the Hibernate cache is refreshed before unlocking.true
if records were successfully unlocked.public static boolean shutdown()
true
if successfulpublic static java.lang.String[] listResourceNames()
public static java.lang.String getResourceType(java.lang.String name)
name
- plugin namenull
if no matchpublic static boolean changeResourceNames(java.lang.String[] additions, java.lang.String[] deletions)
additions
- array of resource names to add or null
if no
additions are specifieddeletions
- array of resource names to delete or null
if no
deletions are specifiedpublic static AuthConfigDef getAuthConfig()
public static boolean setAuthConfig(AuthConfigDef authConfig)
authConfig
- an instance loaded with the required configurationpublic static date[] listHolidays()
public static boolean changeHolidays(date[] additions, date[] deletions)
additions
- array of dates to add or null
if no additions are
specifieddeletions
- array of dates to delete or null
if no deletions
are specifiedpublic static AuditDef getAudit()
public static boolean setAudit(AuditDef audit)
public static TaggedName[] listGroups()
null
public static GroupDef getGroup(java.lang.String name)
name
- group namenull
if no such grouppublic static TaggedName checkGroup(java.lang.String name)
name
- group namenull
if the named group does not existpublic static boolean setGroup(GroupDef group)
group
- group definitiontrue
if successfully changed the grouppublic static boolean addGroup(GroupDef group)
group
- group definition for a new accounttrue
if successfully added the grouppublic static boolean deleteGroup(java.lang.String name)
name
- group name for the group being deletedtrue
if successfully deleted the grouppublic static boolean cloneGroup(java.lang.String nameFrom, java.lang.String nameTo, boolean acls)
nameFrom
- group name for the source groupnameTo
- group name for the cloneacls
- true
tells to clone ACLs as welltrue
if successfully cloned the grouppublic static TaggedName[] listGroupUsers(java.lang.String name)
name
- group namenull
if
there is no such grouppublic static boolean changeGroupUsers(java.lang.String name, java.lang.String[] additions, java.lang.String[] deletions)
name
- group nameadditions
- array of user names to be added to the group; may be emptydeletions
- array of user names to be excluded from the group; may be
emptytrue
if successfully changed the grouppublic static TaggedName[] listUsers()
null
public static TaggedName checkUser(java.lang.String name)
name
- user account namenull
if the named account does not existpublic static UserDef getUser(java.lang.String name)
name
- user account namenull
if no such userpublic static boolean setUser(UserDef user)
user
- user account definitiontrue
if successfully changed the accountpublic static boolean setUser(UserDef user, java.io.Serializable ext)
user
- user account definitionext
- optional extension container for custom account extensionstrue
if successfully changed the accountpublic static boolean addUser(UserDef user, java.io.Serializable ext)
user
- user account definitionext
- optional extension container for custom account extensionstrue
if successfully added the accountpublic static boolean deleteUser(java.lang.String name)
name
- user account name being deletedtrue
if successfully deleted the accountpublic static boolean cloneUser(java.lang.String nameFrom, java.lang.String nameTo, boolean acls)
nameFrom
- user account name for the sourcenameTo
- user account name for the cloneacls
- true
tells to clone ACLs as welltrue
if successfully cloned the user accountpublic static boolean cloneUser(java.lang.String nameFrom, java.lang.String nameTo, boolean acls, byte[] newPassword)
nameFrom
- user account name for the sourcenameTo
- user account name for the cloneacls
- true
tells to clone ACLs as wellnewPassword
- a replacement password for the clone; null
if the
password should be preservedtrue
if successfully cloned the user accountpublic static TaggedName[] listUserGroups(java.lang.String name)
name
- user account namenull
if there is no such user etcpublic static TaggedName[] listProcesses()
null
public static ProcessDef getProcess(java.lang.String name)
name
- process namenull
if no such processpublic static TaggedName checkProcess(java.lang.String name)
name
- process account namenull
if the named account does not existpublic static boolean setProcess(ProcessDef process)
process
- process definitiontrue
if successfully changed the processpublic static boolean setProcess(ProcessDef process, java.io.Serializable ext)
process
- process definitionext
- optional extension container for custom account extensionstrue
if successfully changed the processpublic static boolean addProcess(ProcessDef process, java.io.Serializable ext)
process
- process definition for a new accountext
- optional extension container for custom account extensionstrue
if successfully added the processpublic static boolean deleteProcess(java.lang.String name)
name
- process account name being deletedtrue
if successfully deleted the processpublic static boolean cloneProcess(java.lang.String nameFrom, java.lang.String nameTo, boolean acls)
nameFrom
- process name for the sourcenameTo
- process name for the cloneacls
- true
tells to clone ACLs as welltrue
if successfully cloned the processpublic static TaggedName[] listAuthCerts(boolean unusedOnly)
unusedOnly
- if true
, lists unused certificates only,
otherwise all certificatesnull
public static TaggedName[] listPeerCerts(boolean unusedOnly)
unusedOnly
- if true
, lists unused certificates only,
otherwise all certificatesnull
public static TaggedName[] getCertUsers(java.lang.String alias)
alias
- certificate alias namenull
public static TaggedName[] getCertProcesses(java.lang.String alias)
alias
- certificate alias namenull
public static TaggedName[] getCertAccounts(java.lang.String alias)
alias
- certificate alias namenull
public static CertDef getCert(java.lang.String alias)
alias
- the alias of the certificate to getnull
public static TaggedName[] getCertificateHierarchy(java.lang.String alias)
alias
- The certificate from which to start chain buildingpublic static int validateCertificate(CertDef cert)
cert
- The PEM representation of the certificatepublic static java.util.Map<java.lang.String,java.lang.String> getCertificateDNProperties(CertDef cd, boolean owner)
cd
- The certificate definition from which the info will be extracted.owner
- true
if the owner property should be retrieved;
false
for the issuer property.null
if the certificate PEM data
could not be loaded.public static java.lang.String getCertificateDNProperty(CertDef cd, java.lang.String prop, boolean owner)
cd
- The certificate definition from which the info will be extracted.owner
- true
if the owner property should be retrieved;
false
for the issuer property.public static java.util.Map<java.lang.String,java.lang.Object> getCertificateProperties(CertDef cd)
CertificateUtils.CERT_OWNER
- this property will keep a Map of Distinctive
Name properties for the owner
CertificateUtils.CERT_ISSUER
- this property will keep a Map of Distinctive
Name properties for the issuer
CertificateUtils.CERT_VALIDITY_NOT_BEFORE
- the date from which this
certificate starts to be valid.
CertificateUtils.CERT_VALIDITY_NOT_AFTER
- the date from which this
certificate's validity period ends.
cd
- The certificate definition from which the info will be extracted.null
if the certificate PEM data
could not be loaded.public static java.lang.Boolean isSelfSigned(CertDef cert)
cert
- The certificate which should be checked.true
if this certificate is self-signedpublic static boolean setCert(CertDef cert)
cert
- encoded certificatetrue
if replaced, false
if errorspublic static boolean addCert(CertDef cert)
cert
- encoded certificatetrue
if added, false
if errorspublic static boolean moveCert(java.lang.String aliasFrom, java.lang.String aliasTo)
aliasFrom
- current certificate's aliasaliasTo
- new certificate's aliastrue
if changed, false
if errorspublic static java.lang.String searchCert(java.lang.String dn)
dn
- distinctive namenull
.public static boolean deleteCert(java.lang.String alias, boolean force)
alias
- the alias of the certificate being deletedforce
- if true
, the certificate is deleted even if in
usetrue
if deleted, false
if errorspublic static java.lang.String[] listAclInstances()
ACL instances are the directory branches that store ACLs. The shared
instance is the one found under /security/acl
branch.
Private instances are found under
/security/acls/name
branches.
public static java.lang.String[] listAclInstances(java.lang.String resourceType)
ACL instances are the directory branches that store ACLs. The shared
instance is the one found under /security/acl
branch.
Private instances are found under
/security/acls/name
branches.
resourceType
- name of the resource of interestpublic static java.lang.String[] listInstanceAcls(java.lang.String instanceName)
instanceName
- name of the ACL instance; empty string for the shared onepublic static AclDef getAcl(java.lang.String resourceType, java.lang.String instanceName)
resourceType
- name of the resource of interest; can't be null
instanceName
- name of the ACL instance; empty string for the shared one;
can't be null
null
public static AclDef[] getAllAcls(java.lang.String instanceName)
instanceName
- name of the ACL instance; empty string for the shared one; if
null
, all ACLs are returned and some may be
combinednull
public static AclDef getEffectiveAcls(java.lang.String resourceType)
resourceType
- name of the resource of interest; can't be null
null
public static boolean addAcl(java.lang.String resourceType, Acl acl, java.util.Map<java.lang.Integer,java.lang.String> subjMap)
resourceType
- name of the resource to add the ACL foracl
- ACL definition, that should come fully defined, including the
instance name.subjMap
- a map to translate numeric subject IDs back to namestrue
if added, false
if errorspublic static TaggedName[] listAuthPlugins()
null
if no plugins are available.public static int bulkAuthModeUpdate(int targetAccounts, java.lang.String[] excludedAccounts, int authMode, java.lang.String authPlugin)
targetAccounts
- Type of accounts to update. Account.ACC_USER
and
Account.ACC_GROUP
are supported.excludedAccounts
- The list of IDs of the accounts that should NOT be updated. Can
be null
.authMode
- Authentication mode to set.authPlugin
- Authentication plugin to set.-1
if an error
has occured.public static void refreshPlugin(java.lang.String name)
name
- public static boolean setAcl(java.lang.String resourceType, Acl acl, java.util.Map<java.lang.Integer,java.lang.String> subjMap, boolean setInstance, boolean setInstanceMode, boolean setSubjects, boolean setRights)
resourceType
- name of the resource to set the ACL foracl
- ACL definitionsubjMap
- a map to translate numeric subject IDs back to names; needed
only when setSubjects is true
and can be
null
all other timessetInstance
- true
if setting the resource instance namesetInstanceMode
- true
if setting the resource instance name modesetSubjects
- true
if setting the subjects IDssetRights
- true
if setting the rights for this ACLtrue
if set, false
if errorspublic static boolean moveAcl(java.lang.String resourceType, java.lang.String instanceName, int oid, java.lang.String newInstanceName)
resourceType
- name of the resource of interestinstanceName
- name of the source ACL instance; empty string for the shared
oneoid
- ACL object ID that selects the ACL to movenewInstanceName
- name of the target ACL instance; empty string for the shared
onetrue
if moved, false
if errorspublic static boolean moveAcl(java.lang.String resourceType, java.lang.String instanceName, int oid, int newOid)
resourceType
- name of the resource of interestinstanceName
- name of the source ACL instance; empty string for the shared
oneoid
- ACL object ID that selects the ACL to movenewOid
- new ACL object IDtrue
if moved, false
if errorspublic static boolean deleteAcl(java.lang.String resourceType, java.lang.String instanceName, int oid)
resourceType
- name of the resource of interestinstanceName
- name of the source ACL instance; empty string for the shared
oneoid
- ACL object ID that selects the ACL to deletetrue
if deleted, false
if errorspublic static boolean cloneAcl(java.lang.String resourceType, java.lang.String instanceName, int oid, int cloneOid)
resourceType
- name of the resource of interestinstanceName
- name of the source ACL instance; empty string for the shared
oneoid
- ACL object ID that selects the ACL to clonecloneOid
- ACL object ID for the clonetrue
if cloned, false
if errorspublic static boolean resequenceAcls(java.lang.String resourceType, java.lang.String instanceName, int start, int step)
resourceType
- name of the resource of interestinstanceName
- name of the source ACL instance; empty string for the shared
onestart
- the starting numberstep
- the incrementtrue
if success, false
if errorspublic static boolean addAclInstance(java.lang.String instanceName)
instanceName
- name of the ACL instance; empty string for the shared onetrue
if created, false
if errorspublic static boolean deleteAclInstance(java.lang.String instanceName)
instanceName
- name of the ACL instance; empty string for the shared onetrue
if deleted, false
if errorspublic static boolean deleteAclInstance(java.lang.String resourceType, java.lang.String instanceName)
resourceType
- name of the resource of interestinstanceName
- name of the ACL instance; empty string for the shared onetrue
if deleted, false
if errorspublic static boolean cloneAclInstance(java.lang.String instanceFrom, java.lang.String instanceTo)
instanceFrom
- name of the source ACL instance; empty string for the shared
oneinstanceTo
- name of the target ACL instance; empty string for the shared
onetrue
if cloned, false
if errorspublic static boolean cloneAclInstance(java.lang.String resourceType, java.lang.String instanceFrom, java.lang.String instanceTo)
resourceType
- name of the resource of interestinstanceFrom
- name of the source ACL instance; empty string for the shared
oneinstanceTo
- name of the target ACL instance; empty string for the shared
onetrue
if cloned, false
if errorspublic static boolean moveAclInstance(java.lang.String instanceFrom, java.lang.String instanceTo)
instanceFrom
- name of the source ACL instance; empty string for the shared
oneinstanceTo
- name of the target ACL instance; empty string for the shared
onetrue
if moved, false
if errorspublic static boolean moveAclInstance(java.lang.String resourceType, java.lang.String instanceFrom, java.lang.String instanceTo)
resourceType
- name of the resource of interestinstanceFrom
- name of the source ACL instance; empty string for the shared
oneinstanceTo
- name of the target ACL instance; empty string for the shared
onetrue
if moved, false
if errorspublic static java.lang.String[] listServers()
public static java.lang.String[] listServers(java.lang.String containers)
containers
- one or more container names separated by "/"public static java.lang.String[] listLoggingInstances()
public static LoggingDef getLogging(java.lang.String name)
public static boolean setLogging(LoggingDef logging)
public static boolean addLogging(java.lang.String name, LoggingDef logging)
public static boolean cloneLogging(java.lang.String nameFrom, java.lang.String nameTo)
public static boolean moveLogging(java.lang.String nameFrom, java.lang.String nameTo)
public static boolean deleteLogging(java.lang.String name)
public static java.lang.String[] listExportsInstances()
public static ExportsDef getExports(java.lang.String name)
public static boolean setExports(ExportsDef logging)
public static boolean addExports(java.lang.String name, ExportsDef logging)
public static boolean cloneExports(java.lang.String nameFrom, java.lang.String nameTo)
public static boolean moveExports(java.lang.String nameFrom, java.lang.String nameTo)
public static boolean deleteExports(java.lang.String name)
public static java.lang.String[] listStartupInstances()
public static StartupDef getStartup(java.lang.String name)
public static boolean setStartup(StartupDef startup)
public static boolean addStartup(java.lang.String name, StartupDef logging)
public static boolean cloneStartup(java.lang.String nameFrom, java.lang.String nameTo)
public static boolean moveStartup(java.lang.String nameFrom, java.lang.String nameTo)
public static boolean deleteStartup(java.lang.String name)
public static java.lang.String[] listPersistenceInstances()
public static PersistenceDef getPersistence(java.lang.String name)
public static boolean setPersistence(PersistenceDef persistence)
public static boolean addPersistence(java.lang.String name, PersistenceDef persistence)
public static boolean clonePersistence(java.lang.String nameFrom, java.lang.String nameTo)
public static boolean movePersistence(java.lang.String nameFrom, java.lang.String nameTo)
public static boolean deletePersistence(java.lang.String name)
public static java.lang.String[] listDatabaseInstances()
public static DatabaseDef getDatabase(java.lang.String name)
public static boolean setDatabase(DatabaseDef database)
public static boolean addDatabase(java.lang.String name, DatabaseDef logging)
public static boolean cloneDatabase(java.lang.String nameFrom, java.lang.String nameTo)
public static boolean moveDatabase(java.lang.String nameFrom, java.lang.String nameTo)
public static boolean deleteDatabase(java.lang.String name)
public static java.lang.String[] listRuntimeNames()
public static java.lang.String[] listRuntimeServers()
public static java.lang.String[] listRuntimeAccounts()
public static java.lang.String[] searchRuntimeByAccount(java.lang.String account, java.lang.String itemName)
public static RuntimeDef getRuntime(java.lang.String serverName, java.lang.String accountName)
public static boolean setRuntime(RuntimeDef runtime)
public static boolean addRuntime(java.lang.String serverName, java.lang.String accountName, RuntimeDef runtime)
public static boolean cloneRuntime(java.lang.String serverNameFrom, java.lang.String accountNameFrom, java.lang.String serverNameTo, java.lang.String accountNameTo)
public static boolean moveRuntime(java.lang.String serverNameFrom, java.lang.String accountNameFrom, java.lang.String serverNameTo, java.lang.String accountNameTo)
public static boolean deleteRuntime(java.lang.String serverName, java.lang.String accountName)
public static SecurityAdmin getSecurityAdmin()
SecurityAdmin
instance.AdminServerImpl.WorkArea.sa
value.public static DirectoryService getDirectoryService()
DirectoryService
instance.AdminServerImpl.WorkArea.ds
value.public static void message(java.lang.String... msg)
public static DirectoryService getDirectoryServiceChecked()
public static TaggedName[] getRegisteredJars()
TaggedName
represents a single jar and contains jar
file name, fully qualified class name of the active hook (it
may be null
) and value indicating whether active
hook class matches stored hook class which is
"true"
if they match.public static java.lang.String[] getUnregisteredJars()
public static java.lang.String[] getAvailableJarHookClasses(java.lang.String jar)
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.jar
- The name of the target jar file.InitTermListener
interface.public static java.lang.String getStoredJarHookClass(java.lang.String jar)
jar
- The name of the target jar file (should be loaded).null
if the jar has
no hook specified or you have insufficient rights.public static JarOpErrorCode registerJar(java.lang.String jar, java.lang.String hookClass, boolean storeInDirectory)
jar
- The name of the jar file to register.hookClass
- Fully qualified name of the "hook" class for this jar, can be
null
.storeInDirectory
- If true
then the jar is registered in the
directory, else only runtime registration is performed.public static JarOpErrorCode deregisterJar(java.lang.String jar, boolean force, boolean removeFromDirectory)
jar
- Jar file which registration should be removed.force
- If it is true
then any sessions that have executed
API(s) associated to this jar are forcibly terminated. If this
parameter is false
then, if the jar has any
sessions that have executed API(s) associated to it, the
function returns
JarOpErrorCode.ACTIVE_SESSIONS_PRESENT
.removeFromDirectory
- If true
then the jar registration is removed from
the directory, else only runtime deregistration is performed.public static JarOpErrorCode deregisterJarFromDirectory(java.lang.String jar, java.lang.String storedHookClass)
jar
- The name of the jar to be deregistered.storedHookClass
- The name of the hook class which is stored for this jar in the
directory or null
if no hook is defined for this
jar.public static JarOpErrorCode changeJarHookClass(java.lang.String jar, java.lang.String hookClass)
jar
- The name of the target jar file.hookClass
- The new hook class for the target jar. null
indicates that no hook class should be specified.public static TaggedName[] getRegisteredJarAPIs(java.lang.String jar)
jar
- The name of the target jar file.public static java.lang.String[] getAvailableJarAPIImplClasses(java.lang.String jar, java.lang.String interfaceClass)
jar
- The name of the target jar file.interfaceClass
- Fully qualified name of the target interface.public static JarOpErrorCode registerJarAPI(java.lang.String interfaceClass, java.lang.String implementationClass)
interfaceClass
- Fully qualified name of the interface which defines the target
API.implementationClass
- Fully qualified name of the class which implements the target
API.public static JarOpErrorCode deregisterJarAPI(java.lang.String jar, java.lang.String interfaceClass, boolean force)
jar
- The name of the target jar file.interfaceClass
- Fully qualified name of the interface which defines the target
API.force
- If it is true
then any sessions that have executed
the target API are forcibly terminated. If this parameter is
false
then, if the jar has any
sessions that have executed API(s) associated to it, the
function returns
JarOpErrorCode.ACTIVE_SESSIONS_PRESENT
.public static java.lang.Boolean isUsingServerWideHooks()
true
if server-wide hooks are used,
false
if global hooks are used, null
if you have insufficient access rights.public static SessionInfo[] getActiveSessions(java.lang.String jar, java.lang.String apiInterfaceClass)
jar
- The name of the target jar file.apiInterfaceClass
- Fully qualified name of the interface which defines the target
API. Can be null
if you want to get sessions of
all APIs of the target jar.public static JarOpErrorCode terminateSessions(java.lang.String jar, java.lang.String iface)
iface
is not
null
.jar
- The jar name.iface
- The interface name. May be null
.public static java.lang.String[] getAvailableJarAPIInterfaces(java.lang.String jar, boolean showRegistered)
jar
- The name of the target jar file.showRegistered
- If true
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).public static JarOpErrorCode changeJarHooksType(boolean serverWide, boolean move)
serverWide
- if true
then server-wide hooks should be used,
else global hooks should be used.move
- if true
then existing hooks are copied/moved from
one scope to another, otherwise they don't.public static java.lang.Boolean isUsingMultiClassLoader()
MultiClassLoader
is used as the
system class loader.true
if
MultiClassLoader
is used
as the system class loader, false
if the standard
class loader is used, null
if you do not have
enough permissionspublic static TaggedName getManagedLibsDirInformation()
null
if the directory
is not specified) and string value which is "true"
if the directory is specified, exists and is accessible.
If you do not have admin rights, null
is returned.public static java.util.Map<java.lang.String,java.lang.Object> getReportParametersMap()
private static final float getFloatReportSettings(DirectoryService dirService, ReportParameters parameter, float defValue, java.util.Map<java.lang.String,java.lang.Object> map)
dirService
- The directory serviceparameter
- The given report parameterdefValue
- The default valuemap
- The report parameters map that is updated with the retrieved valueprivate static final java.lang.String getStringReportSettings(DirectoryService dirService, ReportParameters parameter, java.lang.String defValue, java.util.Map<java.lang.String,java.lang.Object> map)
dirService
- The directory serviceparameter
- The given report parameterdefValue
- The default valuemap
- The report parameters map that is updated with the retrieved valueprivate static final int getIntReportSettings(DirectoryService dirService, ReportParameters parameter, int defValue, java.util.Map<java.lang.String,java.lang.Object> map)
dirService
- The directory serviceparameter
- The given report parameterdefValue
- The default valuemap
- The report parameters map that is updated with the retrieved valueprivate static JarOpErrorCode addNodeStrings(DirectoryService ds, java.lang.String nodeId, java.lang.String[] values)
values
is an empty array).ds
- Target directory service.nodeId
- Path of the target node.values
- Values to be added.private static JarOpErrorCode removeNodeStrings(DirectoryService ds, java.lang.String nodeId, java.lang.String[] values)
ds
- Target directory service.nodeId
- Path of the target node.values
- Values to be removed.private static JarOpErrorCode toJarOpErrorCode(ErrorCode code)
ErrorCode
to JarOpErrorCode
.code
- source class loader error code.