com.jscape.inet.mft.management.client.api
Class ManagerSubsystem

java.lang.Object
  extended by com.jscape.inet.mft.management.client.api.ManagerSubsystem

public final class ManagerSubsystem
extends java.lang.Object

Management system facade. Contains methods to manage the Secure FTP Server including creating, starting and stopping domains, creating user accounts and groups.

The following is a little example that shows how can the API be used

  // creates a new ManagerSubsystem instance passing as argument a ClientSessionContext
        ManagerSubsystem manager = new ManagerSubsystem(context);
 

try{ // connects to the Secure FTP Server manager.connect();

// Creates a new VirtualLocalFile which is used as argument when the new account will be created VirtualLocalFile[] paths = new VirtualLocalFile[1];

// Creates a VirtualLocalFile AccessPermissions permissions = new AccessPermissions(); // Permission of the virtual file name paths[0] = new VirtualLocalFile(virtualFileName, permissions, realFileName);

//A new account instance is created Account account = new Account(userName, login, password, paths, null);

// The account is added to the Server "server" manager.addAccount("server", account);

} catch(Exception e){ e.printStackTrace(); } finally{ managerServer.disconnect(); }

Version:
1.0
Author:
Alex
See Also:
Source code

Constructor Summary
ManagerSubsystem(ManagerConfiguration configuration)
          Creates a manager subsystem instance
ManagerSubsystem(java.lang.String configFile)
          Creates a new manager subsystem instance.
 
Method Summary
 void addAccount(java.lang.String domainName, Account account)
          Adds a new account to the domain.
 void addDirectoryMonitor(java.lang.String domainName, DirectoryMonitor monitor)
          Adds a new directory monitor.
 void addDomain(DomainDescriptor descriptor)
          Adds a new domain.
 void addGroup(java.lang.String domainName, Group group)
          Adds a new group.
 void addReport(java.lang.String domainName, Report report)
          Adds a new report to the domain.
 void addResource(java.lang.String domainName, ResourceDescriptor resource)
          Adds a new remote resource.
 void connect()
          Connects to the remote server part.
 void deleteAccount(java.lang.String domaiName, java.lang.String accountName)
          Deletes domain account.
 void deleteAccountTemplate(java.lang.String domainName, java.lang.String templateName)
          Deletes the specified template from the server.
 void deleteDirectoryMonitor(java.lang.String domainName, java.lang.String monitorName)
          Removes directory monitor.
 void deleteDomain(java.lang.String name)
          Deletes a domain.
 void deleteGroup(java.lang.String domainName, java.lang.String groupName)
          Deletes a group.
 void deleteReport(java.lang.String domainName, java.lang.String reportName)
          Deletes a report.
 void deleteResource(java.lang.String domainName, java.lang.String resourceName)
          Deletes a resource.
 void disconnect()
          Disconnects from the remote server.
 void executeRequest(com.jscape.inet.mft.management.requests.ManagerRequest request)
          Executes all the request operations in ManagerSubsystem API
 Account findAccount(java.lang.String domainName, java.lang.String login)
          Finds the specified account.
 IPAccessRule[] getAccessRules(java.lang.String name)
          Gets a domain IP access rules.
 Account[] getAccounts(java.lang.String domainName)
          Gets domain accounts.
 DomainDescriptor[] getAllDomains()
          Gets all available domains descriptors.
 CertificateMap getCertificates()
          Gets known client certificates.
 ManagerConfiguration getConfiguration()
          Reurns client context.
 com.jscape.util.event.CommonEventContext getContext()
          Gets the context instance.
 DirectoryMonitor[] getDirectoryMonitors(java.lang.String domainName)
          Returns directory monitors for the specifed domain.
 EmailServiceConfiguration getEmailServiceConfiguration()
          Returns email service configuration.
 Group[] getGroups(java.lang.String domainName)
          Gets domain groups.
 com.jscape.inet.mft.management.licensing.License getLicense()
          Gets an application license data.
 java.lang.String getLog(java.lang.String name, int recordsCount)
          Gets the latest server log lines.
 ManagerConfiguration getManagerConfiguration()
          Returns a current remote management server configuration.
 KeyPairMap getPrivateKeys()
          Gets server keys.
 PublicKeyMap getPublicKeys()
          Gets known client public keys.
 Report[] getReports(java.lang.String domainName)
          Returns all domain reports.
 com.jscape.inet.mft.common.Statistics getStatistics(java.lang.String name)
          Gets a domain statistics.
 WebConfiguration getWebConfiguration()
          Returns web server configuration.
 boolean isConnected()
          Checks if current instance is connected to the server.
 void kickUser(java.lang.String domainName, java.lang.String accountName, boolean disableAccount)
          Closes user sessions.
 void setAccessRules(java.lang.String domainName, IPAccessRule[] rules)
          Sets domain IP access rules.
 void setAccount(java.lang.String domainName, Account account)
          Adds a new account to the domain.
 void setAccountTemplate(java.lang.String domainName, com.jscape.inet.vfs.AccountTemplate template)
          Saves account template to the server.
 void setAuthenticationService(java.lang.String domainName, AuthenticationServiceDescriptor serviceDescriptor)
          Sets new domain authentication service.
 void setConfiguration(ManagerConfiguration configuration)
          Sets new client context.
 void setDatastoreService(java.lang.String domainName, DatastoreServiceDescriptor serviceDescriptor)
          Sets new domain datastore service.
 void setDomainDescription(java.lang.String domainName, java.lang.String description)
          Sets new domain description.
 void setEmailServiceConfiguration(EmailServiceConfiguration configuration, java.util.Properties properties)
          Sets email service configuration.
 void setEventService(java.lang.String domainName, ServiceDescriptor serviceDescriptor)
          Sets new domain event service.
 void setKeys(CertificateMap certificates, PublicKeyMap publicKeys, KeyPairMap serverKeys, com.jscape.pgp.PgpKeystore pgpKeys)
          Sets security credentials.
 void setLogService(java.lang.String domainName, LogServiceDescriptor serviceDescriptor, LogConfiguration configuration)
          Sets new domain log service.
 void setManagerConfiguration(ManagerConfiguration configuration)
          Sets a new management server configuration and restarts it.
 void setPasswordService(java.lang.String domainName, PasswordServiceDescriptor serviceDescriptor)
          Sets new domain password service.
 void setRestrictionServices(java.lang.String domainName, ServiceDescriptor[] serviceDescriptors)
          Sets new domain restriction services.
 void setTransportServices(java.lang.String domainName, TransportServiceDescriptor[] serviceDescriptors, Configuration[] configurations)
          Sets new domain transport services.
 void setWebConfiguration(WebConfiguration configuration)
          Sets web server configuration.
 void startAllDomains()
          Starts all domains.
 void startDomain(java.lang.String name)
          Starts a specified domain.
 void stopAllDomains()
          Stops all domains.
 void stopDomain(java.lang.String name)
          Stops a specified domain.
 void testAuthenticationService(ServiceDescriptor descriptor, java.lang.String login, java.lang.String password)
          Tests authentication subsystem.
 void testDatastoreService(ServiceDescriptor descriptor)
          Tests the datastore service.
 void testLogService(ServiceDescriptor descriptor)
          Tests log service subsystem.
 void testResource(ResourceDescriptor resource)
          Tests remote resurce accessibility.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagerSubsystem

public ManagerSubsystem(java.lang.String configFile)
                 throws ManagerException
Creates a new manager subsystem instance.

Parameters:
configFile - configuration file path
Throws:
ManagerException - if an error occurs

ManagerSubsystem

public ManagerSubsystem(ManagerConfiguration configuration)
                 throws ManagerException
Creates a manager subsystem instance

Parameters:
configuration - configuration
Throws:
ManagerException - if an error occurs
Method Detail

getConfiguration

public ManagerConfiguration getConfiguration()
Reurns client context.

Returns:
client context

setConfiguration

public void setConfiguration(ManagerConfiguration configuration)
Sets new client context.

Parameters:
configuration - new context

connect

public void connect()
             throws ManagerException
Connects to the remote server part.

Throws:
ManagerException - if an error occurs

disconnect

public void disconnect()
Disconnects from the remote server.


isConnected

public boolean isConnected()
Checks if current instance is connected to the server.

Returns:
true if instance is connected

getManagerConfiguration

public ManagerConfiguration getManagerConfiguration()
                                             throws ManagerException
Returns a current remote management server configuration.

Returns:
current remote manager configuration
Throws:
ManagerException - if an error occurs

setManagerConfiguration

public void setManagerConfiguration(ManagerConfiguration configuration)
                             throws ManagerException
Sets a new management server configuration and restarts it.

Parameters:
configuration - new configuration
Throws:
ManagerException - if an error occurs

getWebConfiguration

public WebConfiguration getWebConfiguration()
                                     throws ManagerException
Returns web server configuration.

Returns:
web server configuration
Throws:
ManagerException - if an error occurs

setWebConfiguration

public void setWebConfiguration(WebConfiguration configuration)
                         throws ManagerException
Sets web server configuration.

Parameters:
configuration - a new web server configuration
Throws:
ManagerException - if an error occurs

getEmailServiceConfiguration

public EmailServiceConfiguration getEmailServiceConfiguration()
                                                       throws ManagerException
Returns email service configuration.

Returns:
email service configuration
Throws:
ManagerException - if an error occurs

setEmailServiceConfiguration

public void setEmailServiceConfiguration(EmailServiceConfiguration configuration,
                                         java.util.Properties properties)
                                  throws ManagerException
Sets email service configuration.

Parameters:
configuration - new configuration
properties - email properties
Throws:
ManagerException - if an error occurs

getLicense

public com.jscape.inet.mft.management.licensing.License getLicense()
                                                            throws ManagerException
Gets an application license data.

Returns:
Returns a String with licence data
Throws:
ManagerException - if an error occurs

getCertificates

public CertificateMap getCertificates()
                               throws ManagerException
Gets known client certificates.

Returns:
known client certificates
Throws:
ManagerException - if an error occurs

getPublicKeys

public PublicKeyMap getPublicKeys()
                           throws ManagerException
Gets known client public keys.

Returns:
known client public keys
Throws:
ManagerException - if an error occurs

getPrivateKeys

public KeyPairMap getPrivateKeys()
                          throws ManagerException
Gets server keys.

Returns:
server keys
Throws:
ManagerException - if an error occurs

setKeys

public void setKeys(CertificateMap certificates,
                    PublicKeyMap publicKeys,
                    KeyPairMap serverKeys,
                    com.jscape.pgp.PgpKeystore pgpKeys)
             throws ManagerException
Sets security credentials.

Parameters:
certificates - known client certificates
publicKeys - known client public keys
serverKeys - server keys
pgpKeys - PGP keys
Throws:
ManagerException - if an error occurs

getAllDomains

public DomainDescriptor[] getAllDomains()
                                 throws ManagerException
Gets all available domains descriptors.

Returns:
an array of domain descriptors
Throws:
ManagerException - if an error occurs

addDomain

public void addDomain(DomainDescriptor descriptor)
               throws ManagerException
Adds a new domain.

Parameters:
descriptor - the domain descriptor
Throws:
ManagerException - if an error occurs

deleteDomain

public void deleteDomain(java.lang.String name)
                  throws ManagerException
Deletes a domain.

Parameters:
name - the domain name
Throws:
ManagerException - if an error occurs

setDomainDescription

public void setDomainDescription(java.lang.String domainName,
                                 java.lang.String description)
                          throws ManagerException
Sets new domain description.

Parameters:
domainName - target domain name
description - new domain description
Throws:
ManagerException - if an error occurs

setAuthenticationService

public void setAuthenticationService(java.lang.String domainName,
                                     AuthenticationServiceDescriptor serviceDescriptor)
                              throws ManagerException
Sets new domain authentication service. This method should be called on stopped domain.

Parameters:
domainName - target domain name
serviceDescriptor - service descriptor
Throws:
ManagerException - if an error occurs

testAuthenticationService

public void testAuthenticationService(ServiceDescriptor descriptor,
                                      java.lang.String login,
                                      java.lang.String password)
                               throws ManagerException
Tests authentication subsystem.

Parameters:
descriptor - subsystem descriptor
login - user login
password - user password
Throws:
ManagerException - if an error occurs

setDatastoreService

public void setDatastoreService(java.lang.String domainName,
                                DatastoreServiceDescriptor serviceDescriptor)
                         throws ManagerException
Sets new domain datastore service. This method must be called on stopped domain.

Parameters:
domainName - target domain name
serviceDescriptor - service descriptor
Throws:
ManagerException - if an error occurs

testDatastoreService

public void testDatastoreService(ServiceDescriptor descriptor)
                          throws ManagerException
Tests the datastore service.

Parameters:
descriptor - datastore service descriptor
Throws:
ManagerException - if an error occurs

setLogService

public void setLogService(java.lang.String domainName,
                          LogServiceDescriptor serviceDescriptor,
                          LogConfiguration configuration)
                   throws ManagerException
Sets new domain log service. This method must be called on stopped domain.

Parameters:
domainName - target domain name
serviceDescriptor - service descriptor
configuration - log service configuration
Throws:
ManagerException - if an error occurs

setPasswordService

public void setPasswordService(java.lang.String domainName,
                               PasswordServiceDescriptor serviceDescriptor)
                        throws ManagerException
Sets new domain password service. This method must be called on stopped domain.

Parameters:
domainName - target domain name
serviceDescriptor - service descriptor
Throws:
ManagerException - if an error occurs

testLogService

public void testLogService(ServiceDescriptor descriptor)
                    throws ManagerException
Tests log service subsystem.

Parameters:
descriptor - service descriptor
Throws:
ManagerException - if an error occurs

setTransportServices

public void setTransportServices(java.lang.String domainName,
                                 TransportServiceDescriptor[] serviceDescriptors,
                                 Configuration[] configurations)
                          throws ManagerException
Sets new domain transport services. This method must be called on stopped domain.

Parameters:
domainName - target domain name
serviceDescriptors - service descriptors
configurations - common services configurations, FtpConfiguration, SftpConfiguration, HttpConfiguration, WebDavConfiguration
Throws:
ManagerException - if an error occurs

setRestrictionServices

public void setRestrictionServices(java.lang.String domainName,
                                   ServiceDescriptor[] serviceDescriptors)
                            throws ManagerException
Sets new domain restriction services. This method must be called on stopped domain.

Parameters:
domainName - target domain name
serviceDescriptors - service descriptor
Throws:
ManagerException - if an error occurs

setEventService

public void setEventService(java.lang.String domainName,
                            ServiceDescriptor serviceDescriptor)
                     throws ManagerException
Sets new domain event service. This method must be called on stopped domain.

Parameters:
domainName - target domain name
serviceDescriptor - service descriptor
Throws:
ManagerException - if an error occurs

getStatistics

public com.jscape.inet.mft.common.Statistics getStatistics(java.lang.String name)
                                                    throws ManagerException
Gets a domain statistics.

Parameters:
name - the domain name
Returns:
a domain statistics instance
Throws:
ManagerException - if an error occurs

getLog

public java.lang.String getLog(java.lang.String name,
                               int recordsCount)
                        throws ManagerException
Gets the latest server log lines.

Parameters:
name - the domain name
recordsCount - desired records count
Returns:
a log lines from the server
Throws:
ManagerException - if an error occurs

getAccessRules

public IPAccessRule[] getAccessRules(java.lang.String name)
                              throws ManagerException
Gets a domain IP access rules.

Parameters:
name - the domain name
Returns:
the IP access rules array
Throws:
ManagerException - if an error occurs

setAccessRules

public void setAccessRules(java.lang.String domainName,
                           IPAccessRule[] rules)
                    throws ManagerException
Sets domain IP access rules. Since access rules may change while domain work, this method should be called on stopped domain.

Parameters:
domainName - the domain name
rules - access rules
Throws:
ManagerException - if an error occurs

findAccount

public Account findAccount(java.lang.String domainName,
                           java.lang.String login)
                    throws ManagerException
Finds the specified account.

Parameters:
domainName - the domain name
login - user login
Returns:
an account instance or null if account is not found
Throws:
ManagerException - if an error occurs

getAccounts

public Account[] getAccounts(java.lang.String domainName)
                      throws ManagerException
Gets domain accounts.

Parameters:
domainName - the domain name.
Returns:
accounts array
Throws:
ManagerException - if an error occurs

addAccount

public void addAccount(java.lang.String domainName,
                       Account account)
                throws ManagerException
Adds a new account to the domain. Throws an exception if account already exists.

Parameters:
domainName - the domain name
account - the new account
Throws:
ManagerException - if an error occurs

setAccount

public void setAccount(java.lang.String domainName,
                       Account account)
                throws ManagerException
Adds a new account to the domain. Throws an exception if account already exists.

Parameters:
domainName - the domain name
account - the new account
Throws:
ManagerException - if an error occurs

deleteAccount

public void deleteAccount(java.lang.String domaiName,
                          java.lang.String accountName)
                   throws ManagerException
Deletes domain account.

Parameters:
domaiName - the domain name
accountName - account name
Throws:
ManagerException - if an error occurs

getGroups

public Group[] getGroups(java.lang.String domainName)
                  throws ManagerException
Gets domain groups.

Parameters:
domainName - the domain name
Returns:
groups array
Throws:
ManagerException - if an error occurs

addGroup

public void addGroup(java.lang.String domainName,
                     Group group)
              throws ManagerException
Adds a new group.

Parameters:
domainName - the domain name
group - the new group
Throws:
ManagerException - if an error occurs

deleteGroup

public void deleteGroup(java.lang.String domainName,
                        java.lang.String groupName)
                 throws ManagerException
Deletes a group.

Parameters:
domainName - the domain name
groupName - the group name
Throws:
ManagerException - if an error occurs

setAccountTemplate

public void setAccountTemplate(java.lang.String domainName,
                               com.jscape.inet.vfs.AccountTemplate template)
                        throws ManagerException
Saves account template to the server.

Parameters:
domainName - the domain name
template - the template
Throws:
ManagerException - if an error occurs

deleteAccountTemplate

public void deleteAccountTemplate(java.lang.String domainName,
                                  java.lang.String templateName)
                           throws ManagerException
Deletes the specified template from the server.

Parameters:
domainName - the domain name
templateName - the template name
Throws:
ManagerException - if an error occurs

kickUser

public void kickUser(java.lang.String domainName,
                     java.lang.String accountName,
                     boolean disableAccount)
              throws ManagerException
Closes user sessions.

Parameters:
domainName - the domain name
accountName - the account name
disableAccount - if true account will be disabled
Throws:
ManagerException - if an error occurs

getReports

public Report[] getReports(java.lang.String domainName)
                    throws ManagerException
Returns all domain reports.

Parameters:
domainName - the domain name
Returns:
available domain reports
Throws:
ManagerException - if an error occurs

addReport

public void addReport(java.lang.String domainName,
                      Report report)
               throws ManagerException
Adds a new report to the domain.

Parameters:
domainName - the domain name
report - a new report instance
Throws:
ManagerException - if an error occurs

deleteReport

public void deleteReport(java.lang.String domainName,
                         java.lang.String reportName)
                  throws ManagerException
Deletes a report.

Parameters:
domainName - the domain name
reportName - the report name
Throws:
ManagerException - if an error occurs

addResource

public void addResource(java.lang.String domainName,
                        ResourceDescriptor resource)
                 throws ManagerException
Adds a new remote resource.

Parameters:
domainName - the domain name
resource - a new remote resource descriptor
Throws:
ManagerException - if an error occurs

deleteResource

public void deleteResource(java.lang.String domainName,
                           java.lang.String resourceName)
                    throws ManagerException
Deletes a resource.

Parameters:
domainName - the domain name
resourceName - the resource name
Throws:
ManagerException - if an error occurs

testResource

public void testResource(ResourceDescriptor resource)
                  throws ManagerException
Tests remote resurce accessibility.

Parameters:
resource - the resource to test
Throws:
ManagerException - if an error occurs

addDirectoryMonitor

public void addDirectoryMonitor(java.lang.String domainName,
                                DirectoryMonitor monitor)
                         throws ManagerException
Adds a new directory monitor.

Parameters:
domainName - domain name
monitor - directory monitor instance
Throws:
ManagerException - if an error occurs

deleteDirectoryMonitor

public void deleteDirectoryMonitor(java.lang.String domainName,
                                   java.lang.String monitorName)
                            throws ManagerException
Removes directory monitor.

Parameters:
domainName - domain name
monitorName - monitor name
Throws:
ManagerException - if an error occurs

getDirectoryMonitors

public DirectoryMonitor[] getDirectoryMonitors(java.lang.String domainName)
                                        throws ManagerException
Returns directory monitors for the specifed domain.

Parameters:
domainName - domain name
Returns:
directory monitors
Throws:
ManagerException - if an error occurs

startAllDomains

public void startAllDomains()
                     throws ManagerException
Starts all domains.

Throws:
ManagerException - if an error occurs

startDomain

public void startDomain(java.lang.String name)
                 throws ManagerException
Starts a specified domain.

Parameters:
name - the domain name
Throws:
ManagerException - if an error occurs

stopAllDomains

public void stopAllDomains()
                    throws ManagerException
Stops all domains.

Throws:
ManagerException - if an error occurs

stopDomain

public void stopDomain(java.lang.String name)
                throws ManagerException
Stops a specified domain.

Parameters:
name - the domain name
Throws:
ManagerException - if an error occurs

executeRequest

public void executeRequest(com.jscape.inet.mft.management.requests.ManagerRequest request)
                    throws ManagerException
Executes all the request operations in ManagerSubsystem API

Parameters:
request - Instance of ManagerRequest that is going to be executed
Throws:
ManagerException - if an error occurs

getContext

public com.jscape.util.event.CommonEventContext getContext()
Gets the context instance.

Returns:
The context instance.


Copyright © 2007 JSCAPE Corp. All Rights Reserved.