public class ServerUtilities
extends java.lang.Object
Constructor and Description |
---|
ServerUtilities() |
Modifier and Type | Method and Description |
---|---|
static JSONObject |
createOperation(java.lang.String operationName,
java.lang.String parameterList,
java.lang.String supportedOutputFormatsList,
boolean postOnly)
Creates an operation that can be called on a REST resource, using specified name, parameter list and
output formats list
|
static JSONObject |
createResource(java.lang.String name,
java.lang.String description,
boolean isCollection,
boolean isDefaultCollection)
Creates a REST resource based on specified name, description and collection flag
|
static Envelope |
getEnvelopeFromJSON(JSONObject jobj)
Retrieves Envelope from JSON
|
static IGeometry |
getGeometryFromJSON(JSONObject geometryJSON)
Returns an IGeometry given a JSON Object
|
static java.util.Set |
getGroupInfo()
Provides user group information by leveraging Sharing API
This method can be directly called from the main SOI class
(usage: Set
|
static JSONObject |
getJSONFromEnvelope(Envelope env)
Retrieves JSON from Envelope
|
static JSONObject |
getJSONFromFeature(Feature feature)
Returns JSON representation of a Feature object
|
static JSONObject |
getJSONFromGeometry(IGeometry geometry)
Returns JSON representation of specified geometry
|
static JSONObject |
getJSONFromMultipoint(Multipoint multipoint)
Returns JSON representation of a Multipoint object
|
static JSONObject |
getJSONFromPoint(Point point)
Returns JSON representation of a Point object
|
static JSONObject |
getJSONFromPolygon(Polygon polygon)
Returns JSON representation of a Polygon object
|
static JSONObject |
getJSONFromPolyline(Polyline polyline)
Returns JSON representation of a Polyline object
|
static JSONObject |
getJSONFromSR(ISpatialReference sr)
Retrieves JSON from Spatial Reference
|
static Multipoint |
getMultipointFromJSON(JSONObject multipointJSON)
Extracts MultiPoint geometry from specified JSONObject
|
static OutputStore |
getOutputStore(IServerObject mapServer)
Platform-agnostic way to create a client for the output store
Use this method instead of the constructor for implementations of the OutputStore interface.
|
static Point |
getPointFromJSON(JSONObject pointJSON)
Extracts Point geometry from specified JSONObject
|
static Polygon |
getPolygonFomJSON(JSONObject polygonJSON)
Extracts Polygon geometry from specified JSONObject
|
static Polyline |
getPolylineFomJSON(JSONObject polylineJSON)
Extracts Polyline geometry from specified JSONObject
|
static ILog2 |
getServerLogger()
Returns a handle to ArcGIS Server's log file via the ILog2 interface.
|
static IServerUserInfo |
getServerUserInfo()
Returns an IServerUserInfo, which can be used to retrieve security info such as
user name and the role the user name belongs to.
|
static ISpatialReference |
getSRFromJSON(JSONObject spatialReferenceJSON)
Retrieves spatial reference from JSON
|
static ISpatialReference |
getSRFromString(java.lang.String spatialReferenceString)
Retrieves spatial reference from string
This method may throw a runtime exception in case of errors
|
static boolean |
isKubernetes()
Checks environmental variables to determine whether the SOE
is running in windows/linux (server) or kubernetes
|
static java.lang.String |
sendError(int codeNumber,
java.lang.String errorMessageSummary,
java.lang.String[] errorMessageDetails)
Sends error message back to client in proper JSON format, which is as follows
* {
"error":
{
"code": 400,
"message": "Cannot perform query.
|
public static OutputStore getOutputStore(IServerObject mapServer)
mapServer
- public static boolean isKubernetes()
public static ISpatialReference getSRFromString(java.lang.String spatialReferenceString) throws java.lang.Exception
spatialReferenceString
- java.lang.Exception
public static ISpatialReference getSRFromJSON(JSONObject spatialReferenceJSON) throws java.lang.Exception
spatialReferenceJSON
- java.lang.Exception
public static JSONObject getJSONFromSR(ISpatialReference sr)
sr
- public static JSONObject getJSONFromPoint(Point point) throws java.lang.Exception
point
- com.esri.arcgis.geometry.Pointjava.lang.Exception
public static JSONObject getJSONFromMultipoint(Multipoint multipoint) throws java.lang.Exception
multipoint
- com.esri.arcgis.geometry.Multipointjava.lang.Exception
public static JSONObject getJSONFromPolyline(Polyline polyline) throws java.lang.Exception
polyline
- com.esri.arcgis.geometry.Polylinejava.lang.Exception
public static JSONObject getJSONFromPolygon(Polygon polygon) throws java.lang.Exception
polygon
- com.esri.arcgis.geometry.Polygonjava.lang.Exception
public static JSONObject getJSONFromFeature(Feature feature) throws java.lang.Exception
feature
- java.lang.Exception
public static JSONObject getJSONFromGeometry(IGeometry geometry) throws java.lang.Exception
geometry
- java.lang.Exception
public static JSONObject getJSONFromEnvelope(Envelope env)
env
- public static Point getPointFromJSON(JSONObject pointJSON) throws java.lang.Exception
json
- Input JSON object that contains geometry as sole member. Valid JSON format for Point is:
{
"x" : -118.15, "y" : 33.80, "spatialReference" : {"wkid" : 4326}
}
java.lang.Exception
public static Multipoint getMultipointFromJSON(JSONObject multipointJSON) throws java.lang.Exception
multipointJSON
- Input JSON object that contains geometry as sole member. Valid JSON format for Multipoint is:
{
"points" : [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ],
"spatialReference" : {"wkid" : 4326}
}
java.lang.Exception
public static Polyline getPolylineFomJSON(JSONObject polylineJSON) throws java.lang.Exception
polylineJSON
- Input JSON object that contains geometry as sole member. Valid JSON format for Polyline is:
{
"paths" : [
[ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ],
[ [-97.06326,32.759], [-97.06298,32.755] ]
],
"spatialReference" : {"wkid" : 4326}
}
java.lang.Exception
public static Polygon getPolygonFomJSON(JSONObject polygonJSON) throws java.lang.Exception
polygonJSON
- Input JSON object that contains geometry as sole member. Valid JSON format for Polygon is:
{
"rings" : [
[ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ],
[ [-97.06326,32.759], [-97.06298,32.755], [-97.06153,32.749], [-97.06326,32.759] ]
],
"spatialReference" : {"wkid" : 4326}
}
java.lang.Exception
public static IGeometry getGeometryFromJSON(JSONObject geometryJSON) throws java.lang.Exception
geometryJSON
- java.lang.Exception
public static Envelope getEnvelopeFromJSON(JSONObject jobj)
jobj
- public static JSONObject createResource(java.lang.String name, java.lang.String description, boolean isCollection, boolean isDefaultCollection)
name
- description
- isCollection
- public static JSONObject createOperation(java.lang.String operationName, java.lang.String parameterList, java.lang.String supportedOutputFormatsList, boolean postOnly)
operationName
- parameterList
- supportedOutputFormatsList
- public static java.lang.String sendError(int codeNumber, java.lang.String errorMessageSummary, java.lang.String[] errorMessageDetails)
codeNumber
- - Error code. Could be part of a user defined error hierarchy.message
- - Message containing summary of error for the client application. This cannot be null or invalid.details
- - Error details that are not part of summary. This can be null.public static IServerUserInfo getServerUserInfo()
public static ILog2 getServerLogger()
public static java.util.Set getGroupInfo()