com.openexchange.admin.rmi
Interface OXContextInterface

All Superinterfaces:
Remote

public interface OXContextInterface
extends Remote

This class defines the Open-Xchange API Version 2 for creating and manipulating OX Contexts.

To create a new context, you must first register a database,server and filestore to the system!
For details about registering a filestore,server or databases have a look in the OXUtilInterface.

Example:

 final OXContextInterface iface = (OXContextInterface)Naming.lookup("rmi:///oxhost/"+OXContextInterface.RMI_NAME);
 
 final Context ctx = new Context(1337);
 
 User usr = new User();
 usr.setDisplay_name("admin display name");
 usr.setName("admin");
 usr.setPassword("secret");  
 usr.setMailenabled(true);       
 usr.setPrimaryEmail("admin@example.org");
 usr.setEmail1("admin@example.org");
 usr.setGiven_name("my");
 usr.setSur_name("admin");
 
 
 final Credentials auth = new Credentials();
 auth.setLogin("admin");
 auth.setPassword("secret");
 
 iface.create(ctx,usr,access,auth);
  
 

Author:
Manuel Kraft, Carsten Hoeger, Dennis Sieben

Field Summary
static String RMI_NAME
          RMI name to be used in the naming lookup.
 
Method Summary
 void change(Context ctx, Credentials auth)
          Change specified context! This method currently modifies following data: Login mappings - You can then login via usernam@loginmapping instead of username@contextID Context name in configdb - This is for better organization of contexts in your whole system.
 void changeModuleAccess(Context ctx, String access_combination_name, Credentials auth)
          Change module access rights by "access combination name" for ALL users in the specified context.
IF you want to change data of a context like quota etc.
use Method change(Context ctx, Credentials auth) This method modifies ONLY the access rights of the context!
 void changeModuleAccess(Context ctx, UserModuleAccess access, Credentials auth)
          Change module access rights for ALL users in the specified context.
IF you want to change data of a context like quota etc.
use Method change(final Context ctx, final Credentials auth) This method modifies ONLY the access rights of the context!
 boolean checkExists(Context ctx, Credentials auth)
          Deprecated.  
 Context create(Context ctx, User admin_user, Credentials auth)
          Create a new context.
 Context create(Context ctx, User admin_user, String access_combination_name, Credentials auth)
          Create a new context! Given access combination name will be used for admin module access rights!
 Context create(Context ctx, User admin_user, UserModuleAccess access, Credentials auth)
          Create a new context! Given access rights be used for admin!
 void delete(Context ctx, Credentials auth)
          Delete a context.
Note: Deleting a context will delete all data which the context include (all users, groups, appointments, ...
 void disable(Context ctx, Credentials auth)
          Disable given context.
 void disableAll(Credentials auth)
          Disable all contexts.
 void downgrade(Context ctx, Credentials auth)
          If context was changed, call this method to flush data which is no longer needed due to access permission changes!
 void enable(Context ctx, Credentials auth)
          Enable given context.
 void enableAll(Credentials auth)
          Enable all contexts.
 boolean exists(Context ctx, Credentials auth)
          Determines whether a context already exists.
 String getAccessCombinationName(Context ctx, Credentials auth)
          Get current access combination name of the context based on the rights of the admin user!
 int getAdminId(Context ctx, Credentials auth)
          Determines the user ID of the admin user for a given context
 Context[] getData(Context[] ctx, Credentials auth)
          Get specified context details
 Context getData(Context ctx, Credentials auth)
          Get specified context details
 UserModuleAccess getModuleAccess(Context ctx, Credentials auth)
          Get current module access rights of the context based on the rights of the admin user!
 Context[] list(String search_pattern, Credentials auth)
          Search for contexts
Returns all contexts matching the provided search_pattern.
 Context[] listAll(Credentials auth)
          Convenience method for listing all contexts Use this for search a context or list all contexts.
 Context[] listByDatabase(Database db, Credentials auth)
          Search for context on specified db.
 Context[] listByFilestore(Filestore fs, Credentials auth)
          Search for context which store data on specified filestore
 int moveContextDatabase(Context ctx, Database dst_database_id, Credentials auth)
          Move all data of a context contained in a database to another database
 int moveContextFilestore(Context ctx, Filestore dst_filestore_id, Credentials auth)
          Move all data of a context contained on the filestore to another filestore
 

Field Detail

RMI_NAME

static final String RMI_NAME
RMI name to be used in the naming lookup.

See Also:
Constant Field Values
Method Detail

create

Context create(Context ctx,
               User admin_user,
               Credentials auth)
               throws RemoteException,
                      StorageException,
                      InvalidCredentialsException,
                      InvalidDataException,
                      ContextExistsException
Create a new context.

Parameters:
ctx - Context object
admin_user - User data of administrative user account for this context
auth - Credentials for authenticating against server.
Returns:
Context object.
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
ContextExistsException

create

Context create(Context ctx,
               User admin_user,
               String access_combination_name,
               Credentials auth)
               throws RemoteException,
                      StorageException,
                      InvalidCredentialsException,
                      InvalidDataException,
                      ContextExistsException
Create a new context! Given access combination name will be used for admin module access rights!

Parameters:
ctx - Context object
admin_user - User data of administrative user account for this context
access_combination_name - String Access combination name!
auth - Credentials for authenticating against server.
Returns:
Context object.
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
ContextExistsException

create

Context create(Context ctx,
               User admin_user,
               UserModuleAccess access,
               Credentials auth)
               throws RemoteException,
                      StorageException,
                      InvalidCredentialsException,
                      InvalidDataException,
                      ContextExistsException
Create a new context! Given access rights be used for admin!

Parameters:
ctx - Context object
admin_user - User data of administrative user account for this context
access - UserModuleAccess Access rights!
auth - Credentials for authenticating against server.
Returns:
Context object.
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
ContextExistsException

delete

void delete(Context ctx,
            Credentials auth)
            throws RemoteException,
                   InvalidCredentialsException,
                   NoSuchContextException,
                   StorageException,
                   DatabaseUpdateException,
                   InvalidDataException
Delete a context.
Note: Deleting a context will delete all data which the context include (all users, groups, appointments, ... )

Parameters:
auth - Credentials for authenticating against server.
ctx - Context object
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
DatabaseUpdateException
InvalidDataException

downgrade

void downgrade(Context ctx,
               Credentials auth)
               throws RemoteException,
                      InvalidCredentialsException,
                      NoSuchContextException,
                      StorageException,
                      DatabaseUpdateException,
                      InvalidDataException
If context was changed, call this method to flush data which is no longer needed due to access permission changes!

Parameters:
ctx - Context object
auth - Credentials for authenticating against server.
Throws:
RemoteException - General RMI Exception
InvalidCredentialsException
NoSuchContextException
StorageException - When an error in the subsystems occurred.
DatabaseUpdateException
InvalidDataException

moveContextFilestore

int moveContextFilestore(Context ctx,
                         Filestore dst_filestore_id,
                         Credentials auth)
                         throws RemoteException,
                                InvalidCredentialsException,
                                NoSuchContextException,
                                StorageException,
                                InvalidDataException,
                                NoSuchFilestoreException,
                                NoSuchReasonException,
                                OXContextException
Move all data of a context contained on the filestore to another filestore

This method returns immediately and the data is going to be copied in the background. To query the progress and the result of the actual task, the AdminJobExecutor interface must be used.

Parameters:
ctx - Context object
dst_filestore_id - Id of the Filestore to move the context in.
auth - Credentials for authenticating against server.
Returns:
Job id which can be used for retrieving progress information.
Throws:
InvalidCredentialsException - Credentials for authenticating against server.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occured.
NoSuchFilestoreException
NoSuchReasonException
OXContextException

moveContextDatabase

int moveContextDatabase(Context ctx,
                        Database dst_database_id,
                        Credentials auth)
                        throws RemoteException,
                               InvalidCredentialsException,
                               NoSuchContextException,
                               StorageException,
                               InvalidDataException,
                               DatabaseUpdateException,
                               OXContextException
Move all data of a context contained in a database to another database

Parameters:
ctx - Context object
dst_database_id - ID of a registered Database to move all data of this context in.
auth - Credentials for authenticating against server.
Returns:
String containing return queue id to query status of job.

This method returns immediately and the data is going to be copied in the background. To query the progress and the result of the actual task, the AdminJobExecutor interface must be used.

Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occured.
DatabaseUpdateException
OXContextException

disable

void disable(Context ctx,
             Credentials auth)
             throws RemoteException,
                    InvalidCredentialsException,
                    NoSuchContextException,
                    StorageException,
                    InvalidDataException,
                    NoSuchReasonException,
                    OXContextException
Disable given context.

Parameters:
ctx - Context object.
auth - Credentials for authenticating against server.
Throws:
InvalidCredentialsException - Credentials for authenticating against server.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
NoSuchReasonException
OXContextException

enable

void enable(Context ctx,
            Credentials auth)
            throws RemoteException,
                   InvalidCredentialsException,
                   NoSuchContextException,
                   StorageException,
                   InvalidDataException
Enable given context.

Parameters:
auth - Credentials for authenticating against server.
ctx - Context object.
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
InvalidDataException

list

Context[] list(String search_pattern,
               Credentials auth)
               throws RemoteException,
                      StorageException,
                      InvalidCredentialsException,
                      InvalidDataException
Search for contexts
Returns all contexts matching the provided search_pattern. The search pattern is directly transformed into a SQL LIKE string comparison, where
a * is transformed into a %
a % and a _ must be escaped by a \ (e.g. if you want to search for _doe, use the pattern \_doe

Parameters:
auth - Credentials for authenticating against server.
search_pattern - Search pattern e.g "*mycontext*".
Returns:
Contexts.
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.

listAll

Context[] listAll(Credentials auth)
                  throws RemoteException,
                         StorageException,
                         InvalidCredentialsException,
                         InvalidDataException
Convenience method for listing all contexts Use this for search a context or list all contexts.

Parameters:
auth - Credentials for authenticating against server.
Returns:
Contexts.
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.

disableAll

void disableAll(Credentials auth)
                throws RemoteException,
                       StorageException,
                       InvalidCredentialsException,
                       InvalidDataException,
                       NoSuchReasonException
Disable all contexts.

Parameters:
auth - Credentials for authenticating against server.
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
NoSuchReasonException

enableAll

void enableAll(Credentials auth)
               throws RemoteException,
                      StorageException,
                      InvalidCredentialsException
Enable all contexts.

Parameters:
auth - Credentials for authenticating against server.
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.

getData

Context[] getData(Context[] ctx,
                  Credentials auth)
                  throws RemoteException,
                         InvalidCredentialsException,
                         NoSuchContextException,
                         StorageException,
                         InvalidDataException
Get specified context details

Parameters:
ctx -
auth -
Returns:
Throws:
RemoteException
InvalidCredentialsException
NoSuchContextException
StorageException
InvalidDataException

getData

Context getData(Context ctx,
                Credentials auth)
                throws RemoteException,
                       InvalidCredentialsException,
                       NoSuchContextException,
                       StorageException,
                       InvalidDataException
Get specified context details

Parameters:
ctx - With context ID set.
auth - Credentials for authenticating against server.
Returns:
Data for the requested context.
Throws:
RemoteException
InvalidCredentialsException
NoSuchContextException
StorageException
InvalidDataException

change

void change(Context ctx,
            Credentials auth)
            throws RemoteException,
                   InvalidCredentialsException,
                   NoSuchContextException,
                   StorageException,
                   InvalidDataException
Change specified context! This method currently modifies following data: Login mappings - You can then login via usernam@loginmapping instead of username@contextID Context name in configdb - This is for better organization of contexts in your whole system. Change filestore quota size - Change how much quota the context is allowed to use! Change storage data informations - Change filestore infos for context. Normally NO need to change!

Parameters:
ctx -
auth -
Throws:
RemoteException
InvalidCredentialsException
NoSuchContextException
StorageException
InvalidDataException

changeModuleAccess

void changeModuleAccess(Context ctx,
                        UserModuleAccess access,
                        Credentials auth)
                        throws RemoteException,
                               InvalidCredentialsException,
                               NoSuchContextException,
                               StorageException,
                               InvalidDataException
Change module access rights for ALL users in the specified context.
IF you want to change data of a context like quota etc.
use Method change(final Context ctx, final Credentials auth) This method modifies ONLY the access rights of the context!

Parameters:
ctx -
access -
auth -
Throws:
RemoteException
InvalidCredentialsException
NoSuchContextException
StorageException
InvalidDataException

changeModuleAccess

void changeModuleAccess(Context ctx,
                        String access_combination_name,
                        Credentials auth)
                        throws RemoteException,
                               InvalidCredentialsException,
                               NoSuchContextException,
                               StorageException,
                               InvalidDataException
Change module access rights by "access combination name" for ALL users in the specified context.
IF you want to change data of a context like quota etc.
use Method change(Context ctx, Credentials auth) This method modifies ONLY the access rights of the context!

Parameters:
ctx -
access -
auth -
Throws:
RemoteException
InvalidCredentialsException
NoSuchContextException
StorageException
InvalidDataException

getModuleAccess

UserModuleAccess getModuleAccess(Context ctx,
                                 Credentials auth)
                                 throws RemoteException,
                                        InvalidCredentialsException,
                                        NoSuchContextException,
                                        StorageException,
                                        InvalidDataException
Get current module access rights of the context based on the rights of the admin user!

Parameters:
ctx -
auth -
Returns:
Current module access rights!
Throws:
RemoteException
InvalidCredentialsException
NoSuchContextException
StorageException
InvalidDataException

getAccessCombinationName

String getAccessCombinationName(Context ctx,
                                Credentials auth)
                                throws RemoteException,
                                       InvalidCredentialsException,
                                       NoSuchContextException,
                                       StorageException,
                                       InvalidDataException
Get current access combination name of the context based on the rights of the admin user!

Parameters:
ctx -
auth -
Returns:
Access combination name or null if current access rights cannot be mapped to an access combination name.
Throws:
RemoteException
InvalidCredentialsException
NoSuchContextException
StorageException
InvalidDataException

listByDatabase

Context[] listByDatabase(Database db,
                         Credentials auth)
                         throws RemoteException,
                                StorageException,
                                InvalidCredentialsException,
                                InvalidDataException,
                                NoSuchDatabaseException
Search for context on specified db.

Parameters:
db - Database on which to search for contexts.
auth - Credentials for authenticating against server.
Returns:
Found contexts on the specified database.
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
NoSuchDatabaseException

listByFilestore

Context[] listByFilestore(Filestore fs,
                          Credentials auth)
                          throws RemoteException,
                                 StorageException,
                                 InvalidCredentialsException,
                                 InvalidDataException,
                                 NoSuchFilestoreException
Search for context which store data on specified filestore

Parameters:
fs - Filestore
auth - Credentials for authenticating against server.
Returns:
Contexts found on this filestore.
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
NoSuchFilestoreException

getAdminId

int getAdminId(Context ctx,
               Credentials auth)
               throws RemoteException,
                      InvalidCredentialsException,
                      StorageException,
                      NoSuchContextException
Determines the user ID of the admin user for a given context

Parameters:
ctx - The context for which the userId of the admin should be determined.
auth - Credentials for authenticating against the server.
Returns:
The userId of the admin user
Throws:
RemoteException - General RMI Exception
InvalidCredentialsException - Thrown when the login fails
StorageException - Thrown when an error in a subsystem occurred.
NoSuchContextException

exists

boolean exists(Context ctx,
               Credentials auth)
               throws RemoteException,
                      InvalidDataException,
                      StorageException,
                      InvalidCredentialsException
Determines whether a context already exists.

Parameters:
ctx - The context we're interested in
auth - Credentials for authenticating against the server.
Returns:
Whether the given context exists or not
Throws:
RemoteException
InvalidDataException
StorageException
InvalidCredentialsException

checkExists

boolean checkExists(Context ctx,
                    Credentials auth)
                    throws RemoteException,
                           InvalidDataException,
                           StorageException,
                           InvalidCredentialsException
Deprecated. 

Determines whether a context already exists.

Parameters:
ctx - The context we're interested in
auth - Credentials for authenticating against the server.
Returns:
Whether the given context exists or not
Throws:
RemoteException
InvalidDataException
StorageException
InvalidCredentialsException