org.rhq.enterprise.client
Class RemoteClient

java.lang.Object
  extended by org.rhq.enterprise.client.RemoteClient
All Implemented Interfaces:
RhqFacade

public class RemoteClient
extends Object
implements RhqFacade

A remote access client that provides transparent servlet-based proxies to an RHQ Server.

Author:
Greg Hinkle, Simeon Pinder, Jay Shaughnessy, John Mazzitelli

Field Summary
static String NONSECURE_TRANSPORT
           
static String SECURE_TRANSPORT
           
 
Constructor Summary
RemoteClient(String host, int port)
          Creates a client that will communicate with the server running on the given host listening on the given port.
RemoteClient(String transport, String host, int port)
          Creates a client that will communicate with the server running on the given host listening on the given port over the given transport.
RemoteClient(String transport, String host, int port, String subsystem)
           
 
Method Summary
 void connect()
          Connects to the remote server but does not establish a user session.
 void disconnect()
          Disconnect from the server.
 AlertDefinitionManagerRemote getAlertDefinitionManager()
           
 AlertManagerRemote getAlertManager()
           
 AvailabilityManagerRemote getAvailabilityManager()
           
 BundleManagerRemote getBundleManager()
           
 CallTimeDataManagerRemote getCallTimeDataManager()
           
 ConfigurationManagerRemote getConfigurationManager()
           
 ContentManagerRemote getContentManager()
           
 DataAccessManagerRemote getDataAccessManager()
           
 DiscoveryBossRemote getDiscoveryBoss()
           
 EventManagerRemote getEventManager()
           
 String getHost()
           
 Map<String,Object> getManagers()
          Returns the map of all remote managers running in the server that this client can talk to.
 MeasurementBaselineManagerRemote getMeasurementBaselineManager()
           
 MeasurementDataManagerRemote getMeasurementDataManager()
           
 MeasurementDefinitionManagerRemote getMeasurementDefinitionManager()
           
 MeasurementScheduleManagerRemote getMeasurementScheduleManager()
           
 OperationManagerRemote getOperationManager()
           
 int getPort()
           
 RemoteInstallManagerRemote getRemoteInstallManager()
           
 RepoManagerRemote getRepoManager()
           
 ResourceFactoryManagerRemote getResourceFactoryManager()
           
 ResourceGroupManagerRemote getResourceGroupManager()
           
 ResourceManagerRemote getResourceManager()
           
 ResourceTypeManagerRemote getResourceTypeManager()
           
 RoleManagerRemote getRoleManager()
           
 SavedSearchManagerRemote getSavedSearchManager()
           
 Subject getSubject()
          Returns the information on the user that is logged in.
 SubjectManagerRemote getSubjectManager()
           
 SupportManagerRemote getSupportManager()
           
 SystemManagerRemote getSystemManager()
           
 TagManagerRemote getTagManager()
           
 String getTransport()
           
protected  String guessTransport(int port)
           
 boolean isConnected()
          Returns true if and only if this client successfully connected to the remote server.
 boolean isLoggedIn()
          Returns true if and only if this client successfully connected to the remote server and the user successfully logged in.
 Subject login(String user, String password)
          Connects to the remote server and logs in with the given credentials.
 void logout()
          Logs out from the server and disconnects this client.
 void setTransport(String transport)
          Sets the underlying transport to use to communicate with the server.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONSECURE_TRANSPORT

public static final String NONSECURE_TRANSPORT
See Also:
Constant Field Values

SECURE_TRANSPORT

public static final String SECURE_TRANSPORT
See Also:
Constant Field Values
Constructor Detail

RemoteClient

public RemoteClient(String host,
                    int port)
Creates a client that will communicate with the server running on the given host listening on the given port. This constructor will not attempt to connect or login to the remote server - use login(String, String) for that.

Parameters:
host -
port -

RemoteClient

public RemoteClient(String transport,
                    String host,
                    int port)
Creates a client that will communicate with the server running on the given host listening on the given port over the given transport. This constructor will not attempt to connect or login to the remote server - use login(String, String) for that.

Parameters:
transport - valid values are "servlet" and "sslservlet" - if null, sslservlet will be used for ports that end with "443", servlet otherwise
host -
port -

RemoteClient

public RemoteClient(String transport,
                    String host,
                    int port,
                    String subsystem)
Method Detail

login

public Subject login(String user,
                     String password)
              throws Exception
Connects to the remote server and logs in with the given credentials. After successfully executing this, isLoggedIn() will be true and getSubject() will return the subject that this method returns.

Specified by:
login in interface RhqFacade
Parameters:
user -
password -
Returns:
the logged in user
Throws:
Exception - if failed to connect to the server or log in

logout

public void logout()
Logs out from the server and disconnects this client.

Specified by:
logout in interface RhqFacade

connect

public void connect()
             throws Exception
Connects to the remote server but does not establish a user session. This can be used with the limited API that does not require a Subject. After successfully executing this, isConnected() will be true and getSubject() will return the subject that this method returns.

Throws:
Exception - if failed to connect to the server or log in

disconnect

public void disconnect()
Disconnect from the server.


isLoggedIn

public boolean isLoggedIn()
Returns true if and only if this client successfully connected to the remote server and the user successfully logged in.

Specified by:
isLoggedIn in interface RhqFacade
Returns:
if the user was able to connect and log into the server

isConnected

public boolean isConnected()
Returns true if and only if this client successfully connected to the remote server.

Returns:
if the user was able to connect and log into the server

getSubject

public Subject getSubject()
Returns the information on the user that is logged in. May be null if the user never logged in successfully.

Specified by:
getSubject in interface RhqFacade
Returns:
user information or null

getHost

public String getHost()

getPort

public int getPort()

getTransport

public String getTransport()

guessTransport

protected String guessTransport(int port)

setTransport

public void setTransport(String transport)
Sets the underlying transport to use to communicate with the server. Available transports are "servlet" and "sslservlet". If you set it to null, then the transport to be used will be set appropriately for the getPort() (e.g. a secure transport will be used for ports that end with 443, a non-secure transport will be used for all other ports).

Parameters:
transport -

getAlertManager

public AlertManagerRemote getAlertManager()
Specified by:
getAlertManager in interface RhqFacade

getAlertDefinitionManager

public AlertDefinitionManagerRemote getAlertDefinitionManager()
Specified by:
getAlertDefinitionManager in interface RhqFacade

getAvailabilityManager

public AvailabilityManagerRemote getAvailabilityManager()
Specified by:
getAvailabilityManager in interface RhqFacade

getBundleManager

public BundleManagerRemote getBundleManager()
Specified by:
getBundleManager in interface RhqFacade

getCallTimeDataManager

public CallTimeDataManagerRemote getCallTimeDataManager()
Specified by:
getCallTimeDataManager in interface RhqFacade

getRepoManager

public RepoManagerRemote getRepoManager()
Specified by:
getRepoManager in interface RhqFacade

getConfigurationManager

public ConfigurationManagerRemote getConfigurationManager()
Specified by:
getConfigurationManager in interface RhqFacade

getContentManager

public ContentManagerRemote getContentManager()
Specified by:
getContentManager in interface RhqFacade

getDataAccessManager

public DataAccessManagerRemote getDataAccessManager()
Specified by:
getDataAccessManager in interface RhqFacade

getDiscoveryBoss

public DiscoveryBossRemote getDiscoveryBoss()
Specified by:
getDiscoveryBoss in interface RhqFacade

getEventManager

public EventManagerRemote getEventManager()
Specified by:
getEventManager in interface RhqFacade

getMeasurementBaselineManager

public MeasurementBaselineManagerRemote getMeasurementBaselineManager()
Specified by:
getMeasurementBaselineManager in interface RhqFacade

getMeasurementDataManager

public MeasurementDataManagerRemote getMeasurementDataManager()
Specified by:
getMeasurementDataManager in interface RhqFacade

getMeasurementDefinitionManager

public MeasurementDefinitionManagerRemote getMeasurementDefinitionManager()
Specified by:
getMeasurementDefinitionManager in interface RhqFacade

getMeasurementScheduleManager

public MeasurementScheduleManagerRemote getMeasurementScheduleManager()
Specified by:
getMeasurementScheduleManager in interface RhqFacade

getOperationManager

public OperationManagerRemote getOperationManager()
Specified by:
getOperationManager in interface RhqFacade

getResourceManager

public ResourceManagerRemote getResourceManager()
Specified by:
getResourceManager in interface RhqFacade

getResourceFactoryManager

public ResourceFactoryManagerRemote getResourceFactoryManager()
Specified by:
getResourceFactoryManager in interface RhqFacade

getResourceGroupManager

public ResourceGroupManagerRemote getResourceGroupManager()
Specified by:
getResourceGroupManager in interface RhqFacade

getResourceTypeManager

public ResourceTypeManagerRemote getResourceTypeManager()
Specified by:
getResourceTypeManager in interface RhqFacade

getRoleManager

public RoleManagerRemote getRoleManager()
Specified by:
getRoleManager in interface RhqFacade

getSavedSearchManager

public SavedSearchManagerRemote getSavedSearchManager()
Specified by:
getSavedSearchManager in interface RhqFacade

getSubjectManager

public SubjectManagerRemote getSubjectManager()
Specified by:
getSubjectManager in interface RhqFacade

getSupportManager

public SupportManagerRemote getSupportManager()
Specified by:
getSupportManager in interface RhqFacade

getSystemManager

public SystemManagerRemote getSystemManager()
Specified by:
getSystemManager in interface RhqFacade

getRemoteInstallManager

public RemoteInstallManagerRemote getRemoteInstallManager()
Specified by:
getRemoteInstallManager in interface RhqFacade

getTagManager

public TagManagerRemote getTagManager()
Specified by:
getTagManager in interface RhqFacade

getManagers

public Map<String,Object> getManagers()
Returns the map of all remote managers running in the server that this client can talk to.

Specified by:
getManagers in interface RhqFacade
Returns:
Map K=manager name V=remote proxy

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.