com.esri.aims.mtier.model.admin
Class Service

java.lang.Object
  extended by com.esri.aims.mtier.model.admin.Service

public class Service
extends Object

This class defines an ArcIMS service.


Field Summary
static int ACCESS_PRIVATE
          Defines access level as Private.
static int ACCESS_PUBLIC
          Defines access level as Public.
static int IMAGE_BMP
          Defines IMAGE_TYPE as BMP.
static int IMAGE_GIF
          Defines IMAGE_TYPE as GIF.
static int IMAGE_JPG
          Defines IMAGE_TYPE as JPEG.
static int IMAGE_PNG
          Defines IMAGE_TYPE as PNG.
static int IMAGE_PNG8
          Defines IMAGE_TYPE as PNG8.
 
Constructor Summary
Service()
          Constructs an instance of the Service object.
 
Method Summary
 boolean addService(ConnectionProxy connection)
          Adds a new Service using the specified ConnectionProxy object..
 int getAccess()
          Returns the access associated with this Service as PUBLIC or PRIVATE.
static int getAccessInt(String access)
          Returns the access level defined by the parameter as a static integer.
 String getAccessString()
          Returns the access of a service as a String.
 String getConfigContents()
          Return the contents of the configuration file for the newly created image service.
 String getConfigFile()
          Returns the location of the configuration file as a String.
 String getExtension()
           
 int getImageType()
          Returns currently defined image type as integer as set with static variables (IMAGE_JPG, IMAGE_GIF, IMAGE_PNG, IMAGE_PNG8).
static int getImageTypeInt(String imageType)
          Returns the image type defined by the parameter as a static integer.
 String getImageTypeString()
          Returns currently defined image type as String.
 boolean getIsCustom()
          Returns true if this is a custom service, false otherwise.
 String getName()
          Used to get service name.
 int getOutputCleanup()
          Gets the output cleanup interval.
 String getOutputCleanupString()
          Gets the output cleanup interval as a String.
 String getOutputDir()
          Gets the output directory.
 String getOutputURL()
          Gets the output URL.
 int getPixelCount()
          Returns the maximum pixel count per image generated by this service.
 String getPixelCountString()
          Returns the maximum pixel count per image generated by this service as a String.
static Service getService(String name, ConnectionProxy connection)
          Returns a Service object representing the service of the given name on the site defined by the connnection.
 String[] getVirtualServerInfo()
          Used to get the name of the virtualServer.
 String getVirtualServerName()
          Used to get the name of the virtualServer.
 boolean isRunning()
          Returns true if this map service is being served by the site, false otherwise.
static byte[] readBytes(InputStream inStream)
           
 boolean removeService(ConnectionProxy connection)
          Removes this service.
 void setAccess(int access)
          Sets the access of a service as PUBLIC or PRIVATE.
 void setConfigContents(byte[] configContents, boolean encode)
          Sets the contents of the configuration file for this service from a String.
 void setConfigContents(InputStream configContents, boolean encode)
          Sets the contents of the configuration file for this service from a String.
 void setConfigContents(String configContents)
          Sets the contents of the configuration file for this service from a String.
 void setConfigContents(String configContents, boolean encode)
          Sets the contents of the configuration file for this service from a String.
 void setConfigFile(String configFile)
          Sets the location of the configuration file.
 void setConfigFileLength(long fileLength)
          Sets the length of the configuration file.
 void setExtension(String ext)
           
 void setImageType(int type)
          Sets the image output type used.
 void setIsCustom(boolean isCustom)
          Sets whether or not this is a custom service.
 void setName(String name)
          Used to set service name.
 void setOutputCleanup(int outputCleanup)
          Sets the cleanup interval for output files generated for this service.
 void setOutputDir(String outputDir)
          Sets the output directory for image, extract, and other services that output files.
 void setOutputURL(String outputURL)
          Sets the output url for image, extract, and other services that output files.
 void setPixelCount(int pixCount)
          Sets the maximum pixel count per image for this service.
 void setRunning(boolean isRunning)
          This method is used to set the state of this object to running or stopped.
 void setVirtualServer(String virtualServer, String type, String version)
          Used to set the name of the virtualServer.
 boolean startService(ConnectionProxy connection)
          Starts this service.
 boolean stopService(ConnectionProxy connection)
          Stops this service.
 String toString()
          Overwrites Object.toString().
 void useBinary(boolean useBinary)
           
 boolean usesBinary()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IMAGE_JPG

public static final int IMAGE_JPG
Defines IMAGE_TYPE as JPEG.

See Also:
Constant Field Values

IMAGE_GIF

public static final int IMAGE_GIF
Defines IMAGE_TYPE as GIF.

See Also:
Constant Field Values

IMAGE_PNG

public static final int IMAGE_PNG
Defines IMAGE_TYPE as PNG.

See Also:
Constant Field Values

IMAGE_PNG8

public static final int IMAGE_PNG8
Defines IMAGE_TYPE as PNG8.

See Also:
Constant Field Values

IMAGE_BMP

public static final int IMAGE_BMP
Defines IMAGE_TYPE as BMP.

See Also:
Constant Field Values

ACCESS_PUBLIC

public static final int ACCESS_PUBLIC
Defines access level as Public.

See Also:
Constant Field Values

ACCESS_PRIVATE

public static final int ACCESS_PRIVATE
Defines access level as Private.

See Also:
Constant Field Values
Constructor Detail

Service

public Service()
Constructs an instance of the Service object.

Method Detail

getService

public static Service getService(String name,
                                 ConnectionProxy connection)
                          throws ConnectionParameterException,
                                 AuthenticationException,
                                 com.esri.aims.mtier.io.http.UnableToPingEsrimapException,
                                 com.esri.aims.mtier.model.axl.ErrorAndWarningException,
                                 SAXException
Returns a Service object representing the service of the given name on the site defined by the connnection. If no service of that name exists, then null is returned.

Parameters:
name - The name of the service of interest.
connection - The connection to the site.
Returns:
Service A Service object representing a service on the site.
Throws:
ConnectionParameterException
AuthenticationException
com.esri.aims.mtier.io.http.UnableToPingEsrimapException
com.esri.aims.mtier.model.axl.ErrorAndWarningException
SAXException

setName

public void setName(String name)
Used to set service name.

Parameters:
name - The name of the service.

getName

public String getName()
Used to get service name.

Returns:
String The name of the service.

setVirtualServer

public void setVirtualServer(String virtualServer,
                             String type,
                             String version)
Used to set the name of the virtualServer.

Parameters:
virtualServer - The name of the virutal server this is service is (is to be) assocaited with.

getVirtualServerName

public String getVirtualServerName()
Used to get the name of the virtualServer.

Returns:
String The name of the virutal server this is service is (is to be) assocaited with.

getVirtualServerInfo

public String[] getVirtualServerInfo()
Used to get the name of the virtualServer.

Returns:
String The name of the virutal server this is service is (is to be) assocaited with.

setImageType

public void setImageType(int type)
Sets the image output type used. See the static variables defined for options (IMAGE_JPG, IMAGE_GIF, IMAGE_PNG, IMAGE_PNG8).

Parameters:
type - Defines the type of image to be output for a given image service.

getImageType

public int getImageType()
Returns currently defined image type as integer as set with static variables (IMAGE_JPG, IMAGE_GIF, IMAGE_PNG, IMAGE_PNG8).

Returns:
int Image type as defined by static integers.

getImageTypeString

public String getImageTypeString()
Returns currently defined image type as String.

Returns:
String Image type as a String.

setIsCustom

public void setIsCustom(boolean isCustom)
Sets whether or not this is a custom service.

Parameters:
isCustom - True if this is a custom service, false otherwise.

getIsCustom

public boolean getIsCustom()
Returns true if this is a custom service, false otherwise.

Returns:
boolean True if service is custom, false otherwise.

setOutputDir

public void setOutputDir(String outputDir)
Sets the output directory for image, extract, and other services that output files.

Parameters:
outputDir - The output directory for files.

getOutputDir

public String getOutputDir()
Gets the output directory.

Returns:
String Output directory location.

setOutputURL

public void setOutputURL(String outputURL)
Sets the output url for image, extract, and other services that output files.

Parameters:
outputURL - The output URL for files.

getOutputURL

public String getOutputURL()
Gets the output URL.

Returns:
String Output url location.

setOutputCleanup

public void setOutputCleanup(int outputCleanup)
Sets the cleanup interval for output files generated for this service.

Parameters:
outputCleanup - The cleanup time for files in the output directory.

getOutputCleanup

public int getOutputCleanup()
Gets the output cleanup interval.

Returns:
int The cleanup interval for files generated by this service.

getOutputCleanupString

public String getOutputCleanupString()
Gets the output cleanup interval as a String.

Returns:
int The cleanup interval for files generated by this service as a String.

setConfigFileLength

public void setConfigFileLength(long fileLength)
Sets the length of the configuration file.

Parameters:
fileLength - The length of the configuration file, in bytes.

setConfigFile

public void setConfigFile(String configFile)
Sets the location of the configuration file. NOTE: IF THIS FILE STRING IS OF A OF THE KNOWN FILE TYPE THEN THE EXTENSION AND BINARY VALUES WILL BE SET. TO OVERRIDE, SUBSEQUENT CALLS TO setBinary(boolean) AND setExtension(String) NEED TO BE MADE.

Parameters:
configFile - The location of the configuration file.

getConfigFile

public String getConfigFile()
Returns the location of the configuration file as a String. NOTE: This location is not necessarily visible by the current client application using this bean.

Returns:
String The location of the configuration file for this service.

setConfigContents

public void setConfigContents(String configContents)
Sets the contents of the configuration file for this service from a String. This method does not base 64 encode the contents. Invoking this method is the same as invoking setConfigContent(configContents, false).

Parameters:
configContents - The contents of the configuration file for this service.

setConfigContents

public void setConfigContents(String configContents,
                              boolean encode)
Sets the contents of the configuration file for this service from a String. If encode is set to true, then the contents are base 64 encoded.

Parameters:
configContents - The contents of the configuration file for this service.
encode - True to base64 encode contents, false otherwise.

setConfigContents

public void setConfigContents(byte[] configContents,
                              boolean encode)
Sets the contents of the configuration file for this service from a String. If encode is set to true, then the contents are base 64 encoded.

Parameters:
configContents - The contents of the configuration file for this service.
encode - True to base64 encode contents, false otherwise.

setConfigContents

public void setConfigContents(InputStream configContents,
                              boolean encode)
                       throws IOException
Sets the contents of the configuration file for this service from a String. If encode is set to true, then the contents are base 64 encoded.

Parameters:
configContents - The contents of the configuration file for this service.
encode - True to base64 encode contents, false otherwise.
Throws:
IOException

getConfigContents

public String getConfigContents()
Return the contents of the configuration file for the newly created image service. Return null for an existing image service. Return null for both new and existing ArcMap services.

Returns:
String contents of the configuration file (AXL) for newly created image service.

setPixelCount

public void setPixelCount(int pixCount)
Sets the maximum pixel count per image for this service.

Parameters:
pixCount - The maximum pixel count per image generated by this service.

getPixelCount

public int getPixelCount()
Returns the maximum pixel count per image generated by this service.

Returns:
int The maximum pixel count for this service.

getPixelCountString

public String getPixelCountString()
Returns the maximum pixel count per image generated by this service as a String.

Returns:
String The maximum pixel count for this service as a String.

isRunning

public boolean isRunning()
Returns true if this map service is being served by the site, false otherwise.

Returns:
boolean True if service is running, false otherwise.

setRunning

public void setRunning(boolean isRunning)
This method is used to set the state of this object to running or stopped. NOTE: THIS METHOD SHOULD NOT BE USED TO START OR STOP THE SERVICE. IT IS ONLY INTENDED TO BE USED INTERNALLY BY OBJECTS WITHIN THE MODEL. TO START AND STOP A SERVICE USE THE startService(ConnectionProxy) AND stopService(ConnectionProxy) METHODS IN THIS CLASS.

Parameters:
isRunning - True to set object state to "running", false otherwise.
See Also:
startService(ConnectionProxy), stopService(ConnectionProxy)

setAccess

public void setAccess(int access)
Sets the access of a service as PUBLIC or PRIVATE.

Parameters:
access - the access level to set the service at. These values are defined as static integers in this class.

getAccess

public int getAccess()
Returns the access associated with this Service as PUBLIC or PRIVATE.

Returns:
int The access level the service is set at. These values are defined as static integers in this class.

getAccessString

public String getAccessString()
Returns the access of a service as a String.

Returns:
String The access level the service is set at as a String.

addService

public boolean addService(ConnectionProxy connection)
                   throws ConnectionParameterException,
                          AuthenticationException,
                          com.esri.aims.mtier.io.http.UnableToPingEsrimapException,
                          com.esri.aims.mtier.model.axl.ErrorAndWarningException,
                          SAXException
Adds a new Service using the specified ConnectionProxy object..

Throws:
ConnectionParameterException
AuthenticationException
com.esri.aims.mtier.io.http.UnableToPingEsrimapException
com.esri.aims.mtier.model.axl.ErrorAndWarningException
SAXException

removeService

public boolean removeService(ConnectionProxy connection)
                      throws ConnectionParameterException,
                             AuthenticationException,
                             com.esri.aims.mtier.io.http.UnableToPingEsrimapException,
                             com.esri.aims.mtier.model.axl.AXLAttributeException,
                             com.esri.aims.mtier.model.axl.ErrorAndWarningException,
                             SAXException
Removes this service.

Throws:
ConnectionParameterException
AuthenticationException
com.esri.aims.mtier.io.http.UnableToPingEsrimapException
com.esri.aims.mtier.model.axl.AXLAttributeException
com.esri.aims.mtier.model.axl.ErrorAndWarningException
SAXException

startService

public boolean startService(ConnectionProxy connection)
                     throws ConnectionParameterException,
                            AuthenticationException,
                            com.esri.aims.mtier.io.http.UnableToPingEsrimapException,
                            com.esri.aims.mtier.model.axl.AXLAttributeException,
                            com.esri.aims.mtier.model.axl.ErrorAndWarningException,
                            SAXException
Starts this service.

Throws:
ConnectionParameterException
AuthenticationException
com.esri.aims.mtier.io.http.UnableToPingEsrimapException
com.esri.aims.mtier.model.axl.AXLAttributeException
com.esri.aims.mtier.model.axl.ErrorAndWarningException
SAXException

stopService

public boolean stopService(ConnectionProxy connection)
                    throws ConnectionParameterException,
                           AuthenticationException,
                           com.esri.aims.mtier.io.http.UnableToPingEsrimapException,
                           com.esri.aims.mtier.model.axl.AXLAttributeException,
                           com.esri.aims.mtier.model.axl.ErrorAndWarningException,
                           SAXException
Stops this service.

Throws:
ConnectionParameterException
AuthenticationException
com.esri.aims.mtier.io.http.UnableToPingEsrimapException
com.esri.aims.mtier.model.axl.AXLAttributeException
com.esri.aims.mtier.model.axl.ErrorAndWarningException
SAXException

getAccessInt

public static int getAccessInt(String access)
Returns the access level defined by the parameter as a static integer. If the parameter is not recognized, then -1 is returned.


getImageTypeInt

public static int getImageTypeInt(String imageType)
Returns the image type defined by the parameter as a static integer. If the parameter is not recognized, then -1 is returned.


usesBinary

public boolean usesBinary()

useBinary

public void useBinary(boolean useBinary)

getExtension

public String getExtension()

setExtension

public void setExtension(String ext)

toString

public String toString()
Overwrites Object.toString().

Overrides:
toString in class Object

readBytes

public static byte[] readBytes(InputStream inStream)
                        throws IOException
Throws:
IOException