RSE
Release 3.4

org.eclipse.rse.core.subsystems
Class AbstractConnectorServiceManager

java.lang.Object
  extended by org.eclipse.rse.core.subsystems.AbstractConnectorServiceManager
All Implemented Interfaces:
IConnectorServiceManager
Direct Known Subclasses:
DStoreConnectorServiceManager

public abstract class AbstractConnectorServiceManager
extends Object
implements IConnectorServiceManager

This class is only needed if you need/want to support multiple subsystems and want them to share a single IConnectorService object per connection. This is the base connector service manager implementation that returns the same IConnectorService object for all subsystems in the same system connection, which implement a given interface.

For this to work all your subsystem classes that wish to share the same IConnectorService object must implement a common interface of your choosing.

Another benefit of using this class or a subclass of it, is that whenever the user changes the core properties for a single subsystem (port, userId) then this manager is used to cascade that to all other subsystems in this connection which share that same common interface. This means the user can change these properties in any one subsystem, and they are changed in all related subsystems magically. This is necessary because while these properties are persisted in the subsystem object, they really belong to the IConnectorService object, so when multiple subsystems share an IConnectorService object, changes to these properties in one subsystem need to be cascaded to the other subsystems.

Because you only need a singleton of these class, the constructor is protected.

Your subclass must supply a singleton factory method like the following:


 public static MyConnectorServiceManager getInstance()
  {
        if (inst == null)
          inst = new MyConnectorServiceManager();
        return inst;
  }
 


Constructor Summary
protected AbstractConnectorServiceManager()
          Protected constructor to ensure not instantiated this way.
 
Method Summary
abstract  IConnectorService createConnectorService(IHost host)
          Return the actual IConnectorService object.
protected  Hashtable findConnHTForDummyHost(IHost newHost)
           
 IConnectorService getConnectorService(IHost host, Class commonSSinterface)
           
abstract  Class getSubSystemCommonInterface(ISubSystem subsystem)
          For all subsystems in a particular SystemConnection, we need to know which ones are to share a single IConnectorService object.
 void setConnectorService(IHost host, Class commonSSinterface, IConnectorService connectorService)
           
abstract  boolean sharesSystem(ISubSystem otherSubSystem)
          Given another subsystem, return true if that subsystem shares a single IConnectorService object with this one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractConnectorServiceManager

protected AbstractConnectorServiceManager()
Protected constructor to ensure not instantiated this way. Use subclass-supplied static singleton factory method getInstance() instead.

Method Detail

setConnectorService

public void setConnectorService(IHost host,
                                Class commonSSinterface,
                                IConnectorService connectorService)
Specified by:
setConnectorService in interface IConnectorServiceManager

getConnectorService

public IConnectorService getConnectorService(IHost host,
                                             Class commonSSinterface)
Specified by:
getConnectorService in interface IConnectorServiceManager

findConnHTForDummyHost

protected Hashtable findConnHTForDummyHost(IHost newHost)

createConnectorService

public abstract IConnectorService createConnectorService(IHost host)
Return the actual IConnectorService object. Must be overridden by subclass.


sharesSystem

public abstract boolean sharesSystem(ISubSystem otherSubSystem)
Given another subsystem, return true if that subsystem shares a single IConnectorService object with this one. You must override this to return true if you recognize that subsystem as one of your own. You are guaranteed the other subsystem will be from the same SystemConnection as this one.

You can't assume a SystemConnection will only have subsystems that you created, so you should only return true if it implements your interface or you know it is an instance of your subsystem class.

This should simply return (otherSubSystem instanceof interface) where interface is the same one returned from getSubSystemCommonInterface.


getSubSystemCommonInterface

public abstract Class getSubSystemCommonInterface(ISubSystem subsystem)
For all subsystems in a particular SystemConnection, we need to know which ones are to share a single IConnectorService object. To do this, we need a key which is canonical for all subsystems in a given connection. This can be anything, but is typically a unique interface that all subsystems supported a shared IConnectorService object implement.

Whatever is returned from here is used as the key into a hashtable to find the singleton IConnectorService object in getSystemObject.

Parameters:
subsystem - - rarely used, but if you support multiple common interfaces then this will help you decide which one to return.
Returns:
a common, yet unique to you, interface that all your subsystems implement.

RSE
Release 3.4

Copyright (c) IBM Corporation and others 2000, 2012. All Rights Reserved.