com.esri.adf.web.wms.data
Class WMSMapResource

java.lang.Object
  extended by com.esri.adf.web.data.GISResource
      extended by com.esri.adf.web.wms.data.WMSMapResource
All Implemented Interfaces:
WebContextInitialize, WebLifecycle, Serializable

public class WMSMapResource
extends GISResource

The WMSMapResource represents a GISResource for WMS Services.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.esri.adf.web.data.GISResource
alias, context, defaultSpatialReference, functionalities, hasFailedFunctionalities, init
 
Constructor Summary
WMSMapResource()
           
 
Method Summary
 String getAlias()
           Returns a reader friendly name for this resource.
 String getImageFormat(String format)
          Convenient method to return the WMS Service specific map image format from the available list of WMS Service supported formats.
 String getPassword()
          Returns the password to connect authenticated WMS service.
 int getSpatialReferenceId()
          Returns the user defined spatial reference id.
 String getUserName()
          Returns the user name to connect authenticated WMS service.
 com.esri.wms.client.Map getWmsMap()
           
 com.esri.wms.client.ServerConnection getWmsServerConnection()
           
 String getWmsURL()
          Returns the WMS Resource Web Access URL String.
 String getWmsVersion()
          Returns the constant defining the current WMS version.
 void init(WebContext webContext)
           This method is called by the WebContext to initialize the resource.
 boolean isPasswordEncrypted()
          Indicates whether the given password is encrypted or not.
 void setPassword(String password)
          Sets the password to connect the authenticate WMS service.
 void setPasswordEncrypted(boolean passwordEncrypted)
          Sets to true if the given password is encrpted.
 void setSpatialReferenceId(int spatialReferenceId)
          Set the spatial reference id if you want this resource to use other than the default spatial reference.
 void setUserName(String userName)
          Sets the user name to connect the authenticate WMS service.
 void setWmsURL(String wmsURL)
          Sets the WMS Resource Web Access URL String.
 void setWmsVersion(String wmsVersion)
          Sets the version of WMS.
 
Methods inherited from class com.esri.adf.web.data.GISResource
activate, addFunctionality, destroy, getDefaultSpatialReference, getFunctionalities, getFunctionality, getWebContext, passivate, setAlias, setFunctionalities
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WMSMapResource

public WMSMapResource()
Method Detail

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 GISResource
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)

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

getWmsServerConnection

public com.esri.wms.client.ServerConnection getWmsServerConnection()

getWmsMap

public com.esri.wms.client.Map getWmsMap()

getWmsURL

public String getWmsURL()
Returns the WMS Resource Web Access URL String.

Returns:
the URL string

setWmsURL

public void setWmsURL(String wmsURL)
Sets the WMS Resource Web Access URL String.
   For Example,
     this.wmsResource.setWMSURL("http://localhost:8399/arcgis/services/USA/MapServer/WMSServer");
 
              [OR]
 
   <managed-bean>
    <managed-bean-name>resource</managed-bean-name>
    <managed-bean-class>com.esri.adf.web.wms.data.WMSMapResource</managed-bean-class>
    <managed-bean-scope>none</managed-bean-scope>
    <managed-property>
      <property-name>wmsURL</property-name>
      <value>http://srinagar:8399/arcgis/services/USAAlbersConic/MapServer/WMSServer</value>
    </managed-property>
    <managed-property>
      <property-name>functionalities</property-name>
      <map-entries>
        <map-entry>
          <key>map</key>
          <value>#{wmsMap}</value>
        </map-entry>
        <map-entry>
          <key>toc</key>
          <value>#{wmsToc}</value>
        </map-entry>
        <map-entry>
          <key>overview</key>
          <value>#{wmsOverview}</value>
        </map-entry>
        <map-entry>
          <key>query</key>
          <value>#{wmsQuery}</value>
        </map-entry>
      </map-entries>
    </managed-property>
    <managed-property>
      <property-name>spatialReferenceId</property-name>
      <value>102008</value>
    </managed-property>
  </managed-bean>
 

Parameters:
wmsURL - the URL String

getUserName

public String getUserName()
Returns the user name to connect authenticated WMS service.

Returns:
the user name

setUserName

public void setUserName(String userName)
Sets the user name to connect the authenticate WMS service.

Parameters:
userName - the user name

getPassword

public String getPassword()
Returns the password to connect authenticated WMS service.

Returns:
the password

setPassword

public void setPassword(String password)
Sets the password to connect the authenticate WMS service.

Parameters:
password - the password to connect the authenticate WMS service

isPasswordEncrypted

public boolean isPasswordEncrypted()
Indicates whether the given password is encrypted or not. By default the password is not encrypted "false".

Returns:
true if password is encrypted; false otherwise

setPasswordEncrypted

public void setPasswordEncrypted(boolean passwordEncrypted)
Sets to true if the given password is encrpted.

Parameters:
passwordEncrypted - true if password is encrpted; false otherwise

getWmsVersion

public String getWmsVersion()
Returns the constant defining the current WMS version.

Returns:
the WMS version string

setWmsVersion

public void setWmsVersion(String wmsVersion)
Sets the version of WMS. The following constants can be passed as a parameter:
 1. com.esri.wms.client.ServerConnection.SPEC_VER_1_0_0 = "1.0.0"
 2. com.esri.wms.client.ServerConnection.SPEC_VER_1_1_0 = "1.1.0"
 3. com.esri.wms.client.ServerConnection.SPEC_VER_1_1_1 = "1.1.1"
 4. com.esri.wms.client.ServerConnection.SPEC_VER_1_3_0 = "1.3.0"
 

Parameters:
wmsVersion - WMS version constant

getSpatialReferenceId

public int getSpatialReferenceId()
Returns the user defined spatial reference id.

Returns:
the spatial reference id

setSpatialReferenceId

public void setSpatialReferenceId(int spatialReferenceId)
Set the spatial reference id if you want this resource to use other than the default spatial reference. If the specified spatial reference id is not available in the supported list then the default spatial reference is used by this resource.

Parameters:
spatialReferenceId - the spatial reference id
See Also:
WMSUtil.getWMSSpatialReference(java.util.List, int), Map.getDefaultSpatialReference()

getImageFormat

public String getImageFormat(String format)
Convenient method to return the WMS Service specific map image format from the available list of WMS Service supported formats.
 For example,
 if the WMS Service supported formats are,
   image/bmp, image/jpeg, image/tiff, image/png, image/gif and image/svg+xml
 
 then specifying "PNG" will return "image/png"
 Also, unless implicitly declared by server, otherwise "PNG8", "PNG24", "PNG32" will 
 be treated as "image/png"
 
 For example,
 - if the WMS server supports image/png32,
 specifying "PNG32" will return "image/png32"
 
 - if the WMS server supports image/png,
 specifying "PNG32" will return "image/png"
 

Parameters:
format - the user defined format
Returns:
the WMS service specific map image format
See Also:
getWmsServerConnection(), ServerConnection.getMapFormats()