com.esri.adf.web.ags.data
Class AGSLocalConnection

java.lang.Object
  extended by com.esri.adf.web.ags.data.AGSLocalConnection
All Implemented Interfaces:
Externalizable, Serializable

public class AGSLocalConnection
extends Object
implements Externalizable

An ArcGIS server resource. It can be of type MapServer or GeocodeServer. This class establishes a connection to the server, holds on to the server parameters and can activate() and passivate() the connections as required. It also provides convenience methods to create server objects within the server context as well as methods to save and load objects to and from their XML representations.

See Also:
Serialized Form

Field Summary
protected  com.esri.arcgis.server.ServerCluster cluster
          Deprecated. As of ArcGIS Java Server 9.3, instead use cluster2
protected  com.esri.arcgis.server.ServerCluster2 cluster2
           
protected  String configTypeName
          The config type of this resource.
protected  com.esri.arcgis.server.ServerConnection connection
          The IServerConnection object.
protected  String currentHost
          The name of the machine which hosts the ArcGIS server.
static String FAIL_OVER
          The fail-over cluster type.
protected  int failRecheckValue
           
protected  List<String> hosts
           
protected  boolean init
           
protected  com.esri.arcgis.server.IServerObjectManager manager
          The server object manager
static String NONE_CLUSTER_TYPE
          No cluster type supported.
protected  boolean pooled
          Indicates whether the associated server object is pooled or not.
static String ROUND_ROBIN
          The round-robin cluster type.
protected  com.esri.arcgis.server.ServerClusterType serverClusterType
           
protected  com.esri.arcgis.server.IServerContext serverContext
          The IServerContext of this resource
protected  com.esri.arcgis.server.IServerObject serverObject
          The IServerObject running within this context
protected  String serverObjectName
          The name by which the server object in question can be accessed on the server.
protected  AGSUser user
           
 
Constructor Summary
AGSLocalConnection()
           
AGSLocalConnection(String serverObjectName, List<String> hosts, String configTypeName, String clusterType, AGSUser user)
           
 
Method Summary
 void activateResource()
           
 void addHost(String host)
           
 Object createArcObject(String progId)
          Creates an ArcObject with this progId in the current server context.
 boolean equals(String resource)
          Determines whether the resource string represents this AGSLocalConnection.
 String getClusterType()
           
 String getConfigTypeName()
           
 String getCurrentHost()
           
 int getFailRecheckValue()
          Return the fail recheck value.
 List<String> getHosts()
           
 com.esri.arcgis.server.ServerConnection getServerConnection()
          Returns the ServerConnection object from the server.
 com.esri.arcgis.server.IServerContext getServerContext()
          Returns the IServerContext object from the server.
 com.esri.arcgis.server.IServerObject getServerObject()
          Returns the IServerObject from the server.
 com.esri.arcgis.server.IServerObjectManager getServerObjectManager()
          Returns the IServerObjectManager object from the server.
 String getServerObjectName()
           
 AGSUser getUser()
           
 void initResource()
           
 boolean isPooled()
          Returns an indicator of whether the server object is pooled or not.
 Object loadObject(String xml)
          Deserializes the string to a server object by calling the loadObject method on the ServerContext.
 void passivateResource()
           
 String peek()
           
 void readExternal(ObjectInput in)
           
 String saveObject(Object persistObj)
          Serializes a server object to a String.
 void setClusterType(String clusterType)
           
 void setConfigTypeName(String configTypeName)
           
 void setFailRecheckValue(int value)
          Sets the fail recheck value, used for checking if the server is alive after n minutes.
 void setHosts(List<String> hosts)
           
 void setServerObjectName(String serverObjectName)
           
 void setUser(AGSUser user)
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE_CLUSTER_TYPE

public static final String NONE_CLUSTER_TYPE
No cluster type supported.

See Also:
Constant Field Values

FAIL_OVER

public static final String FAIL_OVER
The fail-over cluster type.

See Also:
Constant Field Values

ROUND_ROBIN

public static final String ROUND_ROBIN
The round-robin cluster type.

See Also:
Constant Field Values

connection

protected transient com.esri.arcgis.server.ServerConnection connection
The IServerConnection object. Represents the active connection with the ArcGIS server.


serverObject

protected transient com.esri.arcgis.server.IServerObject serverObject
The IServerObject running within this context


serverContext

protected transient com.esri.arcgis.server.IServerContext serverContext
The IServerContext of this resource


manager

protected transient com.esri.arcgis.server.IServerObjectManager manager
The server object manager


pooled

protected boolean pooled
Indicates whether the associated server object is pooled or not.


serverObjectName

protected String serverObjectName
The name by which the server object in question can be accessed on the server. The first part of the resource string (ServerObjectName@Host) represents the serverObjectName


currentHost

protected String currentHost
The name of the machine which hosts the ArcGIS server. The second part of the resource string (ServerObjectName@Host) represents the host


configTypeName

protected String configTypeName
The config type of this resource. Possible values: "MapServer", "GeocodeServer", empty i.e. "", etc.


cluster

@Deprecated
protected transient com.esri.arcgis.server.ServerCluster cluster
Deprecated. As of ArcGIS Java Server 9.3, instead use cluster2

cluster2

protected transient com.esri.arcgis.server.ServerCluster2 cluster2

serverClusterType

protected transient com.esri.arcgis.server.ServerClusterType serverClusterType

failRecheckValue

protected int failRecheckValue

init

protected boolean init

hosts

protected List<String> hosts

user

protected AGSUser user
Constructor Detail

AGSLocalConnection

public AGSLocalConnection()

AGSLocalConnection

public AGSLocalConnection(String serverObjectName,
                          List<String> hosts,
                          String configTypeName,
                          String clusterType,
                          AGSUser user)
Method Detail

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

initResource

public void initResource()

peek

public String peek()

activateResource

public void activateResource()

passivateResource

public void passivateResource()

createArcObject

public Object createArcObject(String progId)
Creates an ArcObject with this progId in the current server context.

Parameters:
progId - the class id
Returns:
Object- the ArcObject represented by this progId

saveObject

public String saveObject(Object persistObj)
Serializes a server object to a String.

Parameters:
persistObj - the object to store
Returns:
String- a string representation of the object

loadObject

public Object loadObject(String xml)
Deserializes the string to a server object by calling the loadObject method on the ServerContext.

Parameters:
xml - the string representation of the server object
Returns:
Object- the loaded Object

equals

public boolean equals(String resource)
Determines whether the resource string represents this AGSLocalConnection.

Parameters:
resource - the resource string
Returns:
boolean- if true, the resource is the same

getServerObject

public com.esri.arcgis.server.IServerObject getServerObject()
Returns the IServerObject from the server.

Returns:
IServerObject- the IServerObject

getServerConnection

public com.esri.arcgis.server.ServerConnection getServerConnection()
Returns the ServerConnection object from the server.

Returns:
ServerConnection- the ServerConnection object

getServerContext

public com.esri.arcgis.server.IServerContext getServerContext()
Returns the IServerContext object from the server.

Returns:
IServerContext- the IServerContext object

getServerObjectManager

public com.esri.arcgis.server.IServerObjectManager getServerObjectManager()
Returns the IServerObjectManager object from the server.

Returns:
IServerObjectManager- the IServerObjectMananger object

getServerObjectName

public String getServerObjectName()

getHosts

public List<String> getHosts()

getConfigTypeName

public String getConfigTypeName()

getClusterType

public String getClusterType()

getUser

public AGSUser getUser()

isPooled

public boolean isPooled()
Returns an indicator of whether the server object is pooled or not.

Returns:
boolean- if true, server object is pooled

getCurrentHost

public String getCurrentHost()

getFailRecheckValue

public int getFailRecheckValue()
Return the fail recheck value.

Returns:
the fail recheck value

addHost

public void addHost(String host)

setServerObjectName

public void setServerObjectName(String serverObjectName)

setHosts

public void setHosts(List<String> hosts)

setConfigTypeName

public void setConfigTypeName(String configTypeName)

setClusterType

public void setClusterType(String clusterType)

setFailRecheckValue

public void setFailRecheckValue(int value)
Sets the fail recheck value, used for checking if the server is alive after n minutes. The default value is 30 minutes.

Parameters:
value - the fail recheck value

setUser

public void setUser(AGSUser user)