Esri Geoportal Server
1.2.2

com.esri.gpt.catalog.arcgis.agportal.publication
Class AgpBaseRequest

java.lang.Object
  extended by com.esri.gpt.catalog.arcgis.agportal.publication.AgpBaseRequest
Direct Known Subclasses:
AgpAddRequest, AgpDeleteRequest, AgpFolderRequest, AgpUpdateRequest

public abstract class AgpBaseRequest
extends Object

Base ArcGIS Portal request.


Nested Class Summary
protected static class AgpBaseRequest.AttrMap
           
static class AgpBaseRequest.ItemDesc
          Item description.
static class AgpBaseRequest.ItemEntry
          Item entry
static class AgpBaseRequest.ItemType
          Item type.
 
Field Summary
protected  CredentialProvider credentialProvider
           
protected  EndPoint ep
           
protected  RequestContext requestContext
           
protected static XsltTemplates XSLTTEMPLATES
           
 
Constructor Summary
AgpBaseRequest(RequestContext requestContext, CredentialProvider credtialProvider, EndPoint endPoint)
          Creates instance of the request.
 
Method Summary
protected  void checkError(String response)
          Checks response for errors.
protected  void execute(HttpClientRequest request)
          Executes HTTP request.
protected static CredentialProvider extractCredentialProvider(RequestContext ctx)
          Extracts credential provider for ArcGIS Portal from configuration via context.
protected  Map<String,List<String>> extractEsriItemAttributes(Node esriItemInfo)
          Extracts ESRI item attributes.
protected  String extractId(String response)
          Gets newly created document response
protected  Node extractItemInfo(String metadata)
          Extracts ESRI Item Information from metadata.
protected  String fetchToken()
          Fetch ArcGIS portal token.
protected  XsltTemplate getCompiledTemplate(String xsltPath)
          Gets a compiled XSLT template.
protected  String getFolderUrl(String folderId)
          Gets folder URL.
protected  String getItemUrl(String folderId, String itemId)
          Gets item URL.
protected  void processEsriItemAttributes(MultiPartContentProvider provider, Map<String,List<String>> attributes)
          Process attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XSLTTEMPLATES

protected static XsltTemplates XSLTTEMPLATES

credentialProvider

protected CredentialProvider credentialProvider

requestContext

protected RequestContext requestContext

ep

protected EndPoint ep
Constructor Detail

AgpBaseRequest

public AgpBaseRequest(RequestContext requestContext,
                      CredentialProvider credtialProvider,
                      EndPoint endPoint)
Creates instance of the request.

Parameters:
requestContext - request context
endPoint - ArcGIS Portal end point
credtialProvider - credential provider
Method Detail

fetchToken

protected String fetchToken()
                     throws AgpServerException,
                            AgpPublishException
Fetch ArcGIS portal token.

Throws:
IOException - if communication with the server fails
org.json.JSONException - if unable to parse server response
AgpServerException
AgpPublishException

execute

protected void execute(HttpClientRequest request)
                throws AgpServerException,
                       AgpPublishException
Executes HTTP request.

Parameters:
request - HTTP client request
Throws:
AgpServerException - server exception
AgpPublishException - publish exception

extractCredentialProvider

protected static CredentialProvider extractCredentialProvider(RequestContext ctx)
Extracts credential provider for ArcGIS Portal from configuration via context.

Parameters:
ctx - request context
Returns:
credential provider

extractItemInfo

protected Node extractItemInfo(String metadata)
                        throws AgpPublishException
Extracts ESRI Item Information from metadata.

Parameters:
metadata - metadata
Returns:
DOM node of ESRI Item Information
Throws:
AgpPublishException - if extracting ESRI Item Information fails

extractEsriItemAttributes

protected Map<String,List<String>> extractEsriItemAttributes(Node esriItemInfo)
Extracts ESRI item attributes.

Parameters:
esriItemInfo - DOM node with ESRI item info
Returns:
map of attributes

processEsriItemAttributes

protected void processEsriItemAttributes(MultiPartContentProvider provider,
                                         Map<String,List<String>> attributes)
                                  throws AgpPublishException
Process attributes.

Parameters:
provider -
attributes -
Throws:
AgpPublishException

checkError

protected void checkError(String response)
                   throws AgpServerException
Checks response for errors.

Parameters:
response - response
Throws:
IOException - if error found in the response
AgpServerException

extractId

protected String extractId(String response)
                    throws org.json.JSONException
Gets newly created document response

Parameters:
response - response
Returns:
id
Throws:
org.json.JSONException

getCompiledTemplate

protected XsltTemplate getCompiledTemplate(String xsltPath)
                                    throws TransformerException
Gets a compiled XSLT template.

Parameters:
xsltPath - the path to an XSLT
Returns:
the compiled template
Throws:
IOException - if an IO exception occurs
TransformerException - if a transformation exception occurs

getFolderUrl

protected String getFolderUrl(String folderId)
Gets folder URL.

Parameters:
folderId - folder id
Returns:
folder URL

getItemUrl

protected String getItemUrl(String folderId,
                            String itemId)
Gets item URL.

Parameters:
folderId - folder name
itemId - item id
Returns:
item URL

Esri Geoportal Server
1.2.2

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.