com.esri.adf.web.ags.data.gp
Class AGSLocalGPResource

java.lang.Object
  extended by com.esri.adf.web.data.GISResource
      extended by com.esri.adf.web.ags.data.gp.AGSGPResource
          extended by com.esri.adf.web.ags.data.gp.AGSLocalGPResource
All Implemented Interfaces:
WebContextInitialize, WebLifecycle, Serializable

public class AGSLocalGPResource
extends AGSGPResource

See Also:
Serialized Form

Field Summary
protected  AGSLocalConnection delegate
           
protected  com.esri.arcgis.geoprocessing.GPServer localGPServer
           
 
Fields inherited from class com.esri.adf.web.ags.data.gp.AGSGPResource
endPointURL, generatedAlias, gpServer, resultMapDescription, resultMapResource, resultMapServerInfo, serviceCatalogURL, user
 
Fields inherited from class com.esri.adf.web.data.GISResource
alias, context, defaultSpatialReference, functionalities, hasFailedFunctionalities, init
 
Constructor Summary
AGSLocalGPResource()
           
AGSLocalGPResource(String serverObjectName, List<String> hosts, String clusterType, AGSUser user)
           
 
Method Summary
 void activate()
           This method is called by the associated WebContext when the context itself is being activated.
 void addHost(String host)
           
 Object createArcObject(String progId)
          Creates an ArcObject with this progId in the current server context.
protected  void createGPServer()
           
protected  void createResultMapResource()
           
 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 AGSLocalResource.
 String getAlias()
           Returns a reader friendly name for this resource.
 String getClusterType()
           
 int getFailRecheckValue()
          Return the fail recheck value.
 com.esri.arcgisws.GPServerPort getGPServer()
           
 List<String> getHosts()
           
 com.esri.arcgis.geoprocessing.GPServer getLocalGPServer()
           
 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.IServerObjectManager getServerObjectManager()
          Returns the IServerObjectManager object from the server.
 String getServerObjectName()
          The name of the server object on the GIS server machine.
 AGSUser getUser()
           
 void init(WebContext webContext)
           This method is called by the WebContext to initialize the resource.
 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 passivate()
           This method is called by the associated WebContext when the context itself is being passivated.
 String saveObject(Object persistObj)
          Serializes a server object to a String.
 void setClusterType(String clusterType)
           
 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)
           
 void setServerObjectName(String serverObjectName)
           
 void setUser(AGSUser user)
           
 
Methods inherited from class com.esri.adf.web.ags.data.gp.AGSGPResource
getEndPointURL, getResultMapResource, getServiceCatalogURL, setEndPointURL, setResultMapResource, 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

localGPServer

protected transient com.esri.arcgis.geoprocessing.GPServer localGPServer

delegate

protected AGSLocalConnection delegate
Constructor Detail

AGSLocalGPResource

public AGSLocalGPResource()

AGSLocalGPResource

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

createGPServer

protected void createGPServer()
Overrides:
createGPServer in class AGSGPResource

createResultMapResource

protected void createResultMapResource()
Overrides:
createResultMapResource in class AGSGPResource

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 AGSGPResource
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 AGSGPResource
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 AGSGPResource
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 AGSGPResource
See Also:
WebLifecycle.passivate(), WebContext.passivate()

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 AGSLocalResource.

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

getLocalGPServer

public com.esri.arcgis.geoprocessing.GPServer getLocalGPServer()

getGPServer

public com.esri.arcgisws.GPServerPort getGPServer()
Overrides:
getGPServer in class AGSGPResource

isPooled

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

Returns:
boolean- if true, 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 GISResource
Returns:
a reader friendly name for this resource

getServerObjectManager

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

Returns:
IServerObjectManager- the IServerObjectMananger object

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

getServerObjectName

public String getServerObjectName()
The name of the server object on the GIS server machine.

Returns:
String- the server object name

setServerObjectName

public void setServerObjectName(String serverObjectName)

getHosts

public List<String> getHosts()

setHosts

public void setHosts(List<String> hosts)

addHost

public void addHost(String host)

setUser

public void setUser(AGSUser user)
Overrides:
setUser in class AGSGPResource

getUser

public AGSUser getUser()
Overrides:
getUser in class AGSGPResource

getClusterType

public String getClusterType()

setClusterType

public void setClusterType(String clusterType)

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