Remote Systems
v6.4.1

com.ibm.etools.systems.model.impl
Class SystemConnectionPoolImpl

java.lang.Object
  extended byEObjectImpl
      extended bycom.ibm.etools.systems.model.impl.SystemConnectionPoolImpl
All Implemented Interfaces:
SystemConnectionPool

public class SystemConnectionPoolImpl
extends EObjectImpl
implements SystemConnectionPool

A pool of connection objects. There is one pool per profile.

See Also:
Serialized Form

Field Summary
static String copyright
           
protected  String name
           
protected static String NAME_EDEFAULT
          The default value of the 'Name' attribute
 
Constructor Summary
protected SystemConnectionPoolImpl()
          Default constructor.
 
Method Summary
 boolean addConnection(SystemConnection conn)
          Adds given connection to the list.
 SystemConnection cloneConnection(SystemConnectionPool targetPool, SystemConnection conn, String aliasName)
          Duplicates a given connection in this list within this list or another list.
 SystemConnection createConnection(String systemType, String aliasName, String hostName)
          Create a connection object, given only the minimal information.
 SystemConnection createConnection(String systemType, String aliasName, String hostName, String description)
          Create a connection object, given all the possible attributes except default userId.
 SystemConnection createConnection(String systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation)
          Create a connection object, given all the possible attributes.
 void deleteConnection(SystemConnection conn)
          Removes a given connection from the list and deletes it from disk.
 Object eGet(EStructuralFeature eFeature, boolean resolve)
           
 boolean eIsSet(EStructuralFeature eFeature)
           
 void eSet(EStructuralFeature eFeature, Object newValue)
           
protected  EClass eStaticClass()
           
 void eUnset(EStructuralFeature eFeature)
           
 SystemConnection getConnection(int pos)
          Return the connection at the given zero-based offset
 SystemConnection getConnection(String aliasName)
          Return a connection object, given its alias name.
 int getConnectionCount()
          Return the number of SystemConnection objects within this pool.
protected  IFolder getConnectionFolder(String connectionFolderName)
          Return the folder for a given connection folder name
protected  IFolder getConnectionFolder(SystemConnection connection)
          Return the folder for a given connection
 int getConnectionPosition(SystemConnection conn)
          Return the zero-based position of a SystemConnection object within its profile.
 EList getConnections()
           
protected static SystemMOFHelpers getMOFHelpers()
           
 String getName()
           
protected static String getRootSaveFileName(String connectionName)
          Return the root save file name without the extension .xmi
protected static String getRootSaveFileName(SystemConnection connection)
          Return the root save file name without the extension .xmi
protected static String getSaveFileName(SystemConnection connection)
          Return the unqualified save file name with the extension .xmi
static SystemConnectionPool getSystemConnectionPool(SystemProfile profile)
          Return (and create if necessary) the connection pool for a given system profile.
 SystemConnection[] getSystemConnections()
          Return array of connections in this pool
 SystemProfile getSystemProfile()
          Return the system profile that owns this connection pool
protected  void invalidateCache()
           
 void moveConnections(SystemConnection[] conns, int delta)
          Move existing connections a given number of positions in the same pool.
 void orderConnections(String[] names)
          Order connections according to user preferences.
 void printConnections()
          Private debug method to print connections, to test restored ok.
 void renameConnection(SystemConnection conn, String newName)
          Renames a given connection in the list.
 void renameConnectionPool(String newName)
          Rename this connection pool.
static void reset()
          Reset for a full refresh from disk, such as after a team synch
protected  void restore()
          Restore connections from disk
protected  SystemConnection restore(String connectionName)
          Restore a connection of a given name from disk...
 void save()
          Save all connections to disk.
 void save(SystemConnection connection)
          Attempt to save single connection to disk.
 void setName(String newName)
           
 String toString()
           
 String toStringGen()
           
 void updateConnection(SystemConnection conn, String systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation)
          Update an existing connection given the new information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_EDEFAULT

protected static final String NAME_EDEFAULT
The default value of the 'Name' attribute.

See Also:
getName()

copyright

public static final String copyright
See Also:
Constant Field Values

name

protected String name
Constructor Detail

SystemConnectionPoolImpl

protected SystemConnectionPoolImpl()
Default constructor. Typically called by MOF.

Method Detail

eStaticClass

protected EClass eStaticClass()


reset

public static void reset()
Reset for a full refresh from disk, such as after a team synch


getSystemConnectionPool

public static SystemConnectionPool getSystemConnectionPool(SystemProfile profile)
                                                    throws Exception
Return (and create if necessary) the connection pool for a given system profile.

Throws:
Exception

getSystemProfile

public SystemProfile getSystemProfile()
Return the system profile that owns this connection pool

Specified by:
getSystemProfile in interface SystemConnectionPool

renameConnectionPool

public void renameConnectionPool(String newName)
Rename this connection pool.

Specified by:
renameConnectionPool in interface SystemConnectionPool

printConnections

public void printConnections()
Private debug method to print connections, to test restored ok.


createConnection

public SystemConnection createConnection(String systemType,
                                         String aliasName,
                                         String hostName)
                                  throws Exception
Create a connection object, given only the minimal information.

THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU.

Specified by:
createConnection in interface SystemConnectionPool
Parameters:
systemType - system type matching one of the system type names defined via the systemtype extension point.
aliasName - unique connection name.
hostName - ip name of host.
Returns:
SystemConnection object, or null if it failed to create because the aliasName is not unique. All other errors throw an exception.
Throws:
Exception

createConnection

public SystemConnection createConnection(String systemType,
                                         String aliasName,
                                         String hostName,
                                         String description)
                                  throws Exception
Create a connection object, given all the possible attributes except default userId.

THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU.

Specified by:
createConnection in interface SystemConnectionPool
Parameters:
systemType - system type matching one of the system type names defined via the systemtype extension point.
aliasName - unique connection name.
hostName - ip name of host.
description - optional description of the connection. Can be null.
Returns:
SystemConnection object, or null if it failed to create because the aliasName is not unique. All other errors throw an exception.
Throws:
Exception

createConnection

public SystemConnection createConnection(String systemType,
                                         String aliasName,
                                         String hostName,
                                         String description,
                                         String defaultUserId,
                                         int defaultUserIdLocation)
                                  throws Exception
Create a connection object, given all the possible attributes.

The new connection is added to the list and saved to disk.

Specified by:
createConnection in interface SystemConnectionPool
Parameters:
systemType - system type matching one of the system type names defined via the systemtype extension point.
aliasName - unique connection name.
hostName - ip name of host.
description - optional description of the connection. Can be null.
defaultUserId - userId to use as the default for the subsystems.
defaultUserIdLocation - where to set the given default user Id. See ISystemUserIdConstants
Returns:
SystemConnection object, or null if it failed to create because the aliasName is not unique. All other errors throw an exception.
Throws:
Exception

updateConnection

public void updateConnection(SystemConnection conn,
                             String systemType,
                             String aliasName,
                             String hostName,
                             String description,
                             String defaultUserId,
                             int defaultUserIdLocation)
                      throws Exception
Update an existing connection given the new information. This method:

Specified by:
updateConnection in interface SystemConnectionPool
Parameters:
conn - SystemConnection to be updated
systemType - system type matching one of the system type names defined via the systemtype extension point.
aliasName - unique connection name.
hostName - ip name of host.
description - optional description of the connection. Can be null.
defaultUserId - userId to use as the default for the subsystems.
defaultUserIdLocation - where to set the given default user Id. See ISystemUserIdConstants
Throws:
Exception

getSystemConnections

public SystemConnection[] getSystemConnections()
Return array of connections in this pool

Specified by:
getSystemConnections in interface SystemConnectionPool

invalidateCache

protected void invalidateCache()

getConnection

public SystemConnection getConnection(String aliasName)
Return a connection object, given its alias name. Can be used to test if an alias name is already used (non-null return).

Specified by:
getConnection in interface SystemConnectionPool
Parameters:
aliasName - unique aliasName (case insensitive) to search on.
Returns:
SystemConnection object with unique aliasName, or null if no connection object with this name exists.

getConnection

public SystemConnection getConnection(int pos)
Return the connection at the given zero-based offset

Specified by:
getConnection in interface SystemConnectionPool

getConnectionPosition

public int getConnectionPosition(SystemConnection conn)
Return the zero-based position of a SystemConnection object within its profile.

Specified by:
getConnectionPosition in interface SystemConnectionPool

getConnectionCount

public int getConnectionCount()
Return the number of SystemConnection objects within this pool.

Specified by:
getConnectionCount in interface SystemConnectionPool

addConnection

public boolean addConnection(SystemConnection conn)
Adds given connection to the list.

PLEASE NOTE:

Specified by:
addConnection in interface SystemConnectionPool
Parameters:
conn - SystemConnection object to add
Returns:
true if added, false if connection with this aliasname already existed.

deleteConnection

public void deleteConnection(SystemConnection conn)
Removes a given connection from the list and deletes it from disk.

This will:

Specified by:
deleteConnection in interface SystemConnectionPool
Parameters:
conn - SystemConnection object to remove

renameConnection

public void renameConnection(SystemConnection conn,
                             String newName)
                      throws Exception
Renames a given connection in the list. This will:

Specified by:
renameConnection in interface SystemConnectionPool
Parameters:
conn - SystemConnection object to rename
newName - The new name to give that connection.
Throws:
Exception

cloneConnection

public SystemConnection cloneConnection(SystemConnectionPool targetPool,
                                        SystemConnection conn,
                                        String aliasName)
                                 throws Exception
Duplicates a given connection in this list within this list or another list.

Specified by:
cloneConnection in interface SystemConnectionPool
Parameters:
targetPool - The SystemConnectionPool to hold the copied connection. Can equal this connection, as long as alias name is unique
conn - SystemConnection object (within our pool) to clone
Throws:
Exception

moveConnections

public void moveConnections(SystemConnection[] conns,
                            int delta)
Move existing connections a given number of positions in the same pool. If the delta is negative, they are all moved up by the given amount. If positive, they are all moved down by the given amount.

TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?

Specified by:
moveConnections in interface SystemConnectionPool
Parameters:
conns - Array of SystemConnections to move.

orderConnections

public void orderConnections(String[] names)
Order connections according to user preferences. Called after restore.

Specified by:
orderConnections in interface SystemConnectionPool

save

public void save()
          throws Exception
Save all connections to disk. Attempts to save all of them, swallowing exceptions, then at the end throws the last exception caught.

Specified by:
save in interface SystemConnectionPool
Throws:
Exception

save

public void save(SystemConnection connection)
          throws Exception
Attempt to save single connection to disk.

Specified by:
save in interface SystemConnectionPool
Throws:
Exception

restore

protected void restore()
                throws Exception
Restore connections from disk

Throws:
Exception

restore

protected SystemConnection restore(String connectionName)
                            throws Exception
Restore a connection of a given name from disk...

Throws:
Exception

getConnectionFolder

protected IFolder getConnectionFolder(SystemConnection connection)
Return the folder for a given connection


getConnectionFolder

protected IFolder getConnectionFolder(String connectionFolderName)
Return the folder for a given connection folder name


getSaveFileName

protected static String getSaveFileName(SystemConnection connection)
Return the unqualified save file name with the extension .xmi


getRootSaveFileName

protected static String getRootSaveFileName(SystemConnection connection)
Return the root save file name without the extension .xmi


getRootSaveFileName

protected static String getRootSaveFileName(String connectionName)
Return the root save file name without the extension .xmi


getMOFHelpers

protected static SystemMOFHelpers getMOFHelpers()

toString

public String toString()

getName

public String getName()
Specified by:
getName in interface SystemConnectionPool
Returns:
The value of the Name attribute

setName

public void setName(String newName)
Specified by:
setName in interface SystemConnectionPool
Parameters:
newName - The new value of the Name attribute

getConnections

public EList getConnections()
Specified by:
getConnections in interface SystemConnectionPool
Returns:
The list of Connections references

eGet

public Object eGet(EStructuralFeature eFeature,
                   boolean resolve)


eIsSet

public boolean eIsSet(EStructuralFeature eFeature)

eSet

public void eSet(EStructuralFeature eFeature,
                 Object newValue)

eUnset

public void eUnset(EStructuralFeature eFeature)

toStringGen

public String toStringGen()

Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.