GigaSpaces XAP 7.0 API

com.j_spaces.core.admin
Interface IRemoteJSpaceAdmin

All Superinterfaces:
Remote

public interface IRemoteJSpaceAdmin
extends Remote

This interface contains all the administrative methods that GigaSpaces provides to control the JavaSpaces service.


 Usage:
        IJSpace space = (IJSpace) SpaceFinder.find(spaceUrl);
        IRemoteJSpaceAdmin spaceAdmin = (IRemoteJSpaceAdmin)space.getAdmin();

 The code examples on each method assumes the above usage.
 

Author:
Igor Goldenberg.

Field Summary
static int REPLICATION_STATUS_ACTIVE
          The replication is active.
static int REPLICATION_STATUS_DISABLED
          The replication is disabled.
static int REPLICATION_STATUS_DISCONNECTED
          The replication is disconnected.
 
Method Summary
 void changeReplicationState(String targetMemberName, boolean disableReplication)
          Temporarily disable/re-enable replication to remote.
 void dropClass(String className, SpaceContext sc)
          Drop all Class entries and all its templates from the space.
 BasicTypeInfo getClassTypeInfo(String className)
          Get the basic class information from the space directory.
 ClusterPolicy getClusterPolicy()
          Return the present ClusterPolicy objects.
 SpaceConfig getConfig()
          Returns SpaceConfig of this space.
 String getName()
          Returns the Space Name.
 Object[] getReplicationStatus()
          returns the replication member-status relation of all the replication groups.
 SpaceRuntimeInfo getRuntimeInfo()
          Returns SpaceRuntimeInfo.
 SpaceRuntimeInfo getRuntimeInfo(String className)
          Returns SpaceRuntimeInfo for specific class name and its subclasses.
 int getState()
          Returns the particular condition of this space.
 void ping()
          Ping to space to see if alive.
 void restart()
          Restarts the space.
 void setConfig(JSpaceAttributes config)
          Set new configuration for this space.
 SpaceCopyStatus spaceCopy(IJSpace remoteSpace, Object template, boolean includeNotifyTemplates, int chunkSize)
           
 SpaceCopyStatus spaceCopy(String remoteUrl, Object template, boolean includeNotifyTemplates, int chunkSize)
          Given Url of a remote space, Copy all entries/notify templates from the space.
 void start()
          Attempt to start this space.
 void stop()
          Attempt to stop this space.
 

Field Detail

REPLICATION_STATUS_ACTIVE

static final int REPLICATION_STATUS_ACTIVE
The replication is active. @see getReplicationStatus()

See Also:
Constant Field Values

REPLICATION_STATUS_DISCONNECTED

static final int REPLICATION_STATUS_DISCONNECTED
The replication is disconnected. @see #getReplicationStatus()

See Also:
Constant Field Values

REPLICATION_STATUS_DISABLED

static final int REPLICATION_STATUS_DISABLED
The replication is disabled. @see #getReplicationStatus()

See Also:
Constant Field Values
Method Detail

restart

void restart()
             throws RemoteException
Restarts the space.

 Usage:
   try
   {
        spaceAdmin.restart();
   }
   catch( java.rmi.RemoteException ex )
   {
        System.err.println("Failed to restart space: " + ((IJSpace)space).getName());
        System.err.println("Exception: " + ex);
   }
 

Throws:
RemoteException - Failed to restart space.

getName

String getName()
               throws RemoteException
Returns the Space Name.

 Usage:
        spaceAdmin.getName()
 

Returns:
the space's name
Throws:
RemoteException - Failed to get name

getRuntimeInfo

SpaceRuntimeInfo getRuntimeInfo()
                                throws RemoteException
Returns SpaceRuntimeInfo.

 Usage:
   SpaceRuntimeInfo runtime = spaceAdmin.getRuntimeInfo();
   List classNames = runtime.m_ClassNames;
   List numOfEntries = runtime.m_NumOFEntries;
 

Returns:
SpaceRuntimeInfo which holds the classes and the number of entries currently in the space.
Throws:
RemoteException - if a communication error occurs

getRuntimeInfo

SpaceRuntimeInfo getRuntimeInfo(String className)
                                throws RemoteException
Returns SpaceRuntimeInfo for specific class name and its subclasses.

 Usage:
         String className = ExampleObject.class.getName();
   SpaceRuntimeInfo runtime = spaceAdmin.getRuntimeInfo(className);
   List classNames = runtime.m_ClassNames;
   List numOfEntries = runtime.m_NumOFEntries;
 

Returns:
SpaceRuntimeInfo which holds the classes and the number of entries of given class and its subclasses currently in space.
Throws:
RemoteException - if a communication error occurs

getConfig

SpaceConfig getConfig()
                      throws RemoteException
Returns SpaceConfig of this space.

 Usage:
        SpaceConfig config = spaceAdmin.getConfig();
        if (config != null)
                boolean isClustered = config.m_isClustered;
 

Returns:
SpaceConfig - Contains all information about the space configuration.
Throws:
RemoteException - if a communication error occurs

setConfig

void setConfig(JSpaceAttributes config)
               throws RemoteException
Set new configuration for this space.

 Usage:
   String replicaClusterConfigFileName = configDirectory
                                                                        + File.separatorChar
                                                                        + replicaSpace
                                                                        + "-cluster-config.xml";

   JSpaceAttributes spaceAttr = spaceAdmin.getConfig();
   spaceAttr.m_isClustered = true;
   spaceAttr.m_clusterConfigURL = replicaClusterConfigFileName;
   if (spaceAttr.m_storageAdapterURL == null)
        spaceAttr.m_storageAdapterClass = null;

   spaceAdmin.setConfig(spaceAttr);
 

Parameters:
config - - new configuration attributes to be used.
Throws:
RemoteException - if a communication error occurs

ping

void ping()
          throws RemoteException
Ping to space to see if alive. If successful, this does not indicate that the space is in a running state.
Usage:
 try
 {
     spaceAdmin.ping();
 }
 catch (RemoteException re)
 {
     System.err.println("Space not accessible");
 }

Throws:
RemoteException - if a communication error occurs
See Also:
getState()

changeReplicationState

void changeReplicationState(String targetMemberName,
                            boolean disableReplication)
                            throws RemoteException
Temporarily disable/re-enable replication to remote. The target member has to be part of a clustered space and a member of a replication group.

 Usage:
   String memberName = container.getName() + ":" + space.getName();
   spaceAdmin.changeReplicationState( memberName, false );
 

Parameters:
targetMemberName - target replication cluster member to change replication to, "*" means all members
disableReplication - true=disable , false=enable
Throws:
RemoteException - if a communication error occurs

spaceCopy

SpaceCopyStatus spaceCopy(String remoteUrl,
                          Object template,
                          boolean includeNotifyTemplates,
                          int chunkSize)
                          throws RemoteException
Given Url of a remote space, Copy all entries/notify templates from the space.

 Usage:
   SpaceCopyStatus copyStatus = spaceAdmin.spaceCopy( sourceSpaceURL, template, false );
   System.out.println("Copy-Status: " + copyStatus );
 

Parameters:
remoteUrl - url of remote space to copy from
template - Entry template or null.
includeNotifyTemplates - - if true ALL notify templates will be copied too
chunkSize - Chunk size (batch) for this copy operation.
Returns:
SpaceCopyStatus Contains the status information of spaceCopy operation.
Throws:
RemoteException - if a communication error occurs

spaceCopy

SpaceCopyStatus spaceCopy(IJSpace remoteSpace,
                          Object template,
                          boolean includeNotifyTemplates,
                          int chunkSize)
                          throws RemoteException
Throws:
RemoteException

getReplicationStatus

Object[] getReplicationStatus()
                              throws RemoteException
returns the replication member-status relation of all the replication groups.

 Usage:
   Object[] replStatus = spaceAdmin.getReplicationStatus();
   String[] peers = (String[])replStatus[0];
   int[] status = (int[])replStatus[1];
 

Returns:
an array of remote member names array and replication status array. Replication status can have one of the following values: IRemoteJSpaceAdmin.REPLICATION_STATUS_ACTIVE IRemoteJSpaceAdmin.REPLICATION_STATUS_DISCONNECTED IRemoteJSpaceAdmin.REPLICATION_STATUS_DISABLED
Throws:
RemoteException - if a communication error occurs

getClassTypeInfo

BasicTypeInfo getClassTypeInfo(String className)
                               throws RemoteException
Get the basic class information from the space directory.

 Usage:
   com.j_spaces.core.client.BasicTypeInfo classInfo
        = spaceAdmin.getClassTypeInfo( className );
 
   String[] fieldNames = classInfo.m_FieldsNames;
   String[] fieldTypes = classInfo.m_FieldsTypes;
 

Parameters:
className - - The name of the class to retrieve the information from.
Returns:
BasicTypeInfo - Which provides class information.
Throws:
RemoteException - if a communication error occurs

getClusterPolicy

ClusterPolicy getClusterPolicy()
                               throws RemoteException
Return the present ClusterPolicy objects.

Returns:
a ClusterPolicy that represents current cluster
Throws:
RemoteException - if a communication error occurs

dropClass

void dropClass(String className,
               SpaceContext sc)
               throws RemoteException,
                      DropClassException
Drop all Class entries and all its templates from the space. Calling this method will remove all internal meta data related to this class stored in the space. When using persistent spaced the relevant RDBMS table will be dropped. It is the caller responsibility to ensure that no entries from this class are written to the space while this method is called. This method is protected through the space Default Security Filter. Admin permissions required to execute this request successfully.

 Usage:
        spaceAdmin.dropClass( className );
 

Parameters:
className - name of class to delete.
Throws:
DropClassException - Failed to drop desired class.
RemoteException - if a communication error occurs

start

void start()
           throws RemoteException,
                  SpaceAlreadyStartedException
Attempt to start this space.

 Usage:
  spaceAdmin.start();
 

Throws:
RemoteException - - Failed to start space.
SpaceAlreadyStartedException - - The space is already started

stop

void stop()
          throws RemoteException,
                 SpaceAlreadyStoppedException
Attempt to stop this space.

 Usage:
  spaceAdmin.stop();
 

Throws:
RemoteException - - Failed to stop space.
SpaceAlreadyStoppedException - - The space is already stopped

getState

int getState()
             throws RemoteException
Returns the particular condition of this space.

Returns:
state - ISpaceState.STOPPED, ISpaceState.STARTED and etc.
Throws:
RemoteException - if a communication error occurs
See Also:
ISpaceState

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.