com.highdeal.admin.hci
Class InstanceInfoImpl

java.lang.Object
  extended by com.highdeal.admin.hci.InstanceInfoImpl
All Implemented Interfaces:
InstanceInfo, XMLMarshallable, java.lang.Comparable<InstanceInfo>

public class InstanceInfoImpl
extends java.lang.Object
implements InstanceInfo

This class represents an instance information that includes the communication settings of a server instance of the connected SAP CC Core Server system; It contains the configuration of the different technical interfaces that are enabled.

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="instanceInfo">
   <xs:complexType>
     <xs:attribute name="instanceId"  use="required">
       <xs:simpleType>
         <xs:restriction base="xs:string">
           <xs:pattern value="((dispatcher|updater|rater|guider|bulkLoader|taxer)#\d)"/>
         </xs:restriction>
       </xs:simpleType>
     </xs:attribute>
     <xs:attribute name="hostname" type="xs:string" use="required"/>
     <xs:attribute name="hciAddr" type="xs:string" />
     <xs:attribute name="hciPort" type="xs:integer" />
     <xs:attribute name="hciSecure" type="xs:integer" />
     <xs:attribute name="wsAddr" type="xs:string" />
     <xs:attribute name="wsPort" type="xs:integer" />
     <xs:attribute name="wsSecure" type="xs:integer" />
     <xs:attribute name="externalAddr" type="xs:string" />
     <xs:attribute name="externalPort" type="xs:integer" />
     <xs:attribute name="externalSecure" type="xs:integer" />
     <xs:attribute name="internalAddr" type="xs:string" />
     <xs:attribute name="internalPort" type="xs:integer" />
     <xs:attribute name="internalSecure" type="xs:integer" />
   </xs:complexType>
 </xs:element>


Field Summary
 
Fields inherited from interface com.highdeal.admin.hci.InstanceInfo
TAG_NAME
 
Constructor Summary
InstanceInfoImpl()
          Builds an empty InstanceInfo instance.
InstanceInfoImpl(InstanceId instanceId, java.lang.String hostname)
          Initializes a new InstanceInfo instance with its parameters.
 
Method Summary
 void addCharacterData(java.lang.String cData)
          Adds character data to the content element.
 void addChild(java.lang.String tagName, XMLMarshallable child)
          Adds a child to the object, the child representing the marshallable object which must be added to the element.
 int compareTo(InstanceInfo other)
          Compares two instance info object according to their instance ID; It returns -1 if the instance is smaller than o2, 0 if they are equals, 1 otherwise.
 InstanceInfo duplicate()
          Copies this InstanceInfo into a new instance of InstanceInfo.
 ServiceInfo.Address getAddress(ServiceInfo.ServiceInfoType serviceInfoType)
          Gets the address defined for the service.
 java.lang.String getFullHost(ServiceInfo.ServiceInfoType serviceInfoType)
          Gets the host name defined for the service with the multi-homing information.
 java.lang.String getHost(ServiceInfo.ServiceInfoType serviceInfoType)
          Gets the host name defined for the service.
 java.lang.String getHostname()
          Gets the instance host name.
 java.lang.String getHttpHost()
          Deprecated. 
 int getHttpPort()
          Deprecated. 
 java.lang.String getHTTPURL()
          Deprecated. 
 InstanceId getInstanceId()
          Returns the value of the instance ID.
 java.lang.String getInstanceName(boolean full)
          Returns the name (string representation of the InstanceId) or the full name ([<HTTP_HOST_NAME>]<INSTANCE_ID>) of the instance of the SAP CC system
static java.lang.String getLocalInstanceNameFromInstanceId(InstanceId instanceId, java.lang.String ipAddress, boolean fullname)
          Returns the name of the instance specified with its instance ID and running on the localhost.
 int getPort(ServiceInfo.ServiceInfoType serviceInfoType)
          Gets the port defined for the service.
 ServiceInfo.ServiceInfoSecurity getSecurity(ServiceInfo.ServiceInfoType serviceInfoType)
          Gets the security defined for the service.
 java.lang.String getSecurityAsString(ServiceInfo.ServiceInfoType serviceInfoType)
           
 ServiceInfo getServiceInfo(ServiceInfo.ServiceInfoType type)
          Returns the service information value, containing host value and port number.
 java.lang.String getURL(ServiceInfo.ServiceInfoType serviceType)
          Returns the URL for the service.
 boolean hasSame(InstanceId instanceId)
           
 boolean hasSame(InstanceType instanceType)
           
 boolean isHttpMultipleBinding()
          Deprecated. 
 boolean isHTTPSecurityEnabled()
          Deprecated. 
 boolean isMultipleBinding(ServiceInfo.ServiceInfoType serviceInfoType)
          Returns true if the service is bound to all available addresses.
 boolean isServiceAvailable(ServiceInfo.ServiceInfoType serviceType)
          Returns true if the service is available.
 boolean isServiceEnabled(ServiceInfo.ServiceInfoType serviceType)
          Returns true if the service is available and enabled.
 void isValid()
          Throws an InvalidInstanceInfoException if the instance info is malformed or invalid.
 void marshal(XMLOutputter output)
          Gives an XML representation of this object, including its children.
 ServiceInfo putServiceInfo(ServiceInfo.ServiceInfoType serviceInfoType, java.lang.String host, int port, ServiceInfo.ServiceInfoSecurity security)
           
 void putServiceInfo(ServiceInfo serviceInfo)
           
 ServiceInfo removeServiceInfo(ServiceInfo.ServiceInfoType type)
           
 void setAttributes(XMLAttributes atts)
          Sets the attributes of the XML representation of the element being processed.
 void setFullHost(ServiceInfo.ServiceInfoType serviceInfoType, java.lang.String fullHost)
          Sets the host name defined for the service with the multi-homing information.
 void setHost(ServiceInfo.ServiceInfoType serviceInfoType, java.lang.String host)
          Sets the host name defined for the service.
 void setHostname(java.lang.String hostname)
           
 void setHTTPSecurityEnable(boolean flag)
          Deprecated. 
 void setInstanceId(InstanceId instanceId)
           
 void setInstanceName(java.lang.String instanceName)
           
 void setPort(ServiceInfo.ServiceInfoType serviceInfoType, int port)
          Sets the port defined for the service.
 void setSecurity(ServiceInfo.ServiceInfoType serviceInfoType, ServiceInfo.ServiceInfoSecurity security)
          Sets the security policy defined for the service.
 java.lang.String toString()
          Returns a printable form of the instance map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InstanceInfoImpl

public InstanceInfoImpl()
Builds an empty InstanceInfo instance.


InstanceInfoImpl

public InstanceInfoImpl(InstanceId instanceId,
                        java.lang.String hostname)
Initializes a new InstanceInfo instance with its parameters.

Parameters:
instanceId - The instance ID
hostname - The instance host name
Method Detail

duplicate

public InstanceInfo duplicate()
Description copied from interface: InstanceInfo
Copies this InstanceInfo into a new instance of InstanceInfo.

Specified by:
duplicate in interface InstanceInfo
Returns:
A new instance of InstanceInfo that is an exact copy of this instance

putServiceInfo

public ServiceInfo putServiceInfo(ServiceInfo.ServiceInfoType serviceInfoType,
                                  java.lang.String host,
                                  int port,
                                  ServiceInfo.ServiceInfoSecurity security)

putServiceInfo

public void putServiceInfo(ServiceInfo serviceInfo)

getServiceInfo

public ServiceInfo getServiceInfo(ServiceInfo.ServiceInfoType type)
Description copied from interface: InstanceInfo
Returns the service information value, containing host value and port number.

Specified by:
getServiceInfo in interface InstanceInfo
Parameters:
type - The service type, which is one among service info list
Returns:
The service information

removeServiceInfo

public ServiceInfo removeServiceInfo(ServiceInfo.ServiceInfoType type)

hasSame

public boolean hasSame(InstanceType instanceType)

hasSame

public boolean hasSame(InstanceId instanceId)

isServiceEnabled

public boolean isServiceEnabled(ServiceInfo.ServiceInfoType serviceType)
Description copied from interface: InstanceInfo
Returns true if the service is available and enabled.

Specified by:
isServiceEnabled in interface InstanceInfo
Parameters:
serviceType - The service value among service info list
Returns:
true if the service is enabled, false otherwise

isServiceAvailable

public boolean isServiceAvailable(ServiceInfo.ServiceInfoType serviceType)
Description copied from interface: InstanceInfo
Returns true if the service is available.

Specified by:
isServiceAvailable in interface InstanceInfo
Parameters:
serviceType - A service value among service info list
Returns:
true if the service is available, false otherwise

getHttpHost

@Deprecated
public java.lang.String getHttpHost()
Deprecated. 


getHttpPort

@Deprecated
public int getHttpPort()
Deprecated. 


compareTo

public int compareTo(InstanceInfo other)
Compares two instance info object according to their instance ID; It returns -1 if the instance is smaller than o2, 0 if they are equals, 1 otherwise.

Specified by:
compareTo in interface java.lang.Comparable<InstanceInfo>

getInstanceId

public InstanceId getInstanceId()
Description copied from interface: InstanceInfo
Returns the value of the instance ID.

Specified by:
getInstanceId in interface InstanceInfo
Returns:
The InstanceId instance ID) of the instance in the SAP CC system

getAddress

public ServiceInfo.Address getAddress(ServiceInfo.ServiceInfoType serviceInfoType)
Description copied from interface: InstanceInfo
Gets the address defined for the service.

Specified by:
getAddress in interface InstanceInfo
Parameters:
serviceInfoType - value among service info list
Returns:
The address host name

getFullHost

public java.lang.String getFullHost(ServiceInfo.ServiceInfoType serviceInfoType)
Description copied from interface: InstanceInfo
Gets the host name defined for the service with the multi-homing information.

Specified by:
getFullHost in interface InstanceInfo
Parameters:
serviceInfoType - A value among service info list
Returns:
The service host name

getHost

public java.lang.String getHost(ServiceInfo.ServiceInfoType serviceInfoType)
Description copied from interface: InstanceInfo
Gets the host name defined for the service.

Specified by:
getHost in interface InstanceInfo
Parameters:
serviceInfoType - A value among service info list
Returns:
The service host name

getPort

public int getPort(ServiceInfo.ServiceInfoType serviceInfoType)
Description copied from interface: InstanceInfo
Gets the port defined for the service.

Specified by:
getPort in interface InstanceInfo
Parameters:
serviceInfoType - A value among service info list
Returns:
The service port

getSecurity

public ServiceInfo.ServiceInfoSecurity getSecurity(ServiceInfo.ServiceInfoType serviceInfoType)
Description copied from interface: InstanceInfo
Gets the security defined for the service.

Specified by:
getSecurity in interface InstanceInfo
Parameters:
serviceInfoType - A value among service info list
Returns:
The security

setFullHost

public void setFullHost(ServiceInfo.ServiceInfoType serviceInfoType,
                        java.lang.String fullHost)
Description copied from interface: InstanceInfo
Sets the host name defined for the service with the multi-homing information.

Specified by:
setFullHost in interface InstanceInfo
Parameters:
serviceInfoType - A value among service info list
fullHost - The new service host name

setHost

public void setHost(ServiceInfo.ServiceInfoType serviceInfoType,
                    java.lang.String host)
Description copied from interface: InstanceInfo
Sets the host name defined for the service.

Specified by:
setHost in interface InstanceInfo
Parameters:
serviceInfoType - A value among service info list
host - The new service host name

setPort

public void setPort(ServiceInfo.ServiceInfoType serviceInfoType,
                    int port)
Description copied from interface: InstanceInfo
Sets the port defined for the service.

Specified by:
setPort in interface InstanceInfo
Parameters:
serviceInfoType - A value among service info list
port - The new service port

setSecurity

public void setSecurity(ServiceInfo.ServiceInfoType serviceInfoType,
                        ServiceInfo.ServiceInfoSecurity security)
Description copied from interface: InstanceInfo
Sets the security policy defined for the service.

Specified by:
setSecurity in interface InstanceInfo
Parameters:
serviceInfoType - A value among service info list
security - The new security

isHTTPSecurityEnabled

@Deprecated
public boolean isHTTPSecurityEnabled()
Deprecated. 

Description copied from interface: InstanceInfo
Returns true if the HTTP service security is enabled.

Specified by:
isHTTPSecurityEnabled in interface InstanceInfo
Returns:
true indicates that HTTP service is secured; this is the default

setHTTPSecurityEnable

@Deprecated
public void setHTTPSecurityEnable(boolean flag)
Deprecated. 

Description copied from interface: InstanceInfo
Controls whether HTTP service secured or not.

Specified by:
setHTTPSecurityEnable in interface InstanceInfo
Parameters:
flag - true if the HTTP service security is enabled

getHTTPURL

@Deprecated
public java.lang.String getHTTPURL()
Deprecated. 

Description copied from interface: InstanceInfo
Returns the HTTP URL.

Specified by:
getHTTPURL in interface InstanceInfo
Returns:
The HTTP URL

getURL

public java.lang.String getURL(ServiceInfo.ServiceInfoType serviceType)
Description copied from interface: InstanceInfo
Returns the URL for the service.

Specified by:
getURL in interface InstanceInfo
Parameters:
serviceType - A service value among service info list
Returns:
The URL of the service

getInstanceName

public java.lang.String getInstanceName(boolean full)
Description copied from interface: InstanceInfo
Returns the name (string representation of the InstanceId) or the full name ([<HTTP_HOST_NAME>]<INSTANCE_ID>) of the instance of the SAP CC system

Specified by:
getInstanceName in interface InstanceInfo
Parameters:
full - true to return the full name, false to return the string representation of the instance identifier
Returns:
The (full) name of this instance

getHostname

public java.lang.String getHostname()
Description copied from interface: InstanceInfo
Gets the instance host name.

Specified by:
getHostname in interface InstanceInfo
Returns:
The instance host name

setInstanceId

public void setInstanceId(InstanceId instanceId)

setHostname

public void setHostname(java.lang.String hostname)

setInstanceName

public void setInstanceName(java.lang.String instanceName)

isHttpMultipleBinding

@Deprecated
public boolean isHttpMultipleBinding()
Deprecated. 

Description copied from interface: InstanceInfo
Returns true if the HTTP server is bound to all available addresses.

Specified by:
isHttpMultipleBinding in interface InstanceInfo
Returns:
true if the HTTP server is bound to all available addresses, false otherwise

isMultipleBinding

public boolean isMultipleBinding(ServiceInfo.ServiceInfoType serviceInfoType)
Description copied from interface: InstanceInfo
Returns true if the service is bound to all available addresses.

Specified by:
isMultipleBinding in interface InstanceInfo
Parameters:
serviceInfoType - A serviceType service value among service info list
Returns:
true if the service is bound to all available addresses, false otherwise

isValid

public void isValid()
             throws InvalidInstanceException
Description copied from interface: InstanceInfo
Throws an InvalidInstanceInfoException if the instance info is malformed or invalid.

Specified by:
isValid in interface InstanceInfo
Throws:
InvalidInstanceException - If the instance map is not valid

getSecurityAsString

public java.lang.String getSecurityAsString(ServiceInfo.ServiceInfoType serviceInfoType)

setAttributes

public void setAttributes(XMLAttributes atts)
Description copied from interface: XMLMarshallable
Sets the attributes of the XML representation of the element being processed.

Specified by:
setAttributes in interface XMLMarshallable
Parameters:
atts - The XML attributes of the current element

addChild

public void addChild(java.lang.String tagName,
                     XMLMarshallable child)
Description copied from interface: XMLMarshallable
Adds a child to the object, the child representing the marshallable object which must be added to the element.

Specified by:
addChild in interface XMLMarshallable
Parameters:
tagName - The name of tag for the child
child - The child to be added

addCharacterData

public void addCharacterData(java.lang.String cData)
Description copied from interface: XMLMarshallable
Adds character data to the content element.

Specified by:
addCharacterData in interface XMLMarshallable
Parameters:
cData - The character data to be added

marshal

public void marshal(XMLOutputter output)
Description copied from interface: XMLMarshallable
Gives an XML representation of this object, including its children.

Specified by:
marshal in interface XMLMarshallable
Parameters:
output - The XML output to marshal the object into

toString

public java.lang.String toString()
Returns a printable form of the instance map.

Overrides:
toString in class java.lang.Object
Returns:
The printable instance map

getLocalInstanceNameFromInstanceId

public static final java.lang.String getLocalInstanceNameFromInstanceId(InstanceId instanceId,
                                                                        java.lang.String ipAddress,
                                                                        boolean fullname)
Returns the name of the instance specified with its instance ID and running on the localhost.

Parameters:
instanceId - The identifier of the instance to be named
ipAddress - The IP address of the instance
fullname - true if the full name is expected, false if only the name is expected.
Returns:
The name of the instance

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)