Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.core.model
Class Host


java.lang.Object
  extended by 

org.eclipse.rse.core.model.RSEPersistableObject
      extended by 

org.eclipse.rse.core.model.PropertySetContainer
          extended by 

org.eclipse.rse.core.model.RSEModelObject
              extended by 
org.eclipse.rse.core.model.Host
All Implemented Interfaces:
IAdaptable, IHost, IPropertySetContainer, IRSEModelObject, IRSEPersistableContainer

public class Host
extends RSEModelObject
implements IHost

Default implementation of the IHost interface.

Dynamic system type providers may extend this implementation if needed.


Field Summary
protected   String previousUserIdKey
           
 
Fields inherited from interface org.eclipse.rse.core.model. IRSEPersistableContainer
NO_CHILDREN
 
Constructor Summary
Host ( ISystemProfile profile)
          Constructor
 
Method Summary
 void clearLocalDefaultUserId ()
          Clear the local default user Id so next query will return the value from the preference store.
 boolean commit ()
          Request a persistence manager to persist this object.
 boolean compareUserIds ( String userId1, String userId2)
          Call this to compare two userIds taking case sensitivity
 void deletingHost ()
          Notification method called when this connection is being deleted.
  Object getAdapter ( Class adapterType)
           
  String getAliasName ()
          Get the unique user-visible connection name.
  IConnectorService[] getConnectorServices ()
          Returns all the connector services currently configured for this host
  String getDefaultEncoding (boolean fromRemote)
          Returns the default encoding of the host.
  String getDefaultUserId ()
          Return the default user Id for this host.
  String getDescription ()
          Return the description of this host.
 boolean getForceUserIdToUpperCase ()
          Call this to query whether the default userId is to be uppercased.
  String getHostName ()
          Get the host name or IP address.
  ISystemHostPool getHostPool ()
          Set the parent connection pool this is owned by.
  String getLocalDefaultUserId ()
          Return the local default user Id without resolving up the food chain.
protected static  String getLocalDefaultUserId ( String key)
          Return the local default user Id without resolving up the food chain.
  String getName ()
           
  IRSEPersistableContainer[] getPersistableChildren ()
          Retrieves the children of this object in the persistence containment hierarchy.
  IRSEPersistableContainer getPersistableParent ()
          Retrieve the parent of this object in the persistence containment hierarchy.
protected   String getPreferencesKey ()
          Helper method to compute a unique name for a given subsystem instance
protected   String getPreferencesKey ( String profileName)
          Helper method to compute a unique name for a given subsystem instance, given a profile name
protected   String getPreferencesKey ( String profileName, String connectionName)
          Helper method to compute a unique name for a given subsystem instance, given a profile name and connection name
  ISubSystem[] getSubSystems ()
          Return the subsystem instances under this connection.
  ISystemProfile getSystemProfile ()
          Return the system profile that owns this connection
  String getSystemProfileName ()
          Return the name of the system profile that owns this connection FIXME Check how this is different from getSystemProfile().getName()
  IRSESystemType getSystemType ()
          Get the system type.
 boolean getUserIdCaseSensitive ()
          Call this to query whether the default userId is case sensitive
 boolean isOffline ()
          Returns the value of the ' Offline ' attribute.
 boolean isPromptable ()
          Check if this host is promptable.
 void renamingSystemProfile ( String oldName, String newName)
          Notification method called when this connection's profile is being renamed.
 void setAliasName ( String newName)
          Intercept of setAliasName so we can potentially rename the default-user-id key for the preferences store.
 void setDefaultEncoding ( String encoding, boolean fromRemote)
          Set the default encoding of the host.
 void setDefaultUserId ( String newId)
          Intercept of setDefaultUserId so we can force it to uppercase.
 void setDescription ( String newDescription)
          Set the description of this host.
 void setForceUserIdToUpperCase (boolean force)
          Call this with false to turn off the default behaviour of forcing the default userId to uppercase.
 void setHostName ( String name)
          Intercept of setHostName so we can force it to uppercase.
 void setHostPool ( ISystemHostPool pool)
          Set the parent connection pool this is owned by.
 void setOffline (boolean newOffline)
          Specify if this connection is offline or not.
 void setPromptable (boolean newPromptable)
          Set the promptable attribute.
 void setSystemType ( IRSESystemType systemType)
          Intercept of setSystemType so we can decide if the user ID is case sensitive
 void setUserIdCaseSensitive (boolean caseSensitive)
          Call this to turn off the default behaviour of considering case when comparing userIds
  String toString ()
           
 
Methods inherited from class org.eclipse.rse.core.model. PropertySetContainer
addPropertySet, addPropertySets, createPropertySet, createPropertySet, getPropertySet, getPropertySets, removePropertySet
 
Methods inherited from class org.eclipse.rse.core.model. RSEPersistableObject
compareStrings, isDirty, isTainted, setDirty, setTainted, setWasRestored, wasRestored
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.rse.core.model. IPropertySetContainer
addPropertySet, addPropertySets, createPropertySet, createPropertySet, getPropertySet, getPropertySets, removePropertySet
 
Methods inherited from interface org.eclipse.rse.core.model. IRSEPersistableContainer
isDirty, isTainted, setDirty, setTainted, setWasRestored, wasRestored
 

Field Detail

previousUserIdKey

protected 
String previousUserIdKey
Constructor Detail

Host

public Host(
ISystemProfile profile)
Constructor

Method Detail

setHostPool

public void setHostPool(
ISystemHostPool pool)
Description copied from interface: IHost
Set the parent connection pool this is owned by. Connection pools are internal management objects, one per profile.

Specified by:
setHostPool in interface IHost

getHostPool

public 
ISystemHostPool getHostPool()
Description copied from interface: IHost
Set the parent connection pool this is owned by. Connection pools are internal management objects, one per profile.

Specified by:
getHostPool in interface IHost

getConnectorServices

public 
IConnectorService[] getConnectorServices()
Description copied from interface: IHost
Returns all the connector services currently configured for this host

Specified by:
getConnectorServices in interface IHost
Returns:
the connector services

getSubSystems

public 
ISubSystem[] getSubSystems()
Description copied from interface: IHost
Return the subsystem instances under this connection. Just a shortcut to ISystemRegistry.getSubSystems(IHost)

Specified by:
getSubSystems in interface IHost

deletingHost

public void deletingHost()
Description copied from interface: IHost
Notification method called when this connection is being deleted. Allows doing pre-death cleanup in overriders.

What we need to do is delete our entry in the preference store for our default userId.

Specified by:
deletingHost in interface IHost

renamingSystemProfile

public void renamingSystemProfile(
String oldName,
                                  
String newName)
Description copied from interface: IHost
Notification method called when this connection's profile is being renamed. Allows doing pre-death cleanup in overriders.

Implementations must not fork off other threads in the implementation of this method, since the old and new profiles will be locked during the rename operation so deadlock could occur when another thread tries to access theprofile during the time of rename ongoing.

What we need to do is rename our entry in the preference store for our default userId.

Specified by:
renamingSystemProfile in interface IHost

getSystemProfile

public 
ISystemProfile getSystemProfile()
Description copied from interface: IHost
Return the system profile that owns this connection

Specified by:
getSystemProfile in interface IHost
Returns:
the profile which contains this host

getSystemProfileName

public 
String getSystemProfileName()
Description copied from interface: IHost
Return the name of the system profile that owns this connection FIXME Check how this is different from getSystemProfile().getName()

Specified by:
getSystemProfileName in interface IHost

setAliasName

public void setAliasName(
String newName)
Intercept of setAliasName so we can potentially rename the default-user-id key for the preferences store. That key is profileName.connectionAliasName so is affected when the alias name changes.

Specified by:
setAliasName in interface IHost
Parameters:
newName - The new value of the AliasName attribute

setSystemType

public void setSystemType(
IRSESystemType systemType)
Intercept of setSystemType so we can decide if the user ID is case sensitive

Specified by:
setSystemType in interface IHost
Parameters:
systemType - The new value of the SystemType attribute

setHostName

public void setHostName(
String name)
Intercept of setHostName so we can force it to uppercase. IPv4 host names are case insensitive. Much data is stored using the host name as part of the key. Therefore, the host name is capitalized here so that these comparisons work naturally. However, this must be done using the US locale since IPv4 host names use can be compared using this locale. See RFC1035.

Specified by:
setHostName in interface IHost
Parameters:
name - The new value of the HostName attribute

setDefaultUserId

public void setDefaultUserId(
String newId)
Intercept of setDefaultUserId so we can force it to uppercase. Also, we do not store the user Id per se in the attribute, but rather we store it in the preference with a key name unique to this connection. We store that key name in this attribute. However, this is all transparent to the caller.

Specified by:
setDefaultUserId in interface IHost
Parameters:
newId - The new value of the DefaultUserId attribute

getDefaultUserId

public 
String getDefaultUserId()
Description copied from interface: IHost
Return the default user Id for this host. Note that we don't store it directly in an attribute, as we don't want the team to share it. The actual user Id is stored in the preference store keyed by this connection's unique name (profile.connName) instead, and that key is stored in this attribute.

Further, it is possible that there is no default user id. If so, this method will go to the preference store and will try to get the default user Id per this connection's system type.

This is all transparent to the caller though.

Specified by:
getDefaultUserId in interface IHost
Returns:
The value of the DefaultUserId attribute

getLocalDefaultUserId

protected static 
String getLocalDefaultUserId(
String key)
Return the local default user Id without resolving up the food chain.

See Also:
getDefaultUserId()

getLocalDefaultUserId

public 
String getLocalDefaultUserId()
Description copied from interface: IHost
Return the local default user Id without resolving up the food chain.

Specified by:
getLocalDefaultUserId in interface IHost
See Also:
IHost.getDefaultUserId()

clearLocalDefaultUserId

public void clearLocalDefaultUserId()
Description copied from interface: IHost
Clear the local default user Id so next query will return the value from the preference store.

Same as calling setDefaultUserId(null)

Specified by:
clearLocalDefaultUserId in interface IHost
See Also:
IHost.setDefaultUserId(String)

getPreferencesKey

protected 
String getPreferencesKey()
Helper method to compute a unique name for a given subsystem instance


getPreferencesKey

protected 
String getPreferencesKey(
String profileName)
Helper method to compute a unique name for a given subsystem instance, given a profile name


getPreferencesKey

protected 
String getPreferencesKey(
String profileName,
                                   
String connectionName)
Helper method to compute a unique name for a given subsystem instance, given a profile name and connection name


setForceUserIdToUpperCase

public void setForceUserIdToUpperCase(boolean force)
Call this with false to turn off the default behaviour of forcing the default userId to uppercase.


setUserIdCaseSensitive

public void setUserIdCaseSensitive(boolean caseSensitive)
Call this to turn off the default behaviour of considering case when comparing userIds


getForceUserIdToUpperCase

public boolean getForceUserIdToUpperCase()
Call this to query whether the default userId is to be uppercased.

Specified by:
getForceUserIdToUpperCase in interface IHost
Returns:
true if the user id is to be uppercased.

getUserIdCaseSensitive

public boolean getUserIdCaseSensitive()
Call this to query whether the default userId is case sensitive


compareUserIds

public boolean compareUserIds(
String userId1,
                              
String userId2)
Call this to compare two userIds taking case sensitivity

Specified by:
compareUserIds in interface IHost
Parameters:
userId1 - first id to compare
userId2 - second id to compare

toString

public 
String toString()
Overrides:
toString in class Object

getAdapter

public 
Object getAdapter(
Class adapterType)
Specified by:
getAdapter in interface IAdaptable

getSystemType

public 
IRSESystemType getSystemType()
Description copied from interface: IHost
Get the system type.

Specified by:
getSystemType in interface IHost
Returns:
The value of the SystemType attribute

getName

public 
String getName()
Specified by:
getName in interface IRSEModelObject

getAliasName

public 
String getAliasName()
Description copied from interface: IHost
Get the unique user-visible connection name. This is a key that is unique per connection pool.

Specified by:
getAliasName in interface IHost
Returns:
The value of the AliasName attribute

getHostName

public 
String getHostName()
Description copied from interface: IHost
Get the host name or IP address.

Specified by:
getHostName in interface IHost
Returns:
The value of the HostName attribute

getDescription

public 
String getDescription()
Description copied from interface: IHost
Return the description of this host.

Specified by:
getDescription in interface IHost
Specified by:
getDescription in interface IRSEModelObject
Overrides:
getDescription in class RSEModelObject
Returns:
The value of the Description attribute

setDescription

public void setDescription(
String newDescription)
Description copied from interface: IHost
Set the description of this host.

Specified by:
setDescription in interface IHost
Parameters:
newDescription - The new value of the Description attribute

isPromptable

public boolean isPromptable()
Description copied from interface: IHost
Check if this host is promptable.

Specified by:
isPromptable in interface IHost
Returns:
The value of the Promptable attribute

setPromptable

public void setPromptable(boolean newPromptable)
Description copied from interface: IHost
Set the promptable attribute.

Specified by:
setPromptable in interface IHost
Parameters:
newPromptable - The new value of the Promptable attribute

isOffline

public boolean isOffline()
Description copied from interface: IHost
Returns the value of the ' Offline ' attribute.

Query if this connection is offline or not. If so, there is no live connection. Subsystems decide how much to enable while offline. It is up to each subsystem to honor this flag.

Specified by:
isOffline in interface IHost
Returns:
the value of the 'Offline' attribute.
See Also:
IHost.setOffline(boolean)

setOffline

public void setOffline(boolean newOffline)
Description copied from interface: IHost
Specify if this connection is offline or not. It is up to each subsystem to honor this flag.

Specified by:
setOffline in interface IHost
Parameters:
newOffline - the new value of the 'Offline' attribute.
See Also:
IHost.isOffline()

commit

public boolean commit()
Description copied from interface: IRSEPersistableContainer
Request a persistence manager to persist this object.

Specified by:
commit in interface IRSEPersistableContainer
Returns:
true if the object was persisted.

getPersistableParent

public 
IRSEPersistableContainer getPersistableParent()
Description copied from interface: IRSEPersistableContainer
Retrieve the parent of this object in the persistence containment hierarchy. This is related to, but not necessarily the same as, the model hierarchy.

Specified by:
getPersistableParent in interface IRSEPersistableContainer
Returns:
the parent persistent object. This is null if there is no parent.

getPersistableChildren

public 
IRSEPersistableContainer[] getPersistableChildren()
Description copied from interface: IRSEPersistableContainer
Retrieves the children of this object in the persistence containment hierarchy. This is related to, but not necessarily the same as, the model hierarchy.

Specified by:
getPersistableChildren in interface IRSEPersistableContainer
Returns:
the array of persistent children in the order they are to be stored in the persistent form. This is an empty array if there are no children. See IRSEPersistableContainer.NO_CHILDREN.

getDefaultEncoding

public 
String getDefaultEncoding(boolean fromRemote)
Description copied from interface: IHost
Returns the default encoding of the host.

If fromRemote is false, returns an encoding preference specified locally without querying the remote system (for example, an encoding set by a user). If fromRemote is true, it first checks to see if there is a local "overriding" encoding set by the client without querying the remote system, and if such a "local" encoding preference does not exist, returns the encoding that was set by the client by querying a remote system.

Specified by:
getDefaultEncoding in interface IHost
Parameters:
fromRemote - false to get the encoding that was obtained by the client by not querying the remote system, true to also check the encoding, if needed, that was set by the client after querying a remote system.
Returns:
the default encoding of the host, or null if no encoding was set.
See Also:
IHost.setDefaultEncoding(String, boolean)

setDefaultEncoding

public void setDefaultEncoding(
String encoding,
                               boolean fromRemote)
Description copied from interface: IHost
Set the default encoding of the host.

This method can only be called when no subsystem is connected. The client has to obtain the encoding either by querying the remote system, or by some other means (for example, set by a user).

Specified by:
setDefaultEncoding in interface IHost
Parameters:
encoding - the encoding of the host, or null to erase the current encoding.
fromRemote - true if the encoding is set by the client after querying the remote system, or false otherwise (e.g. setting a local user preference).
See Also:
IHost.getDefaultEncoding(boolean)

RSE
Release 3.0

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

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire