com.sas.graphics.map
Class ESRIConnection

com.sas.graphics.map.ESRIConnection

public class ESRIConnection

The ESRIConnection contains the properties needed to connect to an ESRI server. It also has the ability to perform certain informational tasks, such as returning a list of layers and visibilities, and some data validation. This is accomplished by making the connection, getting the needed information, and releasing the connection.


Field Summary
static java.lang.String ESRI_LAYER_ALWAYSOFF
          Indicates the layer should never display.
static java.lang.String ESRI_LAYER_ALWAYSON
          Indicates the layer should always display.
static java.lang.String ESRI_LAYER_USEMAPSERVICERULES
          Indicates the layer should display based on the rules defined by the map service.
 
Constructor Summary
ESRIConnection()
          Creates a default ESRIConnection object.
ESRIConnection(java.lang.String server, java.lang.String domainName, java.lang.String userid, java.lang.String password)
          Creates an ESRI Connection object, using passed in map service information.
 
Method Summary
 java.lang.String chooseField(java.lang.Object[] data, java.lang.String layerName, java.lang.String[] fieldNames, int numToCheck)
          Selects a field, from those provided, that best matches the provided data.
 java.lang.String getDomain()
          Returns the domain used to connect to the ESRI server.
 java.lang.Object[] getFieldValues(java.lang.String layerName, java.lang.String fieldName, int numValues)
          Returns a list of values from the map service, based on the layerName and fieldName provided.
 java.lang.String getGisServer()
          Returns the ESRI server name.
 java.util.HashMap getLayerVisibilities(java.util.HashMap levelToLayerMap)
          Gets a list of the layers available on the map service, and a value indicating their visibility.
 java.lang.String getMapServiceName()
          Returns the map service name.
 java.lang.String[] getMapServiceNames()
          Returns a list of ESRI Map Service names that are available on the map server.
 java.lang.String getUserName()
          Returns the user name used to connect to the ESRI server.
 java.lang.String getUserPwd()
          Returns the password used to connect to the ESRI server.
 void setConnectionProperties(java.lang.String server, java.lang.String domainName, java.lang.String userid, java.lang.String password)
          Sets all the ESRI connection properties at once.
 void setDomain(java.lang.String domain)
          Sets the domain used to connect to the ESRI service.
 void setGisServer(java.lang.String gisServer)
          Sets the ESRI server name.
 void setMapServiceName(java.lang.String mapServiceName)
          Sets the map service name.
 void setUserName(java.lang.String userName)
          Sets the user name used to connect to the ESRI server.
 void setUserPwd(java.lang.String userPwd)
          Sets the password used to connect to the ESRI server.
 double[] testData(java.lang.Object[] data, java.lang.String layerName, java.lang.String fieldName)
          This method checks to see how much of the passed-in data matches the data that is found on the ESRI map service.
 

Field Detail

ESRI_LAYER_ALWAYSON

public static final java.lang.String ESRI_LAYER_ALWAYSON
Indicates the layer should always display. Currently this is unsupported.

See Also:
Constant Field Values

ESRI_LAYER_ALWAYSOFF

public static final java.lang.String ESRI_LAYER_ALWAYSOFF
Indicates the layer should never display.

See Also:
Constant Field Values

ESRI_LAYER_USEMAPSERVICERULES

public static final java.lang.String ESRI_LAYER_USEMAPSERVICERULES
Indicates the layer should display based on the rules defined by the map service. This allows the layer to appear "naturally" as the user zooms into the map.

See Also:
Constant Field Values
Constructor Detail

ESRIConnection

public ESRIConnection()
Creates a default ESRIConnection object.


ESRIConnection

public ESRIConnection(java.lang.String server,
                      java.lang.String domainName,
                      java.lang.String userid,
                      java.lang.String password)
Creates an ESRI Connection object, using passed in map service information.

Parameters:
server -
domainName -
userid -
password -
Method Detail

setConnectionProperties

public void setConnectionProperties(java.lang.String server,
                                    java.lang.String domainName,
                                    java.lang.String userid,
                                    java.lang.String password)
Sets all the ESRI connection properties at once.

Parameters:
server -
domainName -
userid -
password -

getDomain

public java.lang.String getDomain()
Returns the domain used to connect to the ESRI server.

Returns:
The domain

setDomain

public void setDomain(java.lang.String domain)
Sets the domain used to connect to the ESRI service.

Parameters:
domain - The domain to set.

getGisServer

public java.lang.String getGisServer()
Returns the ESRI server name.

Returns:
Returns the server name.

setGisServer

public void setGisServer(java.lang.String gisServer)
Sets the ESRI server name.

Parameters:
gisServer - The new server name.

getMapServiceName

public java.lang.String getMapServiceName()
Returns the map service name.

Returns:
Returns the mapServiceName.

setMapServiceName

public void setMapServiceName(java.lang.String mapServiceName)
Sets the map service name. This is the map, located on the ESRI server, that will be displayed by the component.

Parameters:
mapServiceName - The mapServiceName to set.

getUserName

public java.lang.String getUserName()
Returns the user name used to connect to the ESRI server.

Returns:
Returns The userName

setUserName

public void setUserName(java.lang.String userName)
Sets the user name used to connect to the ESRI server.

Parameters:
userName - The userName to set.

getUserPwd

public java.lang.String getUserPwd()
Returns the password used to connect to the ESRI server. This is usually encrypted.

Returns:
Returns The password

setUserPwd

public void setUserPwd(java.lang.String userPwd)
Sets the password used to connect to the ESRI server. This is usually encrypted.

Parameters:
userPwd - The userPwd to set

getLayerVisibilities

public java.util.HashMap getLayerVisibilities(java.util.HashMap levelToLayerMap)
                                       throws ESRIException
Gets a list of the layers available on the map service, and a value indicating their visibility.
Possible values in the map are:

Parameters:
levelToLayerMap -
Returns:
HashMap list of layers available on the map service.
Throws:
ESRIException

getFieldValues

public java.lang.Object[] getFieldValues(java.lang.String layerName,
                                         java.lang.String fieldName,
                                         int numValues)
                                  throws ESRIException
Returns a list of values from the map service, based on the layerName and fieldName provided. The first n observations are returned, with n=numValues. If numValues is -1 then all values are returned.

Parameters:
layerName - Name of the ESRI map layer
fieldName - FieldName of the variable to look at
numValues - Number of values to return, or -1 to return all values
Returns:
A list of values
Throws:
java.lang.Exception
ESRIException

chooseField

public java.lang.String chooseField(java.lang.Object[] data,
                                    java.lang.String layerName,
                                    java.lang.String[] fieldNames,
                                    int numToCheck)
                             throws ESRIException
Selects a field, from those provided, that best matches the provided data.

Parameters:
data - The array of data to check against
layerName - The layer of the map service to check
fieldNames - The list of fields to check. If this is null, all fields are checked.
numToCheck - Number of map service values that should be used to check, or -1 to check all values
Returns:
A String representing the field name, or an empty String if none are valid or there are no matches
Throws:
java.lang.Exception
ESRIException

testData

public double[] testData(java.lang.Object[] data,
                         java.lang.String layerName,
                         java.lang.String fieldName)
                  throws ESRIException
This method checks to see how much of the passed-in data matches the data that is found on the ESRI map service.

Parameters:
data - The data to check against
layerName - The layer on the ESRI map service
fieldName - The field name on that layer
Returns:
An array of two doubles. The first is the percentage of the passed-in data that matches what is found on the map service, essentially the coverage. The second double is the percentage of map data that matches the passed-in data.
Throws:
java.lang.Exception
ESRIException

getMapServiceNames

public java.lang.String[] getMapServiceNames()
                                      throws ESRIException
Returns a list of ESRI Map Service names that are available on the map server. Each Map Service is guaranteed to be of type "MapServer".

Returns:
List of Map Service names
Throws:
java.lang.Exception
ESRIException



Copyright © 2009 SAS Institute Inc. All Rights Reserved.