org.rhq.enterprise.clientapi
Class RemoteClient

java.lang.Object
  extended by org.rhq.enterprise.clientapi.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.
 org.rhq.enterprise.server.alert.AlertDefinitionManagerRemote getAlertDefinitionManager()
           
 org.rhq.enterprise.server.alert.AlertManagerRemote getAlertManager()
           
 org.rhq.enterprise.server.measurement.AvailabilityManagerRemote getAvailabilityManager()
           
 org.rhq.enterprise.server.bundle.BundleManagerRemote getBundleManager()
           
 org.rhq.enterprise.server.measurement.CallTimeDataManagerRemote getCallTimeDataManager()
           
 org.rhq.enterprise.server.configuration.ConfigurationManagerRemote getConfigurationManager()
           
 org.rhq.enterprise.server.content.ContentManagerRemote getContentManager()
           
 org.rhq.enterprise.server.report.DataAccessManagerRemote getDataAccessManager()
           
 org.rhq.enterprise.server.discovery.DiscoveryBossRemote getDiscoveryBoss()
           
 org.rhq.enterprise.server.drift.DriftManagerRemote getDriftManager()
           
 org.rhq.enterprise.server.drift.DriftTemplateManagerRemote getDriftTemplateManager()
           
 org.rhq.enterprise.server.event.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.
 org.rhq.enterprise.server.measurement.MeasurementBaselineManagerRemote getMeasurementBaselineManager()
           
 org.rhq.enterprise.server.measurement.MeasurementDataManagerRemote getMeasurementDataManager()
           
 org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerRemote getMeasurementDefinitionManager()
           
 org.rhq.enterprise.server.measurement.MeasurementScheduleManagerRemote getMeasurementScheduleManager()
           
 org.rhq.enterprise.server.operation.OperationManagerRemote getOperationManager()
           
 int getPort()
           
 org.rhq.enterprise.server.install.remote.RemoteInstallManagerRemote getRemoteInstallManager()
           
 org.rhq.enterprise.server.content.RepoManagerRemote getRepoManager()
           
 org.rhq.enterprise.server.resource.ResourceFactoryManagerRemote getResourceFactoryManager()
           
 org.rhq.enterprise.server.resource.group.ResourceGroupManagerRemote getResourceGroupManager()
           
 org.rhq.enterprise.server.resource.ResourceManagerRemote getResourceManager()
           
 org.rhq.enterprise.server.resource.ResourceTypeManagerRemote getResourceTypeManager()
           
 org.rhq.enterprise.server.authz.RoleManagerRemote getRoleManager()
           
 org.rhq.enterprise.server.search.SavedSearchManagerRemote getSavedSearchManager()
           
 org.rhq.core.domain.auth.Subject getSubject()
          Returns the information on the user that is logged in.
 org.rhq.enterprise.server.auth.SubjectManagerRemote getSubjectManager()
           
 org.rhq.enterprise.server.support.SupportManagerRemote getSupportManager()
           
 org.rhq.enterprise.server.sync.SynchronizationManagerRemote getSynchronizationManager()
           
 org.rhq.enterprise.server.system.SystemManagerRemote getSystemManager()
           
 org.rhq.enterprise.server.tagging.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.
 org.rhq.core.domain.auth.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 org.rhq.core.domain.auth.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 org.rhq.core.domain.auth.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 org.rhq.enterprise.server.alert.AlertManagerRemote getAlertManager()
Specified by:
getAlertManager in interface RhqFacade

getAlertDefinitionManager

public org.rhq.enterprise.server.alert.AlertDefinitionManagerRemote getAlertDefinitionManager()
Specified by:
getAlertDefinitionManager in interface RhqFacade

getAvailabilityManager

public org.rhq.enterprise.server.measurement.AvailabilityManagerRemote getAvailabilityManager()
Specified by:
getAvailabilityManager in interface RhqFacade

getBundleManager

public org.rhq.enterprise.server.bundle.BundleManagerRemote getBundleManager()
Specified by:
getBundleManager in interface RhqFacade

getCallTimeDataManager

public org.rhq.enterprise.server.measurement.CallTimeDataManagerRemote getCallTimeDataManager()
Specified by:
getCallTimeDataManager in interface RhqFacade

getDriftManager

public org.rhq.enterprise.server.drift.DriftManagerRemote getDriftManager()
Specified by:
getDriftManager in interface RhqFacade

getDriftTemplateManager

public org.rhq.enterprise.server.drift.DriftTemplateManagerRemote getDriftTemplateManager()

getRepoManager

public org.rhq.enterprise.server.content.RepoManagerRemote getRepoManager()
Specified by:
getRepoManager in interface RhqFacade

getConfigurationManager

public org.rhq.enterprise.server.configuration.ConfigurationManagerRemote getConfigurationManager()
Specified by:
getConfigurationManager in interface RhqFacade

getContentManager

public org.rhq.enterprise.server.content.ContentManagerRemote getContentManager()
Specified by:
getContentManager in interface RhqFacade

getDataAccessManager

public org.rhq.enterprise.server.report.DataAccessManagerRemote getDataAccessManager()
Specified by:
getDataAccessManager in interface RhqFacade

getDiscoveryBoss

public org.rhq.enterprise.server.discovery.DiscoveryBossRemote getDiscoveryBoss()
Specified by:
getDiscoveryBoss in interface RhqFacade

getEventManager

public org.rhq.enterprise.server.event.EventManagerRemote getEventManager()
Specified by:
getEventManager in interface RhqFacade

getMeasurementBaselineManager

public org.rhq.enterprise.server.measurement.MeasurementBaselineManagerRemote getMeasurementBaselineManager()
Specified by:
getMeasurementBaselineManager in interface RhqFacade

getMeasurementDataManager

public org.rhq.enterprise.server.measurement.MeasurementDataManagerRemote getMeasurementDataManager()
Specified by:
getMeasurementDataManager in interface RhqFacade

getMeasurementDefinitionManager

public org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerRemote getMeasurementDefinitionManager()
Specified by:
getMeasurementDefinitionManager in interface RhqFacade

getMeasurementScheduleManager

public org.rhq.enterprise.server.measurement.MeasurementScheduleManagerRemote getMeasurementScheduleManager()
Specified by:
getMeasurementScheduleManager in interface RhqFacade

getOperationManager

public org.rhq.enterprise.server.operation.OperationManagerRemote getOperationManager()
Specified by:
getOperationManager in interface RhqFacade

getResourceManager

public org.rhq.enterprise.server.resource.ResourceManagerRemote getResourceManager()
Specified by:
getResourceManager in interface RhqFacade

getResourceFactoryManager

public org.rhq.enterprise.server.resource.ResourceFactoryManagerRemote getResourceFactoryManager()
Specified by:
getResourceFactoryManager in interface RhqFacade

getResourceGroupManager

public org.rhq.enterprise.server.resource.group.ResourceGroupManagerRemote getResourceGroupManager()
Specified by:
getResourceGroupManager in interface RhqFacade

getResourceTypeManager

public org.rhq.enterprise.server.resource.ResourceTypeManagerRemote getResourceTypeManager()
Specified by:
getResourceTypeManager in interface RhqFacade

getRoleManager

public org.rhq.enterprise.server.authz.RoleManagerRemote getRoleManager()
Specified by:
getRoleManager in interface RhqFacade

getSavedSearchManager

public org.rhq.enterprise.server.search.SavedSearchManagerRemote getSavedSearchManager()
Specified by:
getSavedSearchManager in interface RhqFacade

getSubjectManager

public org.rhq.enterprise.server.auth.SubjectManagerRemote getSubjectManager()
Specified by:
getSubjectManager in interface RhqFacade

getSupportManager

public org.rhq.enterprise.server.support.SupportManagerRemote getSupportManager()
Specified by:
getSupportManager in interface RhqFacade

getSystemManager

public org.rhq.enterprise.server.system.SystemManagerRemote getSystemManager()
Specified by:
getSystemManager in interface RhqFacade

getRemoteInstallManager

public org.rhq.enterprise.server.install.remote.RemoteInstallManagerRemote getRemoteInstallManager()
Specified by:
getRemoteInstallManager in interface RhqFacade

getTagManager

public org.rhq.enterprise.server.tagging.TagManagerRemote getTagManager()
Specified by:
getTagManager in interface RhqFacade

getSynchronizationManager

public org.rhq.enterprise.server.sync.SynchronizationManagerRemote getSynchronizationManager()
Specified by:
getSynchronizationManager 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-2012 Red Hat, Inc.. All Rights Reserved.