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

java.lang.Object
  extended by com.esri.adf.web.data.GISResource
      extended by com.esri.adf.web.ags.data.AGSMapResource
          extended by com.esri.adf.web.ags.data.AGSLocalMapResource
All Implemented Interfaces:
WebContextInitialize, WebLifecycle, Serializable
Direct Known Subclasses:
AGSLocalExtensionsResource

public class AGSLocalMapResource
extends AGSMapResource

The AGSLocalMapResource represents a GISResource for ArcGIS Server local map services. Users need to provide the server object name, the host as well as the user to connect to the local server.

It is important to note that for some AGS functionalities to share code between the internet and local resources, we use SOAP to communicate with the server wherever possible. Given this scenario, this class is implemented as a sub-class of the internet map resource represented by the AGSMapResource class.

Users can access the full wealth of the server-side ArcObjects with this resource. However, it uses the capabilities exposed by the MapServerPort interface wherever possible in order to facilitate code-sharing among certain AGS functionalities.

See Also:
Serialized Form

Field Summary
protected  AGSLocalConnection delegate
          A delegate which handles certain calls to the ArcGIS Server.
protected  com.esri.arcgis.carto.MapServer localMapServer
          The remote proxy to the local map server that this resource represents
 
Fields inherited from class com.esri.adf.web.ags.data.AGSMapResource
endPointURL, generatedAlias, mapName, mapServer, serverInfo, serviceCatalogURL, user
 
Fields inherited from class com.esri.adf.web.data.GISResource
alias, context, defaultSpatialReference, functionalities, hasFailedFunctionalities, init
 
Constructor Summary
AGSLocalMapResource()
           Creates a new AGSLocalMapResource with no input parameters set.
AGSLocalMapResource(String serverObjectName, List<String> hosts, String clusterType, AGSUser user)
           Creates a new AGSLocalMapResource with the given set of input parameters.
 
Method Summary
 void activate()
           This method is called by the associated WebContext when the context itself is being activated.
 Object createArcObject(String progId)
           Creates an ArcObject with this progId in the current server context.
protected  void createMapServer()
           This method connects to the ArcGIS server map service end point and creates a remote stub to the server.
 void destroy()
           The cleanup (final) chores of the resource like releasing held resources must be performed in this method.
 boolean equals(String resource)
           Determines whether the resource string represents this resource.
 String getAlias()
           Returns a reader friendly name for this resource.
 String getClusterType()
           Returns the cluster configuration for this resource.
 int getFailRecheckValue()
          Return the fail recheck value.
 List<String> getHosts()
           Returns the List of server hosts that this resource connects to
 com.esri.arcgis.carto.MapServer getLocalMapServer()
           Returns The remote proxy to the local map server that this resource represents
 com.esri.arcgisws.MapServerPort getMapServer()
           Returns The remote stub to the map service that this resource represents
 com.esri.arcgis.server.ServerConnection getServerConnection()
           Returns the ServerConnection object used to connect the server.
 com.esri.arcgis.server.IServerContext getServerContext()
           Returns the IServerContext to the server.
 com.esri.arcgis.server.IServerObjectManager getServerObjectManager()
           Returns the IServerObjectManager to the connected server.
 String getServerObjectName()
           Returns the name of the map server object that this resource represents
 AGSUser getUser()
           Returns the AGSUser to impersonate connections to the server
 void init(WebContext webContext)
           This method is called by the WebContext to initialize the resource.
 boolean isPooled()
           Returns true if the server object is pooled.
 Object loadObject(String xml)
           Deserializes the serialized state of a server-side object to a live server-side object.
 void passivate()
           This method is called by the associated WebContext when the context itself is being passivated.
 String saveObject(Object persistObj)
           Serializes a server-side ArObject to a String.
 void setClusterType(String clusterType)
           Sets the cluster configuration for this resource.
 void setFailRecheckValue(int value)
          Sets the fail recheck value, used for checking if the server is alive after n bypass rounds.
 void setHosts(List<String> hosts)
           Sets the List of server hosts that this resource connects to
 void setServerObjectName(String serverObjectName)
           Sets the name of the map server object that this resource represents
 void setUser(AGSUser user)
           Sets the AGSUser to impersonate connections to the server
 
Methods inherited from class com.esri.adf.web.ags.data.AGSMapResource
getEndPointURL, getImageFormat, getMapName, getMapServerInfo, getServiceCatalogURL, setEndPointURL, setMapName, setServiceCatalogURL
 
Methods inherited from class com.esri.adf.web.data.GISResource
addFunctionality, getDefaultSpatialReference, getFunctionalities, getFunctionality, getWebContext, setAlias, setFunctionalities
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localMapServer

protected transient com.esri.arcgis.carto.MapServer localMapServer
The remote proxy to the local map server that this resource represents


delegate

protected AGSLocalConnection delegate
A delegate which handles certain calls to the ArcGIS Server. This delegate should not be used by consumers of this resource. This is provided for usage within this class as well as for classes that inherit from this class.

Constructor Detail

AGSLocalMapResource

public AGSLocalMapResource()

Creates a new AGSLocalMapResource with no input parameters set. This constructor is typically used when one configures this resource in a JSF config file. If you are to programmatically create this resource, it is recommended that you use the other constructor that takes various input parameters.


AGSLocalMapResource

public AGSLocalMapResource(String serverObjectName,
                           List<String> hosts,
                           String clusterType,
                           AGSUser user)

Creates a new AGSLocalMapResource with the given set of input parameters. If you are to programmatically create this resource, it is recommended that you use this constructor.

Parameters:
serverObjectName - the name of the map server object that this resource represents
hosts - the List of server hosts that this resource connects to
clusterType - if multiple hosts are provided, cluster types of AGSLocalConnection.FAIL_OVER or AGSLocalConnection.ROUND_ROBIN can be provided. A value of null or AGSLocalConnection.NONE_CLUSTER_TYPE can be used in order to not use clustering
user - the AGSUser to impersonate connections to the server
Method Detail

createMapServer

protected void createMapServer()
Description copied from class: AGSMapResource

This method connects to the ArcGIS server map service end point and creates a remote stub to the server. If a user is provided, it will attempt to connect to the server with that user's credentials.

Overrides:
createMapServer in class AGSMapResource

init

public void init(WebContext webContext)
Description copied from class: GISResource

This method is called by the WebContext to initialize the resource. This is typically called when the context itself is initialized or when users add a new resource to the context by using the WebContext.addResource(String, GISResource) method. A GISResource is usable only after this method has been called.

This method iterates through all its supported GISFunctionalitys and calls the GISFunctionality.initFunctionality(GISResource) on them all.

Sub-classes that want to do custom initialization should override this method and make the super call first before doing the custom stuff:

 public void init(WebContext context) {
   super.init(context);
   myInit();
 }
 

Specified by:
init in interface WebContextInitialize
Overrides:
init in class AGSMapResource
Parameters:
webContext - the WebContext that maintains a reference to this resource
See Also:
WebContextInitialize.init(com.esri.adf.web.data.WebContext), GISFunctionality.initFunctionality(GISResource), WebContext.init(WebContext), WebContext.addResource(String, GISResource)

destroy

public void destroy()
Description copied from class: GISResource

The cleanup (final) chores of the resource like releasing held resources must be performed in this method. This is typically called when the context itself is being destroyed or when users remove this resource from the context by using the WebContext.removeResource(GISResource) method. A GISResource is unusable after this method has been called.

This method iterates through all its supported GISFunctionalitys and calls the GISFunctionality.destroyFunctionality() on them all.

Sub-classes that want to do custom cleanup chores should override this method and do the custom cleanup first before making the super call:

 public void destroy() {
   myDestroy();
   super.destroy();
 }
 

Specified by:
destroy in interface WebContextInitialize
Overrides:
destroy in class GISResource
See Also:
WebContextInitialize.destroy(), GISFunctionality.destroyFunctionality(), WebContext.destroy(), WebContext.removeResource(GISResource)

activate

public void activate()
Description copied from class: GISResource

This method is called by the associated WebContext when the context itself is being activated. This typically happens when a new user request is received to perform a set of operations. A GISResource is available for the execution of these operations only after this method has been called.

This method iterates through all its supported GISFunctionalitys and calls the activate() method on those functionalities that implement WebLifecycle.

Sub-classes that want to do custom activation should override this method and make the super call first before doing the custom stuff:

 public void activate() {
   super.activate();
   myActivate();
 }
 

Specified by:
activate in interface WebLifecycle
Overrides:
activate in class GISResource
See Also:
WebLifecycle.activate(), WebContext.activate()

passivate

public void passivate()
Description copied from class: GISResource

This method is called by the associated WebContext when the context itself is being passivated. This typically happens after a user request to perform a set of operations has been serviced. A GISResource is unavailable for the execution of more operations after this method has been called.

This method iterates through all its supported GISFunctionalitys and calls the passivate() method on those functionalities that implement WebLifecycle.

Sub-classes that want to do custom passivation should override this method and do the custom passivation first before making the super call:

 public void passivate() {
   myPassivate();
   super.passivate();
 }
 

Specified by:
passivate in interface WebLifecycle
Overrides:
passivate in class GISResource
See Also:
WebLifecycle.passivate(), WebContext.passivate()

createArcObject

public Object createArcObject(String progId)

Creates an ArcObject with this progId in the current server context. Server side ArcObjects must be created in the current server context. This method does so and returns a remote proxy to the thus created server-side ArcObject

Parameters:
progId - the class id of the server-side ArcObject to be created
Returns:
Object- a remote proxy to the created server-side ArcObject represented by this progId

saveObject

public String saveObject(Object persistObj)

Serializes a server-side ArObject to a String. When connected to pooled services, the ADF creates a new server context at the start of a request cycle and releases the server context at the end of the request cycle. Once the server context is released, it is illegal to maintain a reference to any server-side object. Howerver, if you need to maintain the state of the server-side object, you can use this method to save the state of the object to a String representation. You can load the object again during the subsequent request cycles by using the loadObject(String) method.

Parameters:
persistObj - the server-side ArcObject whose state is to be saved
Returns:
String- a Strings representation of the server-side object

loadObject

public Object loadObject(String xml)

Deserializes the serialized state of a server-side object to a live server-side object. When connected to pooled services, the ADF creates a new server context at the start of a request cycle and releases the server context at the end of the request cycle. Once the server context is released, it is illegal to maintain a reference to any server-side object. Howerver, if you need to maintain the state of the server-side object, you can use the saveObject(Object) method to save the state of the object to a String representation. You can load the object again during the subsequent request cycles by using this loadObject(String) method.

Parameters:
xml - the String representation of the server-side object
Returns:
Object- the loaded server-side ArcObject

equals

public boolean equals(String resource)

Determines whether the resource string represents this resource.

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

getLocalMapServer

public com.esri.arcgis.carto.MapServer getLocalMapServer()

Returns The remote proxy to the local map server that this resource represents

Returns:
The remote proxy to the local map server that this resource represents

getMapServer

public com.esri.arcgisws.MapServerPort getMapServer()
Description copied from class: AGSMapResource

Returns The remote stub to the map service that this resource represents

Overrides:
getMapServer in class AGSMapResource
Returns:
The remote stub to the map service that this resource represents

isPooled

public boolean isPooled()

Returns true if the server object is pooled.

Returns:
true if the server object is pooled

getAlias

public String getAlias()
Description copied from class: GISResource

Returns a reader friendly name for this resource.

It is a good practice for users to explicitly set an alias when the resource is created programmatically or declaratively. Resource providers should provide an auto-generated alias anyway in case users don't explicitly set an alias themselves.

Overrides:
getAlias in class AGSMapResource
Returns:
a reader friendly name for this resource

getServerObjectManager

public com.esri.arcgis.server.IServerObjectManager getServerObjectManager()

Returns the IServerObjectManager to the connected server.

Returns:
the IServerObjectManager to the connected server

getServerConnection

public com.esri.arcgis.server.ServerConnection getServerConnection()

Returns the ServerConnection object used to connect the server.

Returns:
the ServerConnection object used to connect the server

getServerContext

public com.esri.arcgis.server.IServerContext getServerContext()

Returns the IServerContext to the server. When connected to pooled services, the ADF creates a new server context at the start of a request cycle and releases the server context at the end of the request cycle.

Returns:
the IServerContext to the server

getServerObjectName

public String getServerObjectName()

Returns the name of the map server object that this resource represents

Returns:
the name of the map server object that this resource represents

setServerObjectName

public void setServerObjectName(String serverObjectName)

Sets the name of the map server object that this resource represents

Parameters:
serverObjectName - the name of the map server object that this resource represents

getHosts

public List<String> getHosts()

Returns the List of server hosts that this resource connects to

Returns:
the List of server hosts that this resource connects to

setHosts

public void setHosts(List<String> hosts)

Sets the List of server hosts that this resource connects to

Parameters:
hosts - the List of server hosts that this resource connects to

setUser

public void setUser(AGSUser user)

Sets the AGSUser to impersonate connections to the server

Overrides:
setUser in class AGSMapResource
Parameters:
user - the AGSUser to impersonate connections to the server

getUser

public AGSUser getUser()

Returns the AGSUser to impersonate connections to the server

Overrides:
getUser in class AGSMapResource
Returns:
the AGSUser to impersonate connections to the server

getClusterType

public String getClusterType()

Returns the cluster configuration for this resource. If multiple hosts are provided, cluster types of AGSLocalConnection.FAIL_OVER or AGSLocalConnection.ROUND_ROBIN can be provided. A value of null or AGSLocalConnection.NONE_CLUSTER_TYPE can be used in order to not use clustering.

Returns:
the cluster configuration for this resource. if multiple hosts are provided, cluster types of AGSLocalConnection.FAIL_OVER or AGSLocalConnection.ROUND_ROBIN can be provided. A value of null or AGSLocalConnection.NONE_CLUSTER_TYPE can be used in order to not use clustering

setClusterType

public void setClusterType(String clusterType)

Sets the cluster configuration for this resource. If multiple hosts are provided, cluster types of AGSLocalConnection.FAIL_OVER or AGSLocalConnection.ROUND_ROBIN can be provided. A value of null or AGSLocalConnection.NONE_CLUSTER_TYPE can be used in order to not use clustering.

Parameters:
clusterType - the cluster configuration for this resource. if multiple hosts are provided, cluster types of AGSLocalConnection.FAIL_OVER or AGSLocalConnection.ROUND_ROBIN can be provided. A value of null or AGSLocalConnection.NONE_CLUSTER_TYPE can be used in order to not use clustering

getFailRecheckValue

public int getFailRecheckValue()
Return the fail recheck value.

Returns:
the fail recheck value

setFailRecheckValue

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

Parameters:
value - the fail recheck value