Class GSLayerEncoder

  • Direct Known Subclasses:
    GSLayerEncoder21

    public class GSLayerEncoder
    extends PropertyXMLEncoder
    Layer encoder for Geoserver >= 2.2
    Since:
    gs-2.2.x
    Version:
    $Id: $
    Author:
    ETj (etj at geo-solutions.it), Carlo Cancellieri - carlo.cancellieri@geo-solutions.it, Emmanuel Blondel - emmanuel.blondel1@gmail.com The layer encoder is enabled by default <layer> <name>{LAYERNAME}</name> <type>RASTER</type> <defaultStyle> <name>{STYLE_NAME}</name> <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://{GSURL}/rest/styles/{STYLE}xml" type="application/xml"/> </defaultStyle> <resource class="coverage"> <name>{RESOURCE_NAME}</name> <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://{GSURL}/rest/workspaces/{WS}/coveragestores/{STORE}/coverages/{LAYER}.xml" type="application/xml"/> </resource> <attribution> <title>test</title> <href>http://www.fao.org/fileadmin/templates/faoweb/images/FAO-logo.png</href> <logoURL>http://www.fao.org/fileadmin/templates/faoweb/images/FAO-logo.png</logoURL> <logoWidth>412</logoWidth> <logoHeight>77</logoHeight> <logoType>image/png</logoType> </attribution> ... </layer>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String AUTHORITY_URLS
      Constant AUTHORITY_URLS="authorityURLs"
      static java.lang.String DEFAULT_STYLE
      Constant DEFAULT_STYLE="defaultStyle"
      static java.lang.String IDENTIFIERS
      Constant IDENTIFIERS="identifiers"
      static java.lang.String STYLES
      Constant STYLES="styles"
    • Constructor Summary

      Constructors 
      Constructor Description
      GSLayerEncoder()
      Constructor for GSLayerEncoder.
      GSLayerEncoder​(boolean encodeLists)
      Constructor for GSLayerEncoder.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAuthorityURL​(GSAuthorityURLInfoEncoder authorityURLInfo)
      Add an authorityURLInfo to the GeoServer layer
      protected void addDefaultStyle​(java.lang.String defaultStyle)
      addDefaultStyle
      protected void addDefaultStyle​(java.lang.String workspace, java.lang.String defaultStyle)
      addDefaultStyle
      protected void addEnabled()
      enabled the layer
      void addIdentifier​(GSIdentifierInfoEncoder identifierInfo)
      Add an identifierInfo to the GeoServer layer
      protected void addQueryable​(java.lang.String queryable)
      Add the 'queryable' node with a text value from 'queryable' (true as default)
      void addStyle​(java.lang.String style)
      Add a style
      protected void addWmsPath​(java.lang.String path)
      addWmsPath
      boolean delAuthorityURL​(java.lang.String authorityURL)
      Deletes a AuthorityURLInfo from the list using the authorityURL (AuthorityURLInfo href)
      boolean delIdentifier​(java.lang.String authority)
      Deletes a IdentifierInfo from the list using the authority name (IdentifierInfo authority)
      boolean delStyle​(java.lang.String style)
      delete a style from the list of available styles
      void setAdvertised​(boolean advertised)
      setAdvertised
      void setDefaultStyle​(java.lang.String defaultStyle)
      setDefaultStyle
      void setDefaultStyle​(java.lang.String workspace, java.lang.String defaultStyle)
      setDefaultStyle
      void setEnabled​(boolean enable)
      setEnabled
      void setQueryable​(java.lang.Boolean queryable)
      Set or modify the 'queryable' node with a text value from 'queryable' (true as default)
      void setWmsPath​(java.lang.String path)
      Default WMS Path The GeoServer WMS path is, by default, /geoserver/wms.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • STYLES

        public static final java.lang.String STYLES
        Constant STYLES="styles"
        See Also:
        Constant Field Values
      • AUTHORITY_URLS

        public static final java.lang.String AUTHORITY_URLS
        Constant AUTHORITY_URLS="authorityURLs"
        See Also:
        Constant Field Values
      • IDENTIFIERS

        public static final java.lang.String IDENTIFIERS
        Constant IDENTIFIERS="identifiers"
        See Also:
        Constant Field Values
      • DEFAULT_STYLE

        public static final java.lang.String DEFAULT_STYLE
        Constant DEFAULT_STYLE="defaultStyle"
        See Also:
        Constant Field Values
    • Constructor Detail

      • GSLayerEncoder

        public GSLayerEncoder()

        Constructor for GSLayerEncoder.

      • GSLayerEncoder

        public GSLayerEncoder​(boolean encodeLists)

        Constructor for GSLayerEncoder.

        Parameters:
        encodeLists - a boolean.
    • Method Detail

      • addEnabled

        protected void addEnabled()
        enabled the layer
      • setEnabled

        public void setEnabled​(boolean enable)

        setEnabled

        Parameters:
        enable - true if layer should be set to enabled
      • addQueryable

        protected void addQueryable​(java.lang.String queryable)
        Add the 'queryable' node with a text value from 'queryable' (true as default)
        Parameters:
        queryable - a String object.
      • setQueryable

        public void setQueryable​(java.lang.Boolean queryable)
        Set or modify the 'queryable' node with a text value from 'queryable' (true as default)
        Parameters:
        queryable - a Boolean object.
      • addWmsPath

        protected void addWmsPath​(java.lang.String path)

        addWmsPath

        Parameters:
        path - the wms path to set
        See Also:
        setWmsPath(String)
      • setWmsPath

        public void setWmsPath​(java.lang.String path)
                        throws java.lang.IllegalArgumentException
        Default WMS Path The GeoServer WMS path is, by default, /geoserver/wms. However you can change it to /geoserver/anythingyouwant
        Parameters:
        path - the wms path to set
        Throws:
        java.lang.IllegalArgumentException - if path is null or empty
      • addDefaultStyle

        protected void addDefaultStyle​(java.lang.String defaultStyle)

        addDefaultStyle

        Parameters:
        defaultStyle - a String object.
        See Also:
        setDefaultStyle(String)
      • addDefaultStyle

        protected void addDefaultStyle​(java.lang.String workspace,
                                       java.lang.String defaultStyle)

        addDefaultStyle

        Parameters:
        defaultStyle - a String object.
        workspace - a String object.
        See Also:
        setDefaultStyle(String)
      • setDefaultStyle

        public void setDefaultStyle​(java.lang.String defaultStyle)
                             throws java.lang.IllegalArgumentException

        setDefaultStyle

        Parameters:
        defaultStyle - The style that will be applied if no style is specified.
        Throws:
        java.lang.IllegalArgumentException - if defaultStyle is null or empty
      • setDefaultStyle

        public void setDefaultStyle​(java.lang.String workspace,
                                    java.lang.String defaultStyle)

        setDefaultStyle

        Parameters:
        defaultStyle - a String object.
        workspace - a String object.
        See Also:
        setDefaultStyle(String)
      • addStyle

        public void addStyle​(java.lang.String style)
        Add a style
        Parameters:
        style - a String object.
      • delStyle

        public boolean delStyle​(java.lang.String style)
        delete a style from the list of available styles
        Parameters:
        style - a String object.
        Returns:
        true if something is removed, false otherwise
      • setAdvertised

        public void setAdvertised​(boolean advertised)

        setAdvertised

        Parameters:
        advertised - true if the layer should be advertised
      • delAuthorityURL

        public boolean delAuthorityURL​(java.lang.String authorityURL)
        Deletes a AuthorityURLInfo from the list using the authorityURL (AuthorityURLInfo href)
        Parameters:
        authorityURL - a String object.
        Returns:
        true if something is removed, false otherwise
      • delIdentifier

        public boolean delIdentifier​(java.lang.String authority)
        Deletes a IdentifierInfo from the list using the authority name (IdentifierInfo authority)
        Parameters:
        authority - a String object.
        Returns:
        true if something is removed, false otherwise