com.zeroturnaround.liverebel.api.impl
Class CommandCenterImpl

java.lang.Object
  extended by com.zeroturnaround.liverebel.api.impl.CommandCenterImpl
All Implemented Interfaces:
CommandCenter, Closeable

public class CommandCenterImpl
extends Object
implements CommandCenter

Author:
Rein Raudjärv, Oleg Šelajev
See Also:
CommandCenter, CommandCenterFactory

Constructor Summary
CommandCenterImpl(String url, String username, String password, boolean verbose)
           
 
Method Summary
 void addDatabaseConf(String serverId, Long databaseDriverId, String jdbcUrl, String schemaName)
          Creates configuration and its schema.
 boolean addGroupChild(String groupName, String childGroupName)
           
 void addLdapUser(String domainName, String liveRebelUsername, String ldapUserName)
          Note: LDAP user ID-s may be complex or contain symbols that are not allowed in LiveRebel usernames, such as @.
You can use a simpler username in LiveRebel and specify the full LDAP one separately.
 boolean addServersToGroup(String groupName, Collection<String> serverIds)
           
 boolean cancelUpdate(Long updateId)
          Cancels manual update by id.
 boolean checkPrimaryAlive()
           
 void close()
           
 DiffResult compare(String _applicationId, String _fromVersionId, String _toVersionId, boolean full)
          Compares two versions of the given application.
 int countSeats()
           
 String createDatabaseProxy(com.zeroturnaround.liverebel.util.DatabaseServerExecutionMode execMode, String targetServerId)
          Sets up database server proxy.
 String createDatabaseProxyServer()
          Sets up database server proxy
 String createDatabaseProxyServer(Long serverGroupId)
          Sets up database server proxy
 Long createDatabaseSchema(String serverId, String jdbcUrl, String schemaName)
          Creates database schema for given server.
 boolean createGroup(String name, String description, Collection<String> serverIds)
           
 LdapDomainCreation createLdapDomain(String name)
           
 Long createProxyDatabaseConf(String serverId, Long databaseDriverId, String executionServer)
          Creates configuration for proxy database server.
 Long createProxyPromptDatabaseConf(String serverId, Long databaseDriverId)
          Creates configuration for proxy prompt database server.
 Long createStandaloneDatabaseConf(String serverId, Long databaseDriverId)
          Creates configuration for standalone database server.
 int deleteAllLicenses()
           
 boolean deleteGroup(String name)
           
 ConfigurableDeploy deploy(String applicationId, String versionId)
          Prepare to deploy a given application version.
 Long deploy(String applicationId, String versionId, String ctxPath, Collection<String> servers)
           
 Long deploy(String applicationId, String versionId, String ctxPath, Collection<String> servers, Collection<String> groups)
           
 Long deploy(String applicationId, String versionId, String ctxPath, Collection<String> servers, Collection<String> groups, String virtualHostName)
          Deploy application to specified servers.
 Long deploy(String applicationId, String versionId, String ctxPath, Collection<String> servers, Collection<String> groups, String virtualHostName, boolean disableScripts, File scriptDescriptionFile)
           
 Long deploy(String applicationId, String versionId, String ctxPath, Collection<String> servers, Collection<String> groups, String virtualHostName, boolean disableScripts, File scriptDescriptionFile, File scriptEntriesArchive)
           
 Long deploy(String applicationId, String versionId, String ctxPath, Collection<String> servers, String proxyTargetServerId, List<Long> schemaIds)
           
 Long deploy(String applicationId, String versionId, String ctxPath, String fileServerDeploymentPath, Collection<String> servers, Collection<String> groups, String virtualHostName, boolean disableScripts, File scriptDescriptionFile, File scriptEntriesArchive)
           
 Long deploy(String applicationId, String versionId, String ctxPath, String fileServerDeploymentPath, Collection<String> servers, Collection<String> groups, String virtualHostName, boolean disableScripts, File scriptDescriptionFile, File scriptEntriesArchive, String proxyTargetServerId, List<Long> schemaIds)
           
 Long deployToFileServers(String applicationId, String versionId, String fileServerDeploymentPath)
           
 ApplicationInfo enableNinjaMode(String serverId, String applicationId)
          Enables inplace edit mode (ninja) for given application on a given server
 List<ServerInfo> expandGroup(String groupName)
           
 FailoverOperations failoverOperations()
           
 ApplicationInfo finishEditMode(String serverId, String applicationId, String versionId)
          Finishes in-place edit mode on given server for given application.
 ApplicationInfo finishNinjaUpdate(String serverId, String applicationId, String versionId)
          Finishes inplace edit (ninja) update on given server for given application.
 Map<Long,SchemaInfo> getAllDatabaseSchemas()
           
 List<ServerGroup> getAllGroups()
           
 ApplicationInfo getApplication(String applicationId)
          Returns current info about an application.
 Map<String,ApplicationInfo> getApplications()
          Lists all applications.
 CommandCenterUpdate getCommandCenterUpdate()
           
 Long getDatabaseServerSchemaId(String serverId)
           
 Long getDatabaseServerSchemaId(String serverId, String schemaName)
           
 List<ServerGroup> getGroups(String name)
           
 String getHistoryAsCsv(Long from, Long to)
          exports history as CSV file
 Collection<InstallerExecution> getInstallerExecutions()
           
 Date getLastFailoverSyncTime()
           
 Collection<String> getLogLines(Long taskId)
          Retrieved the log for given task.
 String getMetadata(String applicationId, String versionId)
          Deprecated. 
 PausedUpdate getPausedUpdate(Long id)
          Returns a paused update by its Id.
 List<Long> getRunningPausedUpdateIds()
           
 ServerInfo getServer(String serverIdOrName)
          Returns current info about a server.
 Map<String,ServerInfo> getServers()
          Lists all servers.
 String getTrace(String applicationId, String versionId)
           
 boolean getVerbose()
           
 String getVersion()
           
 boolean isAlive()
           
 ManagedConfOperations manageConfiguration()
           
 boolean registerAsFailover(String primaryHost, int primaryPort, String token)
           
 void reloadServers(Collection<String> serverIds, int timeoutSeconds, String updateMode)
           
 void remove(String applicationId)
          Removes app from command center.
 void removeDatabaseSchema(Long schemaId)
          Removes database schema.
 boolean removeGroupChild(String groupName, String childGroupName)
           
 void removeServer(String serverId)
          Removes a server.
 boolean removeServersFromGroup(String groupName, Collection<String> serverIds)
           
 void removeVersion(String applicationId, String versionId)
          Removes application version from command center.
 ServerInfo renameServer(String serverId, String newName)
           
 boolean restartServer(String serverId)
          Restart server (asynchronously)
 boolean resumeUpdate(Long updateId)
          Resumes manual update by id.
 void resyncApplicationsData(Collection<String> serverIds)
          Refreshes application data from servers given by ids and overwrites current info in CC by the actual one that came from servers.
 ServerGroupOperations serverGroupOperations()
           
 boolean setHotpatchingEnabled(String serverId, boolean enabled)
          Enable/disable hotpatching update for specified server
 ApplicationInfo startEditMode(String serverId, String applicationId)
          Enables in-place edit mode for given application on a given server
 void syncWithFailover()
           
 ConfigurableUndeploy undeploy(String applicationId)
          Prepare to undeploy a given application.
 Long undeploy(String applicationId, Collection<String> servers)
          Undeploy application from specified servers.
 Long undeploy(String applicationId, Collection<String> servers, Collection<String> groups)
          Undeploy application from specified servers.
 Long undeploy(String applicationId, Collection<String> servers, Collection<String> groups, boolean disableScripts, File scriptDescriptionFile)
          file and archive type scripts are expected to be in the local filesystem
 Long undeploy(String applicationId, Collection<String> servers, Collection<String> groups, boolean disableScripts, File scriptDescriptionFile, File scriptEntriesArchive)
           
 Long undeploy(String applicationId, Collection<String> servers, Collection<String> groups, boolean disableScripts, File scriptDescriptionFile, File scriptEntriesArchive, String proxyTargetServerId, List<Long> schemaIds)
           
 Long undeploy(String applicationId, Collection<String> servers, String proxyTargetServerId, List<Long> schemaIds)
          Undeploy application from specified servers and schemas
 ConfigurableUpdate update(String applicationId, String versionId)
          Start updating an application to a given version.
 AgentUpdate updateAgent()
           
 DatabaseConfiguration updateDatabaseConfiguration(Long databaseConfigurationId)
          Update existing database configuration.
 SchemaConfiguration updateDatabaseSchema(Long schemaId)
          Update existing database schema.
 UploadInfo upload(File file)
          Uploads new version of an application.
 UploadInfo upload(String applicationId, String fromVersion, File diff)
          Uploads new version of an application.
 Long uploadDatabaseDriver(File jar)
           
 boolean uploadLicense(File license)
           
 boolean uploadMetadata(File file, String applicationId, String versionId)
          Deprecated. 
 boolean uploadTrace(File file, String applicationId, String versionId)
           
 Upload uploadVersion(File file)
          Prepares the upload of new version of an application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandCenterImpl

public CommandCenterImpl(String url,
                         String username,
                         String password,
                         boolean verbose)
Method Detail

isAlive

public boolean isAlive()
Specified by:
isAlive in interface CommandCenter
Returns:
true if the Command Center is alive.

getServers

public Map<String,ServerInfo> getServers()
Description copied from interface: CommandCenter
Lists all servers.

Specified by:
getServers in interface CommandCenter
Returns:
all servers by their Id.

getServer

public ServerInfo getServer(String serverIdOrName)
Description copied from interface: CommandCenter
Returns current info about a server.

Specified by:
getServer in interface CommandCenter
Parameters:
serverIdOrName - id or name of the server.
Returns:
server info.

renameServer

public ServerInfo renameServer(String serverId,
                               String newName)
Specified by:
renameServer in interface CommandCenter
newName - - new name for the server
Returns:
information about the server after name has changed

restartServer

public boolean restartServer(String serverId)
Description copied from interface: CommandCenter
Restart server (asynchronously)

Specified by:
restartServer in interface CommandCenter
Parameters:
serverId - server id
Returns:
true if request successes

reloadServers

public void reloadServers(Collection<String> serverIds,
                          int timeoutSeconds,
                          String updateMode)
Specified by:
reloadServers in interface CommandCenter
Parameters:
serverIds - ids
timeoutSeconds - - the same meaning as for update
updateMode - - OFFLINE or ROLLING (currently only offline :))

setHotpatchingEnabled

public boolean setHotpatchingEnabled(String serverId,
                                     boolean enabled)
Description copied from interface: CommandCenter
Enable/disable hotpatching update for specified server

Specified by:
setHotpatchingEnabled in interface CommandCenter
Parameters:
serverId - server id
enabled - true to enable hotpatching, false to disable it
Returns:
true if request success

removeServer

public void removeServer(String serverId)
Description copied from interface: CommandCenter
Removes a server.

Specified by:
removeServer in interface CommandCenter
Parameters:
serverId - server Id.

getApplications

public Map<String,ApplicationInfo> getApplications()
Description copied from interface: CommandCenter
Lists all applications.

Specified by:
getApplications in interface CommandCenter
Returns:
all applications by their Id.

getApplication

public ApplicationInfo getApplication(String applicationId)
Description copied from interface: CommandCenter
Returns current info about an application.

Specified by:
getApplication in interface CommandCenter
Parameters:
applicationId - application Id.
Returns:
application info.

upload

public UploadInfo upload(File file)
Description copied from interface: CommandCenter
Uploads new version of an application.

Specified by:
upload in interface CommandCenter
Parameters:
file - archive file.
Returns:
uploaded application version.

compare

public DiffResult compare(String _applicationId,
                          String _fromVersionId,
                          String _toVersionId,
                          boolean full)
Description copied from interface: CommandCenter
Compares two versions of the given application.

Specified by:
compare in interface CommandCenter
Parameters:
_applicationId - application Id.
_fromVersionId - current version Id.
_toVersionId - new version Id.
full - include all differences (otherwise only warnings and errors are included).

update

public ConfigurableUpdate update(String applicationId,
                                 String versionId)
Description copied from interface: CommandCenter
Start updating an application to a given version.

Specified by:
update in interface CommandCenter
Parameters:
applicationId - application Id.
versionId - version Id.

getPausedUpdate

public PausedUpdate getPausedUpdate(Long id)
Description copied from interface: CommandCenter
Returns a paused update by its Id.

Specified by:
getPausedUpdate in interface CommandCenter
Parameters:
id - update Id.
Returns:
the paused update or null if no such update found.
See Also:
PreparedPausableUpdate.executeWithPause()

failoverOperations

public FailoverOperations failoverOperations()
Specified by:
failoverOperations in interface CommandCenter
Returns:
interface that provides operations related to failover Command Center

registerAsFailover

public boolean registerAsFailover(String primaryHost,
                                  int primaryPort,
                                  String token)
Specified by:
registerAsFailover in interface CommandCenter

syncWithFailover

public void syncWithFailover()
Specified by:
syncWithFailover in interface CommandCenter

checkPrimaryAlive

public boolean checkPrimaryAlive()
Specified by:
checkPrimaryAlive in interface CommandCenter

getVerbose

public boolean getVerbose()
Specified by:
getVerbose in interface CommandCenter

deploy

public ConfigurableDeploy deploy(String applicationId,
                                 String versionId)
Description copied from interface: CommandCenter
Prepare to deploy a given application version. Configure additional parameters using the returned ConfigurableDeploy object. The deploy will be executed once PreparedDeploy.execute() is invoked. The archive of the given version must be available in the Command Center before this operation.

Specified by:
deploy in interface CommandCenter

deploy

public Long deploy(String applicationId,
                   String versionId,
                   String ctxPath,
                   Collection<String> servers)
Specified by:
deploy in interface CommandCenter

deploy

public Long deploy(String applicationId,
                   String versionId,
                   String ctxPath,
                   Collection<String> servers,
                   String proxyTargetServerId,
                   List<Long> schemaIds)
Specified by:
deploy in interface CommandCenter

deployToFileServers

public Long deployToFileServers(String applicationId,
                                String versionId,
                                String fileServerDeploymentPath)
Specified by:
deployToFileServers in interface CommandCenter

deploy

public Long deploy(String applicationId,
                   String versionId,
                   String ctxPath,
                   Collection<String> servers,
                   Collection<String> groups)
Specified by:
deploy in interface CommandCenter

deploy

public Long deploy(String applicationId,
                   String versionId,
                   String ctxPath,
                   Collection<String> servers,
                   Collection<String> groups,
                   String virtualHostName)
Description copied from interface: CommandCenter
Deploy application to specified servers. Using initial deploy.

Specified by:
deploy in interface CommandCenter
Parameters:
applicationId - - application id
ctxPath - - context path for servers
servers - - server jvmid-s
virtualHostName - - name of the virtual host to be used for deploying
Returns:
task ID

deploy

public Long deploy(String applicationId,
                   String versionId,
                   String ctxPath,
                   Collection<String> servers,
                   Collection<String> groups,
                   String virtualHostName,
                   boolean disableScripts,
                   File scriptDescriptionFile)
Specified by:
deploy in interface CommandCenter

deploy

public Long deploy(String applicationId,
                   String versionId,
                   String ctxPath,
                   Collection<String> servers,
                   Collection<String> groups,
                   String virtualHostName,
                   boolean disableScripts,
                   File scriptDescriptionFile,
                   File scriptEntriesArchive)
Specified by:
deploy in interface CommandCenter

deploy

public Long deploy(String applicationId,
                   String versionId,
                   String ctxPath,
                   String fileServerDeploymentPath,
                   Collection<String> servers,
                   Collection<String> groups,
                   String virtualHostName,
                   boolean disableScripts,
                   File scriptDescriptionFile,
                   File scriptEntriesArchive)
Specified by:
deploy in interface CommandCenter

deploy

public Long deploy(String applicationId,
                   String versionId,
                   String ctxPath,
                   String fileServerDeploymentPath,
                   Collection<String> servers,
                   Collection<String> groups,
                   String virtualHostName,
                   boolean disableScripts,
                   File scriptDescriptionFile,
                   File scriptEntriesArchive,
                   String proxyTargetServerId,
                   List<Long> schemaIds)
Specified by:
deploy in interface CommandCenter

undeploy

public Long undeploy(String applicationId,
                     Collection<String> servers,
                     String proxyTargetServerId,
                     List<Long> schemaIds)
Description copied from interface: CommandCenter
Undeploy application from specified servers and schemas

Specified by:
undeploy in interface CommandCenter
Parameters:
applicationId - - application id
servers - - server jvmid-s
proxyTargetServerId - - proxy target server id
schemaIds - - schema ids
Returns:
task ID

undeploy

public ConfigurableUndeploy undeploy(String applicationId)
Description copied from interface: CommandCenter
Prepare to undeploy a given application. Configure additional parameters using the returned ConfigurableUndeploy object. The undeploy will be executed once PreparedUndeploy.execute() is invoked.

Specified by:
undeploy in interface CommandCenter

undeploy

public Long undeploy(String applicationId,
                     Collection<String> servers)
Description copied from interface: CommandCenter
Undeploy application from specified servers.

Specified by:
undeploy in interface CommandCenter
Parameters:
applicationId - - application id
servers - - server jvmid-s
Returns:
task ID

undeploy

public Long undeploy(String applicationId,
                     Collection<String> servers,
                     Collection<String> groups)
Description copied from interface: CommandCenter
Undeploy application from specified servers.

Specified by:
undeploy in interface CommandCenter
Parameters:
applicationId - - application id
servers - - server jvmid-s
groups - - server groups
Returns:
task ID

undeploy

public Long undeploy(String applicationId,
                     Collection<String> servers,
                     Collection<String> groups,
                     boolean disableScripts,
                     File scriptDescriptionFile)
Description copied from interface: CommandCenter
file and archive type scripts are expected to be in the local filesystem

Specified by:
undeploy in interface CommandCenter

undeploy

public Long undeploy(String applicationId,
                     Collection<String> servers,
                     Collection<String> groups,
                     boolean disableScripts,
                     File scriptDescriptionFile,
                     File scriptEntriesArchive)
Specified by:
undeploy in interface CommandCenter

undeploy

public Long undeploy(String applicationId,
                     Collection<String> servers,
                     Collection<String> groups,
                     boolean disableScripts,
                     File scriptDescriptionFile,
                     File scriptEntriesArchive,
                     String proxyTargetServerId,
                     List<Long> schemaIds)
Specified by:
undeploy in interface CommandCenter

remove

public void remove(String applicationId)
Description copied from interface: CommandCenter
Removes app from command center.

Specified by:
remove in interface CommandCenter

removeVersion

public void removeVersion(String applicationId,
                          String versionId)
Description copied from interface: CommandCenter
Removes application version from command center.

Specified by:
removeVersion in interface CommandCenter

getLastFailoverSyncTime

public Date getLastFailoverSyncTime()
Specified by:
getLastFailoverSyncTime in interface CommandCenter

resumeUpdate

public boolean resumeUpdate(Long updateId)
Description copied from interface: CommandCenter
Resumes manual update by id. Throws NotFound if no update with such id is found.

Specified by:
resumeUpdate in interface CommandCenter
Returns:
boolean if update was successful.

cancelUpdate

public boolean cancelUpdate(Long updateId)
Description copied from interface: CommandCenter
Cancels manual update by id. Throws NotFound if no update with such id is found.

Specified by:
cancelUpdate in interface CommandCenter
Returns:
if update cancellation was successful.

getRunningPausedUpdateIds

public List<Long> getRunningPausedUpdateIds()
Specified by:
getRunningPausedUpdateIds in interface CommandCenter
Returns:
List of ids of all paused updates that are currently in Command Center

upload

public UploadInfo upload(String applicationId,
                         String fromVersion,
                         File diff)
                  throws DuplicationException
Description copied from interface: CommandCenter
Uploads new version of an application.

Specified by:
upload in interface CommandCenter
Parameters:
applicationId - - application identificator
fromVersion - - version on which this diff is based
diff - archive file.
Returns:
uploaded application version.
Throws:
DuplicationException - if the given version already exists on the server.

startEditMode

public ApplicationInfo startEditMode(String serverId,
                                     String applicationId)
Description copied from interface: CommandCenter
Enables in-place edit mode for given application on a given server

Specified by:
startEditMode in interface CommandCenter

finishEditMode

public ApplicationInfo finishEditMode(String serverId,
                                      String applicationId,
                                      String versionId)
Description copied from interface: CommandCenter
Finishes in-place edit mode on given server for given application. The resulted version is given verId.

Specified by:
finishEditMode in interface CommandCenter

enableNinjaMode

public ApplicationInfo enableNinjaMode(String serverId,
                                       String applicationId)
Description copied from interface: CommandCenter
Enables inplace edit mode (ninja) for given application on a given server

Specified by:
enableNinjaMode in interface CommandCenter

finishNinjaUpdate

public ApplicationInfo finishNinjaUpdate(String serverId,
                                         String applicationId,
                                         String versionId)
Description copied from interface: CommandCenter
Finishes inplace edit (ninja) update on given server for given application. The resulted version is given verId.

Specified by:
finishNinjaUpdate in interface CommandCenter

serverGroupOperations

public ServerGroupOperations serverGroupOperations()
Specified by:
serverGroupOperations in interface CommandCenter

countSeats

public int countSeats()
Specified by:
countSeats in interface CommandCenter
Returns:
licenses soft-limit, how many servers can connect.

uploadLicense

public boolean uploadLicense(File license)
Specified by:
uploadLicense in interface CommandCenter
Returns:
true if the license is uploaded and verified and working

deleteAllLicenses

public int deleteAllLicenses()
Specified by:
deleteAllLicenses in interface CommandCenter
Returns:
number of license files deleted

createGroup

public boolean createGroup(String name,
                           String description,
                           Collection<String> serverIds)
Specified by:
createGroup in interface CommandCenter

addServersToGroup

public boolean addServersToGroup(String groupName,
                                 Collection<String> serverIds)
Specified by:
addServersToGroup in interface CommandCenter

removeServersFromGroup

public boolean removeServersFromGroup(String groupName,
                                      Collection<String> serverIds)
Specified by:
removeServersFromGroup in interface CommandCenter

getAllGroups

public List<ServerGroup> getAllGroups()
Specified by:
getAllGroups in interface CommandCenter

getGroups

public List<ServerGroup> getGroups(String name)
Specified by:
getGroups in interface CommandCenter

expandGroup

public List<ServerInfo> expandGroup(String groupName)
Specified by:
expandGroup in interface CommandCenter

deleteGroup

public boolean deleteGroup(String name)
Specified by:
deleteGroup in interface CommandCenter

addGroupChild

public boolean addGroupChild(String groupName,
                             String childGroupName)
Specified by:
addGroupChild in interface CommandCenter

removeGroupChild

public boolean removeGroupChild(String groupName,
                                String childGroupName)
Specified by:
removeGroupChild in interface CommandCenter

getCommandCenterUpdate

public CommandCenterUpdate getCommandCenterUpdate()
Specified by:
getCommandCenterUpdate in interface CommandCenter
Returns:
API for updating Command Center.

updateAgent

public AgentUpdate updateAgent()
Specified by:
updateAgent in interface CommandCenter
Returns:
API for updating Agents.

uploadTrace

public boolean uploadTrace(File file,
                           String applicationId,
                           String versionId)
Specified by:
uploadTrace in interface CommandCenter
Returns:
whether trace existed before and was replaced or not.

getTrace

public String getTrace(String applicationId,
                       String versionId)
Specified by:
getTrace in interface CommandCenter

uploadMetadata

@Deprecated
public boolean uploadMetadata(File file,
                                         String applicationId,
                                         String versionId)
Deprecated. 

Description copied from interface: CommandCenter
Replaced with CommandCenter.uploadTrace(File, String, String)

Specified by:
uploadMetadata in interface CommandCenter

getMetadata

@Deprecated
public String getMetadata(String applicationId,
                                     String versionId)
Deprecated. 

Description copied from interface: CommandCenter
Replaced with CommandCenter.getTrace(String, String)

Specified by:
getMetadata in interface CommandCenter

getVersion

public String getVersion()
Specified by:
getVersion in interface CommandCenter

uploadVersion

public Upload uploadVersion(File file)
Description copied from interface: CommandCenter
Prepares the upload of new version of an application.

Specified by:
uploadVersion in interface CommandCenter
Parameters:
file - archive file
Returns:
an object for configuring the upload

getLogLines

public Collection<String> getLogLines(Long taskId)
Description copied from interface: CommandCenter
Retrieved the log for given task.

Specified by:
getLogLines in interface CommandCenter
Parameters:
taskId - the task ID
Returns:
the task log splitted into lines

getInstallerExecutions

public Collection<InstallerExecution> getInstallerExecutions()
Specified by:
getInstallerExecutions in interface CommandCenter

manageConfiguration

public ManagedConfOperations manageConfiguration()
Specified by:
manageConfiguration in interface CommandCenter
Returns:
interface that provides operations related to managed configuration

addDatabaseConf

public void addDatabaseConf(String serverId,
                            Long databaseDriverId,
                            String jdbcUrl,
                            String schemaName)
Description copied from interface: CommandCenter

Creates configuration and its schema.

Note! In case one want's to use proxy database server, one must call CommandCenter.createDatabaseProxy(DatabaseServerExecutionMode, String) before adding configuration.

Specified by:
addDatabaseConf in interface CommandCenter
Parameters:
serverId - - database server id
databaseDriverId - - database driver id
jdbcUrl - - JDBC url
schemaName - - name of the schema

createDatabaseProxy

public String createDatabaseProxy(com.zeroturnaround.liverebel.util.DatabaseServerExecutionMode execMode,
                                  String targetServerId)
Description copied from interface: CommandCenter

Sets up database server proxy.

Note! Must be called before CommandCenter.addDatabaseConf(String, Long, String, String).

Specified by:
createDatabaseProxy in interface CommandCenter
Parameters:
execMode - execution mode, DatabaseServerExecutionMode.PROXY or DatabaseServerExecutionMode.PROXY_PROMPT
targetServerId - target server id
Returns:
id of the created proxy server

uploadDatabaseDriver

public Long uploadDatabaseDriver(File jar)
Specified by:
uploadDatabaseDriver in interface CommandCenter
Parameters:
jar - JDBC driver jar
Returns:
id of the uploaded driver

getDatabaseServerSchemaId

public Long getDatabaseServerSchemaId(String serverId)
Specified by:
getDatabaseServerSchemaId in interface CommandCenter
Parameters:
serverId - id of the database server
Returns:
first schema id associated with given database server

getDatabaseServerSchemaId

public Long getDatabaseServerSchemaId(String serverId,
                                      String schemaName)
Specified by:
getDatabaseServerSchemaId in interface CommandCenter
Parameters:
serverId - id of the database server
schemaName - name of the schema
Returns:
schema id associated with given database server and has given schema name

createStandaloneDatabaseConf

public Long createStandaloneDatabaseConf(String serverId,
                                         Long databaseDriverId)
Description copied from interface: CommandCenter

Creates configuration for standalone database server.

Specified by:
createStandaloneDatabaseConf in interface CommandCenter
Parameters:
serverId - server id
databaseDriverId - database driver id
Returns:
Id of the created database configuration

createProxyPromptDatabaseConf

public Long createProxyPromptDatabaseConf(String serverId,
                                          Long databaseDriverId)
Description copied from interface: CommandCenter

Creates configuration for proxy prompt database server.

Note! One must call CommandCenter.createDatabaseProxyServer(Long) before adding configuration.

Specified by:
createProxyPromptDatabaseConf in interface CommandCenter
Parameters:
serverId - server id
databaseDriverId - database driver id
Returns:
Id of the created database configuration

createProxyDatabaseConf

public Long createProxyDatabaseConf(String serverId,
                                    Long databaseDriverId,
                                    String executionServer)
Description copied from interface: CommandCenter

Creates configuration for proxy database server.

Note! One must call CommandCenter.createDatabaseProxyServer(Long) before adding configuration.

Specified by:
createProxyDatabaseConf in interface CommandCenter
Parameters:
serverId - server id
databaseDriverId - database driver id
executionServer - execution server id, also know as proxy target
Returns:
Id of the created database configuration

updateDatabaseConfiguration

public DatabaseConfiguration updateDatabaseConfiguration(Long databaseConfigurationId)
Description copied from interface: CommandCenter

Update existing database configuration.

Specified by:
updateDatabaseConfiguration in interface CommandCenter
Parameters:
databaseConfigurationId - id of the database configuration to update

createDatabaseSchema

public Long createDatabaseSchema(String serverId,
                                 String jdbcUrl,
                                 String schemaName)
Description copied from interface: CommandCenter

Creates database schema for given server.

Note! Server must have configuration before adding schemas.

Specified by:
createDatabaseSchema in interface CommandCenter
Parameters:
serverId - server id
jdbcUrl - JDBC url
schemaName - schema name
Returns:
Id of the created database schema.

updateDatabaseSchema

public SchemaConfiguration updateDatabaseSchema(Long schemaId)
Description copied from interface: CommandCenter

Update existing database schema.

Specified by:
updateDatabaseSchema in interface CommandCenter
Parameters:
schemaId - Id of the database schema to update

removeDatabaseSchema

public void removeDatabaseSchema(Long schemaId)
Description copied from interface: CommandCenter

Removes database schema.

Specified by:
removeDatabaseSchema in interface CommandCenter
Parameters:
schemaId - schema id

createDatabaseProxyServer

public String createDatabaseProxyServer()
Description copied from interface: CommandCenter

Sets up database server proxy

Specified by:
createDatabaseProxyServer in interface CommandCenter
Returns:
created database proxy server id

createDatabaseProxyServer

public String createDatabaseProxyServer(Long serverGroupId)
Description copied from interface: CommandCenter

Sets up database server proxy

Specified by:
createDatabaseProxyServer in interface CommandCenter
Returns:
created database proxy server id

getAllDatabaseSchemas

public Map<Long,SchemaInfo> getAllDatabaseSchemas()
Specified by:
getAllDatabaseSchemas in interface CommandCenter
Returns:
all schemas defined on all database servers by their Id

resyncApplicationsData

public void resyncApplicationsData(Collection<String> serverIds)
Description copied from interface: CommandCenter
Refreshes application data from servers given by ids and overwrites current info in CC by the actual one that came from servers.

Specified by:
resyncApplicationsData in interface CommandCenter
Parameters:
serverIds - - serverIds of servers to sync, if empty, will resync all servers.

close

public void close()
Specified by:
close in interface Closeable

createLdapDomain

public LdapDomainCreation createLdapDomain(String name)
Specified by:
createLdapDomain in interface CommandCenter
Parameters:
name - Domain name - will be used later to identify this domain, visible also on login page.
Returns:
API for creating LDAP security domains.

addLdapUser

public void addLdapUser(String domainName,
                        String liveRebelUsername,
                        String ldapUserName)
Description copied from interface: CommandCenter

Note: LDAP user ID-s may be complex or contain symbols that are not allowed in LiveRebel usernames, such as @.
You can use a simpler username in LiveRebel and specify the full LDAP one separately.

In case of simpler user ID-s, you can pass null as ldapUserName, then liveRebelUsername will be used for both.

Also note that the user will not be added to LiveRebel if it doesn't already exist in the LDAP server.

Specified by:
addLdapUser in interface CommandCenter
Parameters:
domainName - Name of the domain to add the user to. The domain must be created before the user is added.

getHistoryAsCsv

public String getHistoryAsCsv(Long from,
                              Long to)
Description copied from interface: CommandCenter
exports history as CSV file

Specified by:
getHistoryAsCsv in interface CommandCenter
Parameters:
from - - optional timestamp to export history starting from this (UNIX time)
to - - optional timestamp to export history before this (UNIX time)
Returns:
CSV-string


Copyright © 2013. All Rights Reserved.