ArcGIS Enterprise: Developing Server Extensions and ...

40
Hannes Fleischer ArcGIS Enterprise: Developing Server Extensions and Interceptors

Transcript of ArcGIS Enterprise: Developing Server Extensions and ...

Page 1: ArcGIS Enterprise: Developing Server Extensions and ...

Hannes Fleischer

ArcGIS Enterprise: Developing Server Extensions and Interceptors

Page 2: ArcGIS Enterprise: Developing Server Extensions and ...

Agenda

• Development Kits :: Enterprise SDK, ArcObjects SDK

• Extension Types :: Server Object Interceptor, Server Object Extension

• Development :: create, update, debug

• SOE Demo :: basic deployment

• Development :: do’s and dont’s

• Development :: automate deployment

• SOI Demo :: custom labelling

Page 3: ArcGIS Enterprise: Developing Server Extensions and ...

Development Kits

• Enterprise SDK- MapServices and FeatureServices published from ArcGIS Pro- SDK for Java and .NET developers- IDE integration for Eclipse (Java) and Visual Studio 2015 and 2017 (.NET)

• ArcObjects SDK- MapServices, FeatureServices and ImageServices published from ArcMap- SDK for Java and .NET developers- IDE integration for Eclipse (Java) and Visual Studio 2015 and 2017 (.NET)

Page 4: ArcGIS Enterprise: Developing Server Extensions and ...

GIS Server

Extension Types :: Server Object Interceptor

Feature Service

Well-defined API

SOI

Out-of-box applications

Image ServiceSOI

Page 5: ArcGIS Enterprise: Developing Server Extensions and ...

Extension Types :: Server Object Interceptor

• No changes in API- Extended Functionality is hidden behind the standard API

• Usecases- Extended security requirements- Layer level access control- Data enrichment- Extended logging- Tracking activity

• Multiple Server Object Interceptors can form a chain

Page 6: ArcGIS Enterprise: Developing Server Extensions and ...

Extension Types :: Server Object Extension

Custom API

Custom applicationsGIS Server

Feature Service

Image Service

SOE

SOE

Well-defined API

Out-of-box applications

Page 7: ArcGIS Enterprise: Developing Server Extensions and ...

Extension Types :: Server Object Extension

• Custom functionality added to ArcGIS Server

• Faster than geoprocessing

• Usecases- Editing- Data processing- Network analysis- Image analysis

Page 8: ArcGIS Enterprise: Developing Server Extensions and ...

Extension Types :: common requirements

• Required interfaces and annotations- IServerObjectExtension init, shutdown- @ArcGISExtension- @ServerObjectExtProperties extension definition

• Optional interfaces- IObjectConstruct construct with properties- IObjectActivate activate, deactivate

• Both SOEs and SOIs are packaged as “.soe” files

Page 9: ArcGIS Enterprise: Developing Server Extensions and ...

Extension Types :: Server Object Interceptor

• Required interfaces- IRESTRequestHandler REST API , including ArcGIS Pro- IRequestHandler and IRequestHandler2 SOAP API, including ArcMap- IWebRequestHandler OGC requests

• Strategies- Block all interfaces, then allow as suitable security functionality- Allow all interfaces, implement where required non security functionality

Page 10: ArcGIS Enterprise: Developing Server Extensions and ...

Extension Types :: Server Object Extension

• 1 or more of- IRESTRequestHandler REST API- IRequestHandler and IRequestHandler2 SOAP API, including ArcMap and ArcGIS Pro- IWebRequestHandler OGC requests

Page 11: ArcGIS Enterprise: Developing Server Extensions and ...

Development :: creating extensions

• Create extension- Eclipse plugin-in template- Visual Studio template project

• Add logic

• Create extension file, using utilities provided with the respective SDK

• Register extension in ArcGIS Server Manager

• Enable extension on service

Page 12: ArcGIS Enterprise: Developing Server Extensions and ...

Development :: updating extensions

• Add logic

• Create extension file, using utilities provided with the respective SDK

• Update extension in ArcGIS Server Manager- Must have the same name it had when originally being registered- Must contain the same set of SOIs and/or SOEs it contained when being registered- Must restart services after extension update

Page 13: ArcGIS Enterprise: Developing Server Extensions and ...

Development :: debugging extensions

• Configure settings in ArcGIS Server Manager (Site Extensions Debug Settings)- Activate debugging- Optionally specify a delay (when you need to debug code running at startup)- Assign a port range

• Restart service

• Find process in task-manager

• Attach to process for debugging

Page 14: ArcGIS Enterprise: Developing Server Extensions and ...

SOE Demobasic deployment

Page 15: ArcGIS Enterprise: Developing Server Extensions and ...

Development :: do’s

• Using the lifecyle defined by implemented interfaces- IObjectConstruct- IObjectActivate

• Using built in helper types- com.esri.arcgis.server.SOIHelper- com.esri.arcgis.server.IServerLog- com.esri.arcgis.system.ServerUtilities- com.esri.arcgis.system.Cleaner

• Separating your logic from extension logic

• Running a 1/1 instance configuration when debugging

Page 16: ArcGIS Enterprise: Developing Server Extensions and ...

Development :: dont’s

• Holding strong references to ArcObject instances

• Executing code in a thread other than the main thread- Stream::parallel- ExecutorService- CompleteableFuture- Running code after the instance was deactivated

• Updating extension on a busy server

• Not taking care of error handling, especially in SOI

Page 17: ArcGIS Enterprise: Developing Server Extensions and ...

Development :: automate with REST API Admin

• Automate “.soe” file packaging

• Automate extension update- Get Token- Upload “.soe” extension file- Update extension

• Automate debugging- Configure debugging- Find and restart affected services- Java: have debug configurations generated

Page 18: ArcGIS Enterprise: Developing Server Extensions and ...

SOI / SOE Demo :: boilerplate extension

• Shared code for SOE and SOI, Enterprise SDK and ArcObjects SDK

• Extension type and SDK get specified when cooking the “.soe” file

• Configurable operations

• Custom labelling solution with Server Object Interceptor- Manual label placement required - can not use standard labelling- Feature linked labels required - can not use graphics- Rendering on MapService export required - can not rely on ArcGIS API for Javascript

Page 19: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling

Berlin

Page 20: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling

Berlin

Page 21: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling

Feature Service

Page 22: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling

City

Feature Service

City

Page 23: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling

City

Feature Service

City

BerlinAnnotation (?) Annotation

Page 24: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling

City

Feature Service

Anchor

Annotation

City

SOI Anchor

Page 25: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling

City

Feature Service

Anchor

Annotation

City

SOI Anchor

Page 26: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling :: geometry update to anchor

City

Feature Service

Anchor

Annotation

City

{"geometry": {"x": 2396409,"y": 6278461

},"attributes": {"OBJECTID": 7108

}}

updates to anchor

SOI Anchor

Page 27: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling :: geometry update to anchor

City

Feature Service

Anchor

Annotation

City

{"geometry": {"x": 2396409,"y": 6278461

},"attributes": {"OBJECTID": 7108

}}

SOI Anchor

updates to anchor

Page 28: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling :: query anchor for FEATUREID

City

Feature Service

Anchor

Annotation

City

Query

{"geometry": {"x": 2396409,"y": 6278461

},"attributes": {"OBJECTID": 7108

}}

SOI Anchor

updates to anchor

Page 29: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling :: rewrite request to contain FEATUREID

City

Feature Service

Anchor

Annotation

City

{"geometry": {"x": 2396409,"y": 6278461

},"attributes": {"OBJECTID": 7108,"FEATUREID": 64

}}

SOI Anchor

updates to anchor

Page 30: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling :: find City and calculate offsets

City

Feature Service

Anchor

Annotation

CityQuery

{"geometry": {"x": 2396409,"y": 6278461

},"attributes": {"OBJECTID": 7108,"FEATUREID": 64

}}

SOI Anchor

updates to anchor

Page 31: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling :: rewrite request to contain offsets

City

Feature Service

Anchor

Annotation

City

{"geometry": { "x": 2396409,"y": 6278461

},"attributes": {"OBJECTID": 7108,"FEATUREID": 64,"XOFFSET": 9,"YOFFSET": 15

}}

SOI Anchor

updates to anchor

Page 32: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling :: find Annotation and apply offsets

City

Feature Service

Anchor

Annotation

City

Edit

{"geometry": { "x": 2396409,"y": 6278461

},"attributes": {"OBJECTID": 7108,"FEATUREID": 64,"XOFFSET": 9,"YOFFSET": 15

}}

SOI Anchor

updates to anchor

Page 33: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling

City

Feature Service

Anchor

Annotation

City

{"geometry": { "x": 2396409,"y": 6278461

},"attributes": {"OBJECTID": 7108,"FEATUREID": 64,"XOFFSET": 9,"YOFFSET": 15

}}

SOI Anchor

updates to anchor

Page 34: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling :: execute the actual update

City

Feature Service

Anchor

Annotation

City

applyEdits

{"geometry": { "x": 2396409,"y": 6278461

},"attributes": {"OBJECTID": 7108,"FEATUREID": 64,"XOFFSET": 9,"YOFFSET": 15

}}

SOI Anchor

updates to anchor

Page 35: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling :: successful update to Anchor

SOI

City

Feature Service

Anchor

Annotation

City

{"addResults": [],"updateResults": [ {"objectId": 7108,"success": true

}],"deleteResults": []

}

response

Anchor

Page 36: ArcGIS Enterprise: Developing Server Extensions and ...

SOI Demo :: custom labelling

City

Feature Service

Anchor

Annotation

City

{"addResults": [],"updateResults": [ {"objectId": 7108, "success": true

}],"deleteResults": []

}

response

SOI Anchor

Page 37: ArcGIS Enterprise: Developing Server Extensions and ...

SOI DemoCustom labelling

Page 38: ArcGIS Enterprise: Developing Server Extensions and ...

Developing Server Extensions and Interceptors :: resources

• https://github.com/hfleischer/boilerplate-soe

• https://enterprise.arcgis.com/en/server/latest/develop/windows/about-extending-services.htm- http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#welcome.htm

- http://desktop.arcgis.com/en/arcobjects/latest/java/#80146cac-6b50-4c82-a9f5-7a5be3406c5b.htm

- https://enterprise.arcgis.com/en/sdk/latest/windows/webframe.html#a2596185-823b-4de3-9831-7842fb6100fb.html

• https://enterprise.arcgis.com/en/server/latest/develop/windows/coding-practices-for-extensions.htm

• https://developers.arcgis.com/rest/services-reference/rest-api-admin.htm

Page 39: ArcGIS Enterprise: Developing Server Extensions and ...

Complete answersand select “Submit”

Scroll down to find the feedback section

Select the session you attended

Download the Esri Events app and find your event

Please Take Our Survey on the App

Page 40: ArcGIS Enterprise: Developing Server Extensions and ...